@import url('https://fonts.googleapis.com/css2?family=Kanit:wght@300;400;500;600;700&family=Outfit:wght@400;700;800&display=swap');

:root {
    /* --- Base Variables (Default Dark Theme) --- */
    --primary: #E50914;
    /* Netflix Red style */
    --primary-hover: #b20710;
    --accent: #ffd700;

    --bg-body: #0b0c10;
    /* Very dark navy/black */
    --bg-sidebar: #1f2833;
    /* Dark slate */
    --bg-card: #1f2833;
    /* Matching sidebar/surface */
    --bg-input: #0b0c10;

    --text-main: #ffffff;
    --text-muted: #c5c6c7;
    --text-on-primary: #ffffff;

    --border-color: rgba(255, 255, 255, 0.1);
    --hover-bg: rgba(255, 255, 255, 0.05);

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);

    --radius-md: 0.75rem;
    --radius-lg: 1rem;

    --transition: all 0.3s ease;
}

[data-theme="light"] {
    --bg-body: #f3f4f6;
    /* Light Gray */
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --bg-input: #f9fafb;

    --text-main: #111827;
    /* Dark Charcoal */
    --text-muted: #6b7280;
    /* Gray */

    --border-color: #e5e7eb;
    --hover-bg: #f3f4f6;

    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Kanit', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    transition: var(--transition);
    min-height: 100vh;
    overflow-x: hidden;
}

/* --- Public Facing Specifics (Keep Video BG logic separate or overlay) --- */
.video-bg {
    position: fixed;
    top: 50%;
    left: 50%;
    min-width: 100%;
    min-height: 100%;
    width: auto;
    height: auto;
    z-index: -1;
    object-fit: cover;
    transform: translate(-50%, -50%) scale(1.3);
    filter: brightness(0.5);
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, transparent 0%, #000 100%);
    z-index: -1;
}

/* --- Layout & Grid --- */
.dashboard-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 280px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    transition: var(--transition);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 280px;
    /* Width of sidebar */
    padding: 2rem 3rem;
    background-color: var(--bg-body);
    transition: var(--transition);
    min-height: 100vh;
}

/* --- Typography --- */
h1,
h2,
h3,
h4 {
    font-family: 'Kanit', sans-serif;
    color: var(--text-main);
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

h2 {
    font-size: 1.7rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

h3 {
    font-size: 1.35rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

/* Counter Text Polish */
.counter-display {
    font-family: 'Outfit', sans-serif;
    /* Modern number font */
    font-weight: 800;
    font-size: 5rem;
    background: linear-gradient(to bottom, #ffffff, #aaaaaa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.3));
}

/* --- Components --- */

/* Sidebar Links */
.nav-link {
    display: flex;
    align-items: center;
    padding: 0.875rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-md);
    margin-bottom: 0.5rem;
    font-weight: 500;
    transition: var(--transition);
}

.nav-link:hover,
.nav-link.active {
    background-color: var(--primary);
    color: var(--text-on-primary);
    box-shadow: 0 4px 12px rgba(255, 71, 87, 0.3);
}

/* Cards */
.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    height: 100%;
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
    border-color: var(--primary);
}

/* Stats Logic */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-value {
    font-size: 3rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    color: var(--primary);
    line-height: 1;
    margin: 0.5rem 0;
}

/* Tables */
.table-wrapper {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background-color: rgba(0, 0, 0, 0.02);
    padding: 1rem 1.5rem;
    text-align: left;
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
    vertical-align: middle;
}

tr:last-child td {
    border-bottom: none;
}

tbody tr:hover {
    background-color: var(--hover-bg);
}

/* Forms & Inputs */
.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    border: 2px solid var(--border-color);
    background-color: var(--bg-input);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.95rem;
    transition: 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(255, 71, 87, 0.1);
}

.form-control option {
    background-color: var(--bg-card);
    color: var(--text-main);
}

/* Custom Select Style */
select.form-control {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1.2rem;
    padding-right: 3rem;
    cursor: pointer;
    background-color: var(--bg-input);
    color: var(--text-main);
}

/* Force options to have dark background to match text color */
select.form-control option {
    background-color: #1f2833;
    color: #ffffff;
}

select.form-control:hover {
    border-color: var(--text-muted);
}

/* Toggle Switch (Checkbox style) */
.switch {
    display: inline-block;
    width: 50px;
    height: 28px;
    position: relative;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-color);
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--primary);
}

input:checked+.slider:before {
    transform: translateX(22px);
}

/* Premium Buttons - Redesigned */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    padding: 1rem 2rem;
    /* Larger touch area */
    border-radius: 12px;
    /* Smooth rounded corners */
    font-weight: 600;
    font-size: 1.1rem;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    text-transform: uppercase;
    /* Modern look */
    letter-spacing: 0.5px;
    font-family: 'Kanit', sans-serif;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: linear-gradient(135deg, #FF3E3E 0%, #D00000 100%);
    color: white;
    box-shadow: 0 8px 20px rgba(210, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-primary:active {
    transform: scale(0.98);
    box-shadow: 0 5px 10px rgba(210, 0, 0, 0.2);
}

.btn-primary::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.2) 0%, transparent 100%);
    opacity: 0;
    transition: opacity 0.3s;
}

.btn-primary:hover::after {
    opacity: 1;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 25px rgba(210, 0, 0, 0.5);
    background: linear-gradient(135deg, #ff5c5c 0%, #e60000 100%);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #e0e0e0;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.4);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

/* Rusty Button Style - Realistic Version */
.btn-rusty {
    background-color: #3e2723;
    background-image:
        /* Deep rust patches */
        radial-gradient(circle at 15% 15%, rgba(184, 80, 66, 0.9) 0%, transparent 25%),
        radial-gradient(circle at 85% 85%, rgba(160, 82, 45, 0.8) 0%, transparent 30%),
        /* General grime */
        linear-gradient(45deg, rgba(0, 0, 0, 0.6) 0%, transparent 100%),
        /* Metallic vertical scratch/grain */
        repeating-linear-gradient(90deg, transparent 0px, transparent 1px, rgba(0, 0, 0, 0.3) 1px, rgba(0, 0, 0, 0.3) 2px);

    /* Blending to create dirty look */
    background-blend-mode: screen, normal, multiply, overlay;

    color: #eeeeee;
    border: 2px solid #5d4037;
    border-bottom: 2px solid #3e2723;

    /* Heavy shadows for depth */
    box-shadow:
        inset 0 0 15px rgba(0, 0, 0, 0.9),
        /* Internal shadow */
        inset 1px 1px 2px rgba(255, 255, 255, 0.2),
        /* Edge highlight */
        0 4px 10px rgba(0, 0, 0, 0.7);
    /* Drop shadow */

    text-shadow: 2px 2px 4px black;
    font-weight: 700;
    text-transform: uppercase;
}

.btn-rusty:hover {
    filter: brightness(1.2) contrast(1.1);
    transform: translateY(-2px);
    box-shadow:
        inset 0 0 20px rgba(184, 80, 66, 0.3),
        /* Glowing rust */
        0 8px 20px rgba(0, 0, 0, 0.8);
    color: #fff;
    cursor: pointer;
}

.btn-rusty::before {
    display: none;
}



/* Theme Toggle Button */
.theme-toggle-btn {
    position: fixed;
    top: 1.5rem;
    right: 2rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    z-index: 100;
}

.theme-toggle-btn:hover {
    transform: rotate(15deg) scale(1.1);
    border-color: var(--primary);
    color: var(--primary);
}

/* Helper Classes */
.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.text-muted {
    color: var(--text-muted);
}

.text-success {
    color: #2ecc71;
}

.text-danger {
    color: #ff4757;
}

/* Responsive */
@media (max-width: 768px) {
    .dashboard-layout {
        display: block;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        padding: 1.5rem;
    }

    .main-content {
        margin-left: 0;
        padding: 1.5rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .nav-link {
        margin-bottom: 0.25rem;
    }

    /* Fix for Index/Register Pages */
    .container {
        padding: 1rem;
    }
}

/* Glass Card (Generic) */
.glass-card {
    /* Match glass-container style but looser layout */
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.05)) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.5) !important;
    border-left: 1px solid rgba(255, 255, 255, 0.3) !important;
    border-radius: 24px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3), inset 0 0 0 1px rgba(255, 255, 255, 0.1);
    padding: 2.5rem;
    position: relative;
    overflow: hidden;
    z-index: 10;
}

/* Glass Container for Index/Register (Public) */
.glass-container {
    /* True Glass Effect - Lighter & More Transparent */
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.05)) !important;

    /* Strong Blur for frosted feel */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);

    /* Crisp White Borders */
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.5) !important;
    /* Highlights */
    border-left: 1px solid rgba(255, 255, 255, 0.3) !important;

    border-radius: 24px;

    /* Soft Shadow & Inner Light */
    box-shadow:
        0 8px 32px 0 rgba(0, 0, 0, 0.3),
        inset 0 0 0 1px rgba(255, 255, 255, 0.1);

    padding: 3.5rem 3rem;
    width: 100%;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    z-index: 10;
}

/* Ambient Light Effect */
.glass-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    background: radial-gradient(circle at top left, rgba(255, 71, 87, 0.15), transparent 60%);
    pointer-events: none;
    z-index: 0;
}

/* Content needs to be above the glow */
.glass-container>* {
    position: relative;
    z-index: 1;
}

/* --- Index Page Specifics --- */
.index-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    /* Add padding to prevent edge touching */
}

.content-wrapper {
    display: flex;
    gap: 3rem;
    align-items: center;
    max-width: 1100px;
    width: 100%;
    flex-wrap: wrap;
    justify-content: center;
}

.poster-box {
    flex: 1 1 300px;
    max-width: 350px;
    display: flex;
    justify-content: center;
}

.poster-img {
    width: 100%;
    height: auto;
    border-radius: 1rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transform: rotate(-3deg);
    transition: transform 0.3s ease;
}

.index-title {
    margin-bottom: 0.5rem;
    font-size: 3.5rem;
    line-height: 1.2;
}

.index-subtitle {
    margin-bottom: 0.5rem;
    font-size: 2rem;
    color: var(--primary);
}

.glass-box-custom {
    flex: 2 1 400px;
    min-width: 300px;
    text-align: center;
}

/* Mobile Overrides */
@media (max-width: 768px) {
    .content-wrapper {
        flex-direction: column;
        gap: 1.5rem;
    }

    .poster-box {
        flex: auto;
        width: 100%;
        max-width: 320px;
        /* Smaller poster on mobile */
        margin-bottom: 1rem;
    }

    .poster-img {
        /* Keep rotation on mobile as requested */
        transform: rotate(-3deg);
        max-width: 90%;
        /* Limit width slightly on mobile to prevent overflow with rotation */
    }

    .glass-box-custom {
        flex: auto;
        width: 100%;
        min-width: unset;
        /* Remove min-width constraint */
        padding: 2rem 1.5rem !important;
    }

    .index-title {
        font-size: 2.5rem;
    }

    .index-subtitle {
        font-size: 1.5rem;
    }

    .glass-container {
        padding: 2rem 1.5rem !important;
    }
}