:root {
    --bg-color: #0F1B20;
    --surface-color: #18252B;
    --sidebar-color: #131f24;
    --sidebar-hover: #1D2C33;
    --border-color: #2A3A41;
    --primary-color: #66F3DF;
    --primary-hover: #8A5DFF;
    --primary-light: rgba(102, 243, 223, 0.15);
    --text-color: #E4ECEF;
    --text-muted: #9CAEB5;
    --success-color: #27D49A;
    --error-color: #EF5350;
}

body, button, select, input {
    font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    text-transform: lowercase;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    display: flex;
    min-height: 100vh;
}

/* Global in-content link readability on dark theme */
a {
    color: var(--primary-color);
    font-weight: 700;
    text-decoration-color: rgba(102, 243, 223, 0.85);
    text-underline-offset: 2px;
}
a:hover {
    color: var(--primary-hover);
    text-decoration-color: rgba(138, 93, 255, 0.9);
}
a:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    border-radius: 2px;
}

.sidebar {
    width: 250px;
    background-color: var(--sidebar-color);
    border-right: 1px solid var(--border-color);
    padding: 20px 0; box-sizing: border-box;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    height: 100vh;
    position: sticky;
    top: 0;
}
.sidebar-header {
    padding: 0 20px 20px 20px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}
.sidebar-header h1 {
    font-size: 1.8em;
    margin: 0;
    color: var(--primary-color);
    text-shadow: 0 0 10px rgba(102, 243, 223, 0.3);
    display: flex;
    align-items: baseline;
    gap: 0.25em;
}
.sidebar-header .brand-main {
    letter-spacing: 0.02em;
}
.sidebar-header .brand-tag {
    font-size: 0.6em;
    font-weight: 600;
}
.sidebar-header .brand-tag-insider {
    color: var(--error-color);
}
.sidebar-header .brand-tag-beta {
    color: #F4B400;
}
.sidebar-menu { flex-grow: 1; }
.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.95em;
    font-weight: 700;
    transition: all 0.2s ease;
}
.sidebar-menu a:hover { background-color: var(--sidebar-hover); color: var(--primary-color); }
.sidebar-menu a.active {
    background-color: var(--primary-light);
    color: var(--primary-color);
    border-left: 3px solid var(--primary-color);
    padding-left: 17px;
}
.sidebar-menu a svg { margin-right: 10px; width: 20px; height: 20px; }

.sidebar-footer { padding: 15px 20px; border-top: 1px solid var(--border-color); margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.sidebar-footer a { display: flex; align-items: center; color: var(--text-color); text-decoration: none; font-size: 0.95em; font-weight: 700; padding: 8px 0; transition: all 0.2s ease; }
.sidebar-footer a:hover { color: var(--primary-color); }
.sidebar-footer a svg { margin-right: 10px; width: 20px; height: 20px; }
.logout-link { color: var(--text-muted); }
.logout-link:hover { color: var(--primary-color); }

.sidebar-category {
    padding: 20px 20px 8px 20px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    pointer-events: none;
    margin-top: 5px;
}

.sidebar-scroll-area {
    flex-grow: 1;
    overflow-y: auto;
    padding-bottom: 20px;
}
.sidebar-scroll-area::-webkit-scrollbar { width: 4px; }
.sidebar-scroll-area::-webkit-scrollbar-thumb { background: #333; border-radius: 2px; }

.sidebar-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 15px 20px;
    opacity: 0.5;
}

.sidebar-footer-row {
    margin-top: auto;
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
    background-color: rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.footer-icon-btn {
    color: var(--text-muted);
    transition: color 0.2s;
    display: flex;
    align-items: center;
}
.footer-icon-btn:hover { color: var(--error-color); }
.footer-icon-btn svg { width: 24px; height: 24px; }

.footer-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #000;
}
.footer-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.avatar-placeholder {
    font-weight: bold;
    color: var(--primary-color);
    text-transform: uppercase;
}

.footer-status-badge {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    min-width: 30px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.footer-status-badge.vip {
    border-color: #FFD700;
    color: #FFD700;
    background-color: rgba(255, 215, 0, 0.1);
}
.footer-status-badge.paid {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background-color: rgba(102, 243, 223, 0.1);
}

.sidebar-user {
    padding: 10px 20px 8px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9em;
    margin-top: auto;
}
.sidebar-user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border-color);
    background-color: #000;
    flex-shrink: 0;
}
.sidebar-user-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.sidebar-user-line {
    display: flex;
    align-items: baseline;
    gap: 0.4em;
}
.sidebar-user-name {
    font-weight: 600;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-user-login {
    font-size: 0.72em;
    color: var(--text-muted);
}
.user-status-tag {
    font-size: 0.68em;
    font-weight: 600;
    text-transform: lowercase;
    letter-spacing: 0.04em;
}
.user-status-vip,
.user-status-supporter {
    color: #F4B400;
}
.user-status-free {
    color: var(--text-color);
    opacity: 0.9;
}

.main-content {
    flex-grow: 1;
    padding: 30px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.footer {
    margin-top: auto;
    background-color: var(--surface-color);
    border-top: 1px solid var(--border-color);
    padding: 16px 0 24px;
}

.footer-inner {
    max-width: 900px;
    margin: 0 auto;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.88rem;
}

.footer-brand {
    margin-bottom: 4px;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 18px;
}

.footer-links a {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: none;
}

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

.flashes { list-style-type: none; padding: 0; margin: 0 0 20px 0; }
.flashes li { padding: 12px; margin-bottom: 10px; border-radius: 6px; }
.flashes li.success { background-color: var(--success-color); color: #0F1B20; font-weight: 500;}
.flashes li.danger { background-color: var(--error-color); color: #fff; font-weight: 500;}
.flashes li.info { background-color: #42A5F5; color: #fff; font-weight: 500;}

/* Global toast positioning — overrides toast library defaults */
#toast-container,
.toast-container {
    position: fixed !important;
    top: 20px !important;
    right: 20px !important;
    left: auto !important;
    bottom: auto !important;
    z-index: 9999 !important;
}

.toast {
    font-size: 0.95rem !important;
    padding: 14px 20px !important;
    max-width: 380px !important;
}

.mobile-header { display: none; }
.mobile-overlay { display: none; }

@media (max-width: 768px) {
    body {
        flex-direction: column;
    }

    .mobile-header {
        display: flex;
        align-items: center;
        height: 60px;
        background-color: var(--sidebar-color);
        border-bottom: 1px solid var(--border-color);
        padding: 0 20px;
        position: sticky;
        top: 0;
        z-index: 1000;
        flex-shrink: 0;
    }

    .mobile-menu-btn {
        background: none;
        border: none;
        color: var(--text-color);
        cursor: pointer;
        padding: 5px;
        margin-right: 15px;
        display: flex;
        align-items: center;
    }
    .mobile-menu-btn svg { width: 28px; height: 28px; }

    .mobile-brand {
        font-size: 1.4em;
        font-weight: 700;
        color: var(--primary-color);
        letter-spacing: 0.02em;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 1002;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        transform: translateX(-100%);
        box-shadow: none;
        height: 100vh;
        width: 260px;
    }

    .sidebar.active {
        transform: translateX(0);
        box-shadow: 5px 0 15px rgba(0,0,0,0.5);
    }

    .mobile-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background-color: rgba(0,0,0,0.6);
        z-index: 1001;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
        backdrop-filter: blur(2px);
    }
    .mobile-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    .main-content {
        padding: 20px 15px;
        width: 100%;
        box-sizing: border-box;
    }

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