:root {
    --bg-color: #0b0c10;
    --card-bg: rgba(31, 31, 38, 0.6);
    --card-border: rgba(255, 255, 255, 0.08);
    --primary: #4e54c8;
    --primary-hover: #3f45a7;
    --secondary: #8f94fb;
    --text-main: #f8f9fa;
    --text-muted: #a0a0b0;
    --accent: #ff477e;
    --success: #00f2fe;
    --warning: #ffb703;
    --danger: #ef233c;
    --glass-blur: blur(16px);
}

/* Theme: Light */
body.theme-light {
    --bg-color: #f0f2f5;
    --card-bg: rgba(255, 255, 255, 0.8);
    --card-border: rgba(0, 0, 0, 0.1);
    --primary: #4e54c8;
    --secondary: #6c63ff;
    --text-main: #1f1f26;
    --text-muted: #666677;
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(78, 84, 200, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 85% 30%, rgba(143, 148, 251, 0.05) 0%, transparent 50%);
}
body.theme-light .glass-card { box-shadow: 0 8px 32px rgba(0, 0, 0, 0.05); }
body.theme-light .sidebar { background: rgba(255, 255, 255, 0.7); }
body.theme-light .top-header { background: rgba(255, 255, 255, 0.5); }
body.theme-light .nav-item:hover, body.theme-light .nav-item.active { background: rgba(0, 0, 0, 0.05); }

/* Theme: Elegant (Restored Purple) */
body.theme-elegant {
    --bg-color: #1a0b2e;
    --card-bg: rgba(45, 20, 75, 0.6);
    --card-border: rgba(255, 255, 255, 0.1);
    --primary: #9d50bb;
    --secondary: #6e48aa;
    --text-main: #ffffff;
    --text-muted: #d8b4e2;
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(157, 80, 187, 0.2) 0%, transparent 50%),
        radial-gradient(circle at 85% 30%, rgba(110, 72, 170, 0.2) 0%, transparent 50%);
}
body.theme-elegant .sidebar-header h2, 
body.theme-elegant .login-header h2 {
    background: linear-gradient(135deg, #9d50bb, #6e48aa);
    -webkit-background-clip: text;
    background-clip: text;
}
/* Theme: Classic (Brown & Cream) */
body.theme-classic {
    --bg-color: #f5f5dc; /* Cream */
    --card-bg: #fffbf0;
    --card-border: #d7ccc8;
    --primary: #5d4037; /* Brown */
    --secondary: #8d6e63;
    --text-main: #3e2723;
    --text-muted: #795548;
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(93, 64, 55, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 85% 30%, rgba(141, 110, 99, 0.05) 0%, transparent 50%);
}
body.theme-classic .sidebar { background: #efebe9; border-right: 1px solid #d7ccc8; }
body.theme-classic .top-header { background: #fdfaf5; border-bottom: 1px solid #d7ccc8; }
body.theme-classic .glass-card,
body.theme-classic .nav-item,
body.theme-classic .nav-item-sub,
body.theme-classic .btn,
body.theme-classic .form-group input,
body.theme-classic .form-group select,
body.theme-classic .avatar,
body.theme-classic .card-qr-box {
    border-radius: 40px !important;
}
body.theme-classic .sidebar-header h2 { color: #5d4037; }
body.theme-classic .nav-item.active { background: #d7ccc8; color: #3e2723; border-left: none; }
body.theme-classic .nav-item:hover { background: #efebe9; }
body.theme-classic .btn-primary { background: #5d4037; color: #fff; border: none; box-shadow: 0 4px 10px rgba(93, 64, 55, 0.2); }
body.theme-windows {
    --bg-color: #0078d4;
    --card-bg: rgba(255, 255, 255, 0.9);
    --card-border: rgba(255, 255, 255, 0.3);
    --primary: #0078d4;
    --secondary: #2b88d8;
    --text-main: #201f1e;
    --text-muted: #605e5c;
    background-image: url('https://w.wallhaven.cc/full/m9/wallhaven-m9m6m8.jpg'); /* Generic Windows 11 style placeholder or just color */
    background-size: cover;
}
body.theme-windows .sidebar { background: rgba(243, 243, 243, 0.85); backdrop-filter: blur(20px); }
body.theme-windows .top-header { background: rgba(255, 255, 255, 0.8); }
body.theme-windows .glass-card { border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); }

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-color);
    background-image:
        radial-gradient(circle at 15% 50%, rgba(78, 84, 200, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 85% 30%, rgba(143, 148, 251, 0.15) 0%, transparent 50%);
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

/* Typography */
h1,
h2,
h3,
h4 {
    color: var(--text-main);
    font-weight: 600;
    margin-bottom: 1rem;
}

p {
    color: var(--text-muted);
    line-height: 1.6;
}

a {
    color: var(--secondary);
    text-decoration: none;
    transition: 0.3s;
}

a:hover {
    color: var(--primary);
}

/* Glass Card Base */
.glass-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* Auth Section */
.auth-section {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    /* Modified to allow scrolling from top */
    background: rgba(11, 12, 16, 0.85);
    z-index: 10000;
    transition: opacity 0.5s ease, visibility 0.5s ease;
    overflow-y: auto;
    padding: 2rem 1rem;
}

.auth-section>div {
    margin-top: auto;
    margin-bottom: auto;
}

.auth-section.hidden {
    opacity: 0;
    visibility: hidden;
}

.login-card {
    width: 100%;
    max-width: 400px;
    text-align: center;
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.login-header h2 {
    font-size: 2rem;
    background: linear-gradient(135deg, var(--secondary), var(--primary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.login-body {
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: center;
}

.divider {
    width: 100%;
    position: relative;
    border-top: 1px solid var(--card-border);
    margin: 1.5rem 0;
}

.divider span {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-color);
    padding: 0 10px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* App Container */
.app-container {
    display: flex;
    width: 100%;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 300px;
    min-width: 300px;
    flex-shrink: 0;
    background: rgba(15, 15, 20, 0.7);
    border-right: 1px solid var(--card-border);
    backdrop-filter: var(--glass-blur);
    display: flex;
    flex-direction: column;
    padding: 2rem 1.5rem;
    transition: transform 0.3s ease;
    z-index: 2000;
}

.sidebar-header {
    margin-bottom: 2.5rem;
}

.sidebar-header h2 {
    font-size: 1.8rem;
    margin-bottom: 0.2rem;
    background: linear-gradient(135deg, var(--secondary), var(--primary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
}

.sidebar-header p {
    font-size: 0.85rem;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex-grow: 1;
    overflow-y: auto;
    overflow-x: hidden;
    margin-right: -0.5rem;
    padding-right: 0.5rem;
}

/* Scrollbar khusus Sidebar */
.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-radius: 12px;
    color: var(--text-muted);
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.nav-item i {
    width: 20px;
    font-size: 1.1rem;
}

.nav-item:hover,
.nav-item.active {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(78, 84, 200, 0.2), transparent);
    border-left: 3px solid var(--secondary);
}

/* Submenu */
.nav-group {
    position: relative;
}

.nav-submenu {
    display: none;
    flex-direction: column;
    padding-left: 0.5rem;
    border-left: 2px solid rgba(255, 255, 255, 0.05);
    margin-left: 1.5rem;
    margin-top: 0.5rem;
    gap: 0.3rem;
}

.nav-group.expanded .nav-submenu {
    display: flex;
    animation: slideUp 0.3s ease;
}

.nav-group.expanded .nav-item .fa-chevron-down {
    transform: rotate(180deg);
}

.nav-item .fa-chevron-down {
    transition: transform 0.3s ease;
}

.nav-item-sub {
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: 0.6rem 1rem;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    transition: all 0.2s ease;
    white-space: nowrap;
    text-decoration: none;
}

.nav-item-sub i {
    width: 16px;
    font-size: 0.95rem;
}

.nav-item-sub:hover,
.nav-item-sub.active {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.nav-item-sub.active {
    color: var(--secondary);
    border-left: 2px solid var(--secondary);
}

.sidebar-footer {
    margin-top: auto;
    border-top: 1px solid var(--card-border);
    padding-top: 1rem;
}

.text-danger:hover {
    color: var(--danger) !important;
    background: rgba(239, 35, 60, 0.1);
}

/* Main Content */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
.top-header {
    height: 80px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2.5rem;
    background: rgba(11, 12, 16, 0.5);
    border-bottom: 1px solid var(--card-border);
    backdrop-filter: var(--glass-blur);
    position: relative;
    z-index: 1000;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.header-left h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 500;
}

.mobile-only {
    display: none;
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 1.5rem;
    cursor: pointer;
}

.header-right .user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.5rem 1rem;
    border-radius: 30px;
    border: 1px solid var(--card-border);
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

/* Sections */
.sections-container {
    flex-grow: 1;
    padding: 2.5rem;
    overflow-y: auto;
    position: relative;
}

.app-section {
    display: none;
    animation: fadeIn 0.4s ease;
}

.app-section.active-section {
    display: block;
}

/* Forms */
.dynamic-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.form-row {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group.full {
    width: 100%;
}

.form-group.half {
    width: calc(50% - 0.75rem);
}

.form-group.third {
    width: calc(33.333% - 1rem);
}

.form-group.quarter {
    width: calc(25% - 1.125rem);
}

.form-group label {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

.form-group input,
.form-group select {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--card-border);
    color: var(--text-main);
    padding: 0.8rem 1rem;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
    outline: none;
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(143, 148, 251, 0.2);
    background: rgba(0, 0, 0, 0.4);
}

.form-group select option {
    background: var(--bg-color);
}

.help-link {
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

/* Buttons */
.btn {
    padding: 0.8rem 1.5rem;
    border-radius: 10px;
    border: none;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: 0 4px 15px rgba(78, 84, 200, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(78, 84, 200, 0.6);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    border: 1px solid var(--card-border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-sm {
    padding: 0.4rem 1.2rem;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 20px;
}

.btn-ai {
    background: linear-gradient(135deg, #8a2387, #e94057, #f27121);
    color: white;
    width: 100%;
    font-size: 1.1rem;
    padding: 1rem;
    border-radius: 15px;
}

.btn-ai:hover {
    transform: scale(1.02);
}

/* Table */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.premium-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.premium-table th,
.premium-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--card-border);
}

.premium-table th {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.premium-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* Tabs for Link & Match */
.tabs-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 1.5rem;
    height: 100%;
}

.tab-buttons {
    display: flex;
    gap: 1rem;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 0.5rem;
}

.tab-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    cursor: pointer;
    position: relative;
    transition: color 0.3s;
}

.tab-btn:hover {
    color: var(--text-main);
}

.tab-btn.active {
    color: var(--secondary);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -0.5rem;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--secondary);
    border-radius: 2px 2px 0 0;
}

.tab-content {
    display: none;
    animation: fadeIn 0.4s ease;
}

.tab-content.active {
    display: block;
}

.ai-prompt-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.ai-result-box {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--card-border);
    border-radius: 15px;
    padding: 1.5rem;
    min-height: 200px;
    color: var(--text-main);
    line-height: 1.7;
    font-size: 1rem;
}

.ai-result-box .placeholder-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    text-align: center;
    gap: 1rem;
    min-height: 150px;
}

.ai-result-box .placeholder-text i {
    font-size: 3rem;
    opacity: 0.5;
}

/* Membership Card & Status */
.membership-card-container {
    max-width: 600px;
    margin: 0 auto;
}

.membership-card {
    background: linear-gradient(135deg, #d4af37 0%, #f7e089 45%, #b8860b 80%, #f7e089 100%);
    border: 1px solid rgba(255, 255, 255, 0.4);
    padding: 2.2rem;
    position: relative;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 15px 35px rgba(184, 134, 11, 0.3);
    color: #3d2b1f;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.membership-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.1) 0%, transparent 70%);
    z-index: 0;
}

.card-header-region {
    display: flex;
    align-items: center;
    margin-bottom: 2rem;
    position: relative;
    z-index: 1;
}

.card-logo-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--secondary);
}

.card-body-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    position: relative;
    z-index: 1;
}

.card-main-info h2 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    color: #2a1b0a;
    text-shadow: none;
    font-weight: 700;
}

.membership-card .card-main-info p,
.membership-card .join-date-label,
.membership-card .join-date-label span {
    color: #4b3621 !important;
    /* Bronze/Dark brown for secondary info */
    opacity: 0.9;
}

.membership-card .card-logo-info {
    color: #2a1b0a;
}

.card-qr-box {
    background: white;
    padding: 0.3rem;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    z-index: 10;
    width: 95px;
    height: 95px;
}

.card-qr-box img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.card-qr-desktop {
    position: absolute;
    top: 2.2rem;
    right: 2.2rem;
    display: block;
}

.card-qr-mobile {
    display: none;
}

@media (max-width: 768px) {
    .membership-card {
        aspect-ratio: 9 / 16;
        padding: 1.5rem;
        max-width: 350px;
        margin: 0 auto;
    }

    .card-header-region {
        margin-bottom: 1rem;
        justify-content: center;
    }

    .card-body-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 1.5rem;
        height: 100%;
        justify-content: center;
    }

    .card-main-info {
        order: 2 !important;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .card-avatar-box {
        order: 1 !important;
        width: 120px;
        height: 120px;
        margin-bottom: 0;
    }

    .card-qr-desktop {
        display: none !important;
    }

    .card-qr-mobile {
        display: block !important;
        position: relative;
        width: 80px;
        height: 80px;
        margin: 1rem auto 0;
    }

    .membership-card .card-main-info h2 {
        font-size: 1.4rem;
    }

    .membership-card .card-main-info p {
        font-size: 0.8rem;
    }

    .membership-status-bar {
        margin-bottom: 10px;
    }
}

.membership-card .card-logo-info i {
    color: #2a1b0a !important;
}

.join-date-label {
    font-size: 0.9rem;
    color: #4b3621 !important;
    text-align: left;
    display: block;
}

.card-avatar-box {
    width: 130px;
    height: 130px;
    border-radius: 15px;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
    margin-bottom: 0;
}

.member-card-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.membership-status-bar {
    padding: 1.2rem 2rem;
}

.status-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.status-summary {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.status-label {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.badge {
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.badge-success {
    background: rgba(0, 255, 127, 0.1);
    color: #00ff7f;
    border: 1px solid rgba(0, 255, 127, 0.3);
}

.badge-warning {
    background: rgba(255, 183, 3, 0.1);
    color: var(--warning);
    border: 1px solid rgba(255, 183, 3, 0.3);
}

.alert {
    padding: 1rem;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.alert-warning {
    background: rgba(255, 183, 3, 0.1);
    border: 1px solid rgba(255, 183, 3, 0.3);
    color: var(--warning);
}

/* Utilities & Animations */
.flex-col {
    display: flex;
    flex-direction: column;
}

.h-full {
    height: 100%;
}

.flex-grow {
    flex-grow: 1;
}

.mt-3 {
    margin-top: 1.5rem;
}

.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-muted) !important;
}

.hidden {
    display: none !important;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 1024px) {

    .form-group.quarter,
    .form-group.third,
    .form-group.half {
        width: calc(50% - 0.75rem);
    }
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        transform: translateX(-100%);
        z-index: 2000;
        height: 100dvh;
        padding-bottom: 3rem;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .mobile-only {
        display: block;
    }

    .top-header {
        padding: 0 1.5rem;
    }

    .sections-container {
        padding: 1.5rem;
    }

    .form-group.quarter,
    .form-group.third,
    .form-group.half {
        width: 100%;
    }

    .tab-buttons {
        overflow-x: auto;
        white-space: nowrap;
    }
}