/* ShTABO — Unified Design System v2 */
/* Premium dark theme with animated accents */

/* ===== CSS Variables ===== */
:root {
    /* === Base Colors === */
    --bg-primary: #0f1117;
    --bg-secondary: #181b22;
    --bg-card: #1c1f28;
    --bg-card-hover: #242833;
    --bg-sidebar: #16181f;
    --bg-elevated: #282d38;

    /* === Blue Accent === */
    --accent-primary: #4a9eff;
    --accent-secondary: #7c69ef;
    --accent-light: #7dc8ff;
    --accent-glow: rgba(74, 158, 255, 0.35);
    --accent-muted: rgba(74, 158, 255, 0.1);

    /* === Gradient === */
    --gradient-brand: linear-gradient(135deg, #4a9eff, #7c69ef);
    --gradient-brand-hover: linear-gradient(135deg, #5cb8ff, #9580ff);
    --gradient-text: linear-gradient(135deg, #4a9eff 0%, #7c69ef 50%, #c084fc 100%);

    /* === Semantic Colors === */
    --color-success: #4ade80;
    --color-warning: #fbbf24;
    --color-error: #f87171;
    --color-info: var(--accent-primary);

    /* === Shadows === */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 30px var(--accent-glow);
    --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.03);

    /* === Borders === */
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-medium: rgba(255, 255, 255, 0.1);
    --border-accent: var(--accent-primary);

    /* === Text === */
    --text-primary: #f0f4f8;
    --text-secondary: #a0aec0;
    --text-muted: #64748b;

    /* === Animation === */
    --ease-default: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);
    --duration-fast: 150ms;
    --duration-normal: 300ms;
}

/* ===== Base Styles ===== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    overflow-x: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* ===== Animated Background ===== */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(ellipse 80% 60% at 50% -10%, rgba(74, 158, 255, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse 60% 40% at 80% 20%, rgba(124, 105, 239, 0.04) 0%, transparent 50%),
        radial-gradient(ellipse 60% 40% at 20% 80%, rgba(74, 158, 255, 0.03) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

/* Dot grid pattern */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: radial-gradient(circle, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 32px 32px;
    pointer-events: none;
    z-index: -1;
}

/* ===== Cards ===== */
.glass-card {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    box-shadow: var(--shadow-card);
    transition: all var(--duration-normal) var(--ease-default);
    overflow: hidden;
}

.glass-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 16px;
    padding: 1px;
    background: linear-gradient(135deg, rgba(74, 158, 255, 0), rgba(124, 105, 239, 0));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    transition: background var(--duration-normal) var(--ease-default);
}

.glass-card:hover {
    background: var(--bg-card-hover);
    border-color: transparent;
    box-shadow: var(--shadow-md), 0 0 0 1px rgba(74, 158, 255, 0.08);
    transform: translateY(-2px);
}

.glass-card:hover::before {
    background: linear-gradient(135deg, rgba(74, 158, 255, 0.3), rgba(124, 105, 239, 0.2));
}

.glass-card-solid {
    background: var(--bg-sidebar);
    border: none;
    border-right: 1px solid var(--border-subtle);
}

.glass-card-no-hover {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    box-shadow: var(--shadow-card);
}

/* ===== Typography ===== */
.gradient-text {
    background: var(--gradient-text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
}

/* ===== Animated Orb Background ===== */
.hero-glow {
    position: absolute;
    width: 800px;
    height: 800px;
    background: radial-gradient(circle, rgba(74, 158, 255, 0.12) 0%, transparent 60%);
    top: -200px;
    left: 50%;
    transform: translateX(-50%);
    z-index: -1;
    pointer-events: none;
    animation: heroGlowPulse 8s ease-in-out infinite;
}

@keyframes heroGlowPulse {
    0%, 100% { opacity: 1; transform: translateX(-50%) scale(1); }
    50% { opacity: 0.7; transform: translateX(-50%) scale(1.1); }
}

.orb-purple {
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(124, 105, 239, 0.1) 0%, transparent 60%);
    top: 200px;
    right: -100px;
    z-index: -1;
    pointer-events: none;
    animation: orbFloat 12s ease-in-out infinite;
}

@keyframes orbFloat {
    0%, 100% { transform: translate(0, 0); }
    33% { transform: translate(-30px, 20px); }
    66% { transform: translate(20px, -10px); }
}

/* ===== Input Fields ===== */
.input-field {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    padding: 12px 16px;
    color: var(--text-primary);
    font-size: 14px;
    transition: all var(--duration-fast) var(--ease-default);
    outline: none;
    width: 100%;
}

.input-field:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-muted), var(--shadow-glow);
    background: var(--bg-elevated);
}

.input-field::placeholder {
    color: var(--text-muted);
}

.input-field:hover:not(:focus) {
    border-color: var(--border-medium);
    background: var(--bg-elevated);
}

select.input-field {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23a0aec0' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
}

select.input-field option {
    background: var(--bg-card);
    color: var(--text-primary);
}

/* ===== Buttons ===== */
.btn-primary {
    background: var(--gradient-brand);
    color: white;
    font-weight: 600;
    padding: 12px 24px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: all var(--duration-normal) var(--ease-default);
    font-size: 14px;
    box-shadow: 0 2px 12px rgba(74, 158, 255, 0.25), 0 0 0 1px rgba(74, 158, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--gradient-brand-hover);
    opacity: 0;
    transition: opacity var(--duration-fast);
}

.btn-primary:hover {
    box-shadow: 0 6px 24px rgba(74, 158, 255, 0.35), 0 0 40px rgba(124, 105, 239, 0.15);
    transform: translateY(-3px);
}

.btn-primary:hover::before {
    opacity: 1;
}

.btn-primary:active {
    transform: translateY(-1px);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text-primary);
    font-weight: 500;
    padding: 10px 20px;
    border-radius: 10px;
    border: 1px solid var(--border-subtle);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-default);
    font-size: 14px;
}

.btn-secondary:hover {
    background: var(--accent-muted);
    border-color: var(--accent-primary);
    color: var(--accent-light);
}

.btn-icon {
    background: var(--bg-elevated);
    color: var(--text-secondary);
    padding: 10px;
    border-radius: 10px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-default);
}

.btn-icon:hover {
    background: var(--accent-muted);
    color: var(--accent-primary);
    border-color: var(--accent-primary);
}

.btn-link {
    background: none;
    border: none;
    color: var(--accent-primary);
    cursor: pointer;
    font-size: 14px;
    padding: 0;
    transition: color var(--duration-fast);
}

.btn-link:hover {
    color: var(--accent-light);
}

/* ===== Shadow Glow for CTA ===== */
.shadow-glow-strong {
    box-shadow: 0 4px 20px rgba(74, 158, 255, 0.3), 0 0 0 1px rgba(74, 158, 255, 0.1);
}

/* ===== Card Glow Shadow ===== */
.shadow-card-glow {
    box-shadow: var(--shadow-card);
}

/* ===== Sidebar ===== */
#sidebar {
    background: var(--bg-sidebar);
    border: none;
    border-right: 1px solid var(--border-subtle);
    border-radius: 0;
}

#main-content {
    border: none;
}

/* ===== Navigation ===== */
.nav-item {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    gap: 12px;
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-default);
    font-size: 14px;
    position: relative;
}

.nav-item:hover {
    background: var(--accent-muted);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--accent-muted);
    color: var(--accent-primary);
    border-left: 3px solid var(--accent-primary);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: -1px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--accent-primary);
    border-radius: 0 2px 2px 0;
    box-shadow: var(--shadow-glow);
}

.nav-item span {
    font-size: 14px;
    font-weight: 500;
}

/* ===== Data Tables ===== */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.data-table th {
    background: var(--bg-secondary);
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-subtle);
}

.data-table th:first-child {
    border-top-left-radius: 8px;
}

.data-table th:last-child {
    border-top-right-radius: 8px;
}

.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 14px;
    color: var(--text-secondary);
}

.data-table tbody tr {
    transition: background var(--duration-fast);
}

.data-table tbody tr:hover {
    background: var(--bg-card-hover);
}

.data-table tbody tr:hover td {
    color: var(--text-primary);
}

/* ===== Status Badges ===== */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    gap: 6px;
}

.status-online {
    background: rgba(74, 222, 128, 0.12);
    color: var(--color-success);
}

.status-offline {
    background: rgba(113, 128, 150, 0.12);
    color: var(--text-muted);
}

.status-idle {
    background: rgba(251, 191, 36, 0.12);
    color: var(--color-warning);
}

.status-dnd {
    background: rgba(248, 113, 113, 0.12);
    color: var(--color-error);
}

.online-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-success);
    box-shadow: 0 0 8px var(--color-success);
}

/* ===== Cards Grid ===== */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

/* ===== User Cards ===== */
.user-card {
    padding: 20px;
    text-align: center;
    cursor: pointer;
}

.user-card img {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 2px solid var(--border-medium);
    margin-bottom: 14px;
    object-fit: cover;
    transition: all var(--duration-fast);
}

.user-card:hover img {
    border-color: var(--accent-primary);
    box-shadow: 0 0 16px var(--accent-glow);
}

.user-card h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
}

.user-card p {
    font-size: 13px;
    color: var(--text-muted);
}

.user-card .status-badge {
    margin-top: 10px;
}

/* ===== Session Cards ===== */
.session-card-premium {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    box-shadow: var(--shadow-card);
    transition: all var(--duration-normal) var(--ease-default);
}

.session-card-premium:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-md), 0 0 16px var(--accent-glow);
}

.session-card-premium:hover img {
    border-color: var(--accent-primary);
}

/* ===== Stats Cards ===== */
.stat-card {
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 80px;
    height: 80px;
    background: radial-gradient(circle, var(--accent-muted) 0%, transparent 70%);
    border-radius: 50%;
    transform: translate(30%, -30%);
}

.stat-card .stat-icon {
    font-size: 28px;
    margin-bottom: 10px;
    color: var(--accent-primary);
}

.stat-card .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-card .stat-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ===== Loading Spinner ===== */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-medium);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.skeleton {
    background: linear-gradient(90deg,
            var(--bg-secondary) 25%,
            var(--bg-elevated) 50%,
            var(--bg-secondary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 6px;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.skeleton-text {
    height: 14px;
    margin-bottom: 8px;
}

.skeleton-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
}

.skeleton-card {
    height: 140px;
}

/* ===== Toast Notifications ===== */
.toast {
    padding: 14px 20px;
    border-radius: 12px;
    font-size: 14px;
    animation: toastSlideIn 0.3s var(--ease-default);
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 280px;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(12px);
}

.toast-success {
    background: rgba(74, 222, 128, 0.9);
    color: #1a2e1a;
}

.toast-error {
    background: rgba(248, 113, 113, 0.9);
    color: white;
}

.toast-warning {
    background: rgba(251, 191, 36, 0.9);
    color: #1a1a0a;
}

.toast-info {
    background: rgba(74, 158, 255, 0.9);
    color: white;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }

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

/* ===== Tabs ===== */
.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 0;
    margin-bottom: 24px;
    overflow-x: auto;
}

.tab {
    padding: 12px 18px;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--duration-fast);
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

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

.tab.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
}

/* ===== Pagination ===== */
.pagination {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    margin-top: 20px;
}

.pagination button {
    padding: 8px 12px;
    border-radius: 8px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--duration-fast);
    font-size: 14px;
}

.pagination button:hover:not(:disabled) {
    background: var(--accent-muted);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.pagination button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.pagination button.active {
    background: var(--accent-primary);
    border-color: transparent;
    color: white;
    box-shadow: 0 2px 8px var(--accent-glow);
}

/* ===== Empty State ===== */
.empty-state {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 24px;
    background: var(--bg-secondary);
    border: 1px dashed var(--border-medium);
    border-radius: 16px;
    text-align: left;
}

.empty-state-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    background: var(--accent-muted);
    border-radius: 50%;
    color: var(--accent-primary);
    flex-shrink: 0;
}

.empty-state-icon .icon {
    width: 28px;
    height: 28px;
    stroke-width: 1.5;
}

.empty-state-content h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.empty-state-content p {
    font-size: 14px;
    color: var(--text-muted);
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-elevated);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-muted);
}

/* ===== Auth Container ===== */
#auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

#auth-container.hidden {
    display: none !important;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    padding: 36px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
}

.auth-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 28px;
    background: var(--bg-secondary);
    border-radius: 10px;
    padding: 4px;
}

.auth-tab {
    flex: 1;
    padding: 10px;
    text-align: center;
    cursor: pointer;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--duration-fast);
}

.auth-tab.active {
    background: var(--gradient-brand);
    color: white;
    box-shadow: 0 2px 8px var(--accent-glow);
}

.auth-tab:hover:not(.active) {
    color: var(--text-primary);
}

/* Password Strength */
.password-strength {
    height: 3px;
    border-radius: 2px;
    background: var(--bg-secondary);
    margin-top: 8px;
    overflow: hidden;
}

.password-strength-bar {
    height: 100%;
    border-radius: 2px;
    transition: all var(--duration-fast);
}

.password-strength-bar.weak {
    width: 33%;
    background: var(--color-error);
}

.password-strength-bar.medium {
    width: 66%;
    background: var(--color-warning);
}

.password-strength-bar.strong {
    width: 100%;
    background: var(--color-success);
}

/* Form Groups */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-error {
    color: var(--color-error);
    font-size: 12px;
    margin-top: 6px;
}

/* ===== Landing Page Specific ===== */

/* Animated fade-in-up */
.animate-fade-in-up {
    animation: fadeInUp 0.8s var(--ease-default) both;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Stagger delays */
.stagger-1 { animation-delay: 0.1s; }
.stagger-2 { animation-delay: 0.2s; }
.stagger-3 { animation-delay: 0.3s; }
.stagger-4 { animation-delay: 0.4s; }
.stagger-5 { animation-delay: 0.5s; }

/* Feature card hover glow */
.feature-glow-blue:hover {
    box-shadow: var(--shadow-md), 0 0 30px rgba(74, 158, 255, 0.08);
}

.feature-glow-purple:hover {
    box-shadow: var(--shadow-md), 0 0 30px rgba(124, 105, 239, 0.08);
}

.feature-glow-green:hover {
    box-shadow: var(--shadow-md), 0 0 30px rgba(74, 222, 128, 0.08);
}

.feature-glow-pink:hover {
    box-shadow: var(--shadow-md), 0 0 30px rgba(244, 114, 182, 0.08);
}

.feature-glow-red:hover {
    box-shadow: var(--shadow-md), 0 0 30px rgba(248, 113, 113, 0.08);
}

/* Gradient border top for feature cards */
.gradient-border-top {
    position: relative;
}

.gradient-border-top::after {
    content: '';
    position: absolute;
    top: 0;
    left: 20%;
    right: 20%;
    height: 2px;
    background: var(--gradient-brand);
    border-radius: 0 0 2px 2px;
    opacity: 0;
    transition: all var(--duration-normal) var(--ease-default);
}

.gradient-border-top:hover::after {
    opacity: 1;
    left: 0;
    right: 0;
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    #sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s var(--ease-default);
        position: fixed;
        z-index: 100;
    }

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

    #main-content {
        margin-left: 0 !important;
        padding: 16px !important;
    }

    #mobile-menu-btn {
        display: flex !important;
    }
}

@media (max-width: 640px) {
    .cards-grid {
        grid-template-columns: 1fr;
    }

    .stat-card .stat-value {
        font-size: 24px;
    }

    .auth-card {
        padding: 24px;
    }
}

/* ===== Utilities ===== */
.fade-in {
    animation: fadeIn 0.3s var(--ease-default);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.slide-up {
    animation: slideUp 0.3s var(--ease-default);
}

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

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

/* ===== Code/JSON Display ===== */
.code-block {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    padding: 16px;
    font-family: 'Fira Code', 'Monaco', 'Consolas', monospace;
    font-size: 13px;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 400px;
    overflow-y: auto;
}

/* ===== Charts Container ===== */
.chart-container {
    position: relative;
    height: 280px;
    padding: 16px;
}

/* ===== Progress Bar ===== */
.progress-bar {
    height: 6px;
    background: var(--bg-secondary);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--gradient-brand);
    border-radius: 3px;
    transition: width 0.4s var(--ease-default);
}

/* ===== Leaderboard ===== */
.leaderboard-item {
    display: flex;
    align-items: center;
    padding: 14px;
    border-radius: 10px;
    margin-bottom: 10px;
    background: var(--bg-secondary);
    transition: background var(--duration-fast);
}

.leaderboard-item:hover {
    background: var(--bg-elevated);
}

.leaderboard-rank {
    font-size: 16px;
    font-weight: 700;
    width: 36px;
    text-align: center;
    color: var(--accent-primary);
}

.leaderboard-rank.gold {
    color: #fbbf24;
}

.leaderboard-rank.silver {
    color: #94a3b8;
}

.leaderboard-rank.bronze {
    color: #d97706;
}

/* ===== Section Header ===== */
.section-header {
    margin-bottom: 20px;
}

.section-header h2 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px;
}

.section-header p {
    color: var(--text-muted);
    font-size: 14px;
}

/* ===== Quick Stats Grid ===== */
.quick-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 28px;
}

/* ===== File Cards ===== */
.file-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px;
    cursor: pointer;
}

.file-card:hover {
    border-color: var(--accent-primary);
}

.file-icon {
    font-size: 28px;
}

.file-info h4 {
    font-weight: 600;
    margin-bottom: 4px;
}

.file-info p {
    font-size: 12px;
    color: var(--text-muted);
}

/* ===== Icons ===== */
.icon {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
    flex-shrink: 0;
}

.icon-sm {
    width: 16px;
    height: 16px;
}

.icon-lg {
    width: 24px;
    height: 24px;
}

.icon-xl {
    width: 32px;
    height: 32px;
}

/* ===== Custom Dropdown ===== */
.custom-dropdown {
    position: relative;
    width: 100%;
}

.custom-dropdown-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    padding: 10px 14px;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    transition: all var(--duration-fast);
    width: 100%;
}

.custom-dropdown-toggle:hover {
    border-color: var(--accent-primary);
}

.custom-dropdown-toggle .icon {
    transition: transform var(--duration-fast);
}

.custom-dropdown.open .custom-dropdown-toggle .icon {
    transform: rotate(180deg);
}

.custom-dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-medium);
    border-radius: 10px;
    padding: 6px;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all var(--duration-fast) var(--ease-default);
    max-height: 220px;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.custom-dropdown.open .custom-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.custom-dropdown-menu.drop-up {
    top: auto;
    bottom: calc(100% + 6px);
}

.custom-dropdown-item {
    padding: 10px 14px;
    border-radius: 6px;
    cursor: pointer;
    transition: all var(--duration-fast);
    color: var(--text-secondary);
    font-size: 14px;
}

.custom-dropdown-item:hover {
    background: var(--accent-muted);
    color: var(--text-primary);
}

.custom-dropdown-item.active {
    background: var(--accent-primary);
    color: white;
}

/* ===== Responsive Layout ===== */
@media (max-width: 1024px) {
    #sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 50;
    }

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

    #main-content {
        margin-left: 0;
        padding: 14px;
        padding-top: 64px;
    }

    #mobile-menu-btn {
        display: flex !important;
    }

    #mobile-overlay.active {
        display: block !important;
    }

    .cards-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 14px;
    }
}

@media (max-width: 640px) {
    #main-content {
        padding: 12px;
        padding-top: 64px;
    }

    .cards-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .quick-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .stat-card {
        padding: 14px;
    }

    .stat-card .stat-value {
        font-size: 22px;
    }

    .stat-card .stat-label {
        font-size: 12px;
    }

    .glass-card {
        padding: 14px;
    }

    .tabs {
        gap: 2px;
    }

    .tab {
        padding: 10px 14px;
        font-size: 13px;
    }

    .user-card {
        padding: 14px;
    }

    .user-card img {
        width: 56px;
        height: 56px;
    }

    .pagination {
        flex-wrap: wrap;
    }

    .pagination button {
        padding: 6px 10px;
        font-size: 13px;
    }
}

/* Section Header with Actions */
.section-header-flex {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
}

.section-header-info {
    flex: 1;
    min-width: 180px;
}

.section-header-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.section-header-actions select,
.section-header-actions .custom-dropdown {
    min-width: 140px;
}

/* Mobile menu button */
#mobile-menu-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    bottom: 20px !important;
    left: 20px !important;
    top: auto !important;
    box-shadow: var(--shadow-md);
}

#mobile-menu-btn:hover {
    border-color: var(--accent-primary);
}

.nav-item span {
    white-space: nowrap;
}

/* Toggle Switch */
.toggle-switch-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-secondary);
    transition: 0.2s;
    border-radius: 22px;
    border: 1px solid var(--border-subtle);
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: var(--text-primary);
    transition: 0.2s;
    border-radius: 50%;
}

input:checked+.toggle-slider {
    background-color: var(--accent-primary);
    border-color: var(--accent-primary);
}

input:checked+.toggle-slider:before {
    transform: translateX(18px);
}

.toggle-label-text {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Search Input with Icon */
.search-container {
    position: relative;
    width: 100%;
    max-width: 360px;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    width: 18px;
    height: 18px;
    pointer-events: none;
}

.search-input {
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    padding: 10px 12px 10px 38px;
    color: var(--text-primary);
    font-size: 14px;
    transition: all var(--duration-fast);
}

.search-input:focus {
    background: var(--bg-elevated);
    border-color: var(--accent-primary);
    outline: none;
    box-shadow: 0 0 0 3px var(--accent-muted);
}

/* Data Tables Advanced */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table thead tr {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-subtle);
}

.data-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.data-table th.sortable {
    cursor: pointer;
    user-select: none;
    transition: background var(--duration-fast);
}

.data-table th.sortable:hover {
    background: var(--bg-elevated);
}

.data-table th .sort-icon {
    margin-left: 6px;
    color: var(--text-muted);
    font-size: 12px;
}

.data-table th.asc .sort-icon,
.data-table th.desc .sort-icon {
    color: var(--accent-primary);
}

.data-table td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

.data-table tbody tr {
    transition: background var(--duration-fast);
}

.data-table tbody tr:hover {
    background: var(--bg-card-hover);
}

.data-table tbody tr:nth-child(even) {
    background: var(--bg-secondary);
}

.data-table tbody tr:nth-child(even):hover {
    background: var(--bg-card-hover);
}

/* Status colors in tables */
.data-table td.status-online {
    color: var(--color-success);
    font-weight: 600;
}

.data-table td.status-offline {
    color: var(--text-muted);
}

.data-table td.status-idle {
    color: var(--color-warning);
}

.data-table td.status-dnd {
    color: var(--color-error);
}

/* Table wrapper */
.data-table-wrapper {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 16px;
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-card);
}

.data-table-wrapper.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    background: var(--bg-primary);
    border-radius: 0;
    padding: 24px;
    overflow: auto;
}

.data-table-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.data-table-actions {
    display: flex;
    gap: 8px;
}

.data-table-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 14px;
    flex-wrap: wrap;
    gap: 10px;
}

/* Mini pagination */
.pagination-mini {
    display: flex;
    gap: 4px;
    align-items: center;
}

.pagination-mini button {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    padding: 4px 10px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
    transition: all var(--duration-fast);
}

.pagination-mini button:hover:not(:disabled) {
    background: var(--accent-muted);
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

.pagination-mini button.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.pagination-mini button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination-mini span {
    color: var(--text-muted);
    padding: 0 4px;
}

.overflow-x-auto {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ===== Staggered Entry Animation ===== */
.stagger-enter {
    opacity: 0;
    transform: translateY(12px);
    animation: staggerFadeIn 0.4s var(--ease-default) forwards;
}

.stagger-enter:nth-child(1) {
    animation-delay: 0ms;
}

.stagger-enter:nth-child(2) {
    animation-delay: 40ms;
}

.stagger-enter:nth-child(3) {
    animation-delay: 80ms;
}

.stagger-enter:nth-child(4) {
    animation-delay: 120ms;
}

.stagger-enter:nth-child(5) {
    animation-delay: 160ms;
}

.stagger-enter:nth-child(6) {
    animation-delay: 200ms;
}

.stagger-enter:nth-child(n+7) {
    animation-delay: 240ms;
}

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

/* ===== Focus Styles for Accessibility ===== */
.focus-ring:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--bg-primary), 0 0 0 4px var(--accent-primary);
}

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}