/* ============================================
   KeyTrack Pro - Premium Keyword Tracker
   Aesthetic: Dark luxe dashboard with glass morphism
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* === CSS Custom Properties === */
:root {
    --font-primary: 'Plus Jakarta Sans', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* Dark palette */
    --bg-deep: #0a0b0f;
    --bg-primary: #0f1117;
    --bg-secondary: #161821;
    --bg-card: #1a1c27;
    --bg-card-hover: #1f2130;
    --bg-elevated: #22243a;
    --bg-input: #13141d;

    /* Glass */
    --glass-bg: rgba(26, 28, 39, 0.65);
    --glass-border: rgba(255, 255, 255, 0.06);
    --glass-highlight: rgba(255, 255, 255, 0.03);

    /* Accent colors */
    --accent-primary: #6c63ff;
    --accent-primary-soft: rgba(108, 99, 255, 0.15);
    --accent-secondary: #00d4aa;
    --accent-secondary-soft: rgba(0, 212, 170, 0.12);
    --accent-warm: #ff6b6b;
    --accent-warm-soft: rgba(255, 107, 107, 0.12);
    --accent-amber: #ffb347;
    --accent-amber-soft: rgba(255, 179, 71, 0.12);
    --accent-cyan: #36d7f2;
    --accent-gradient: linear-gradient(135deg, #6c63ff 0%, #36d7f2 50%, #00d4aa 100%);

    /* Text */
    --text-primary: #e8eaf0;
    --text-secondary: #8b8fa3;
    --text-muted: #555770;
    --text-accent: #6c63ff;

    /* Status */
    --color-success: #00d4aa;
    --color-danger: #ff6b6b;
    --color-warning: #ffb347;
    --color-info: #36d7f2;

    /* Borders & Shadows */
    --border-subtle: 1px solid rgba(255, 255, 255, 0.05);
    --border-accent: 1px solid rgba(108, 99, 255, 0.3);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.2);
    --shadow-md: 0 4px 24px rgba(0,0,0,0.3);
    --shadow-lg: 0 12px 48px rgba(0,0,0,0.4);
    --shadow-glow: 0 0 30px rgba(108, 99, 255, 0.1);

    /* Spacing */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --sidebar-width: 270px;
}

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

html {
    font-size: 15px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-primary);
    background: var(--bg-deep);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* Animated gradient background */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background:
        radial-gradient(ellipse at 20% 20%, rgba(108, 99, 255, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(0, 212, 170, 0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(54, 215, 242, 0.03) 0%, transparent 70%);
    z-index: -1;
    animation: bgShift 30s ease-in-out infinite alternate;
}

@keyframes bgShift {
    0% { transform: translate(0, 0) rotate(0deg); }
    100% { transform: translate(-5%, -5%) rotate(3deg); }
}

a { color: var(--accent-primary); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--accent-cyan); }

img { max-width: 100%; }

/* === Layout === */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* === Sidebar === */
.sidebar {
    width: var(--sidebar-width);
    background: var(--glass-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-right: var(--border-subtle);
    padding: 0;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-brand {
    padding: 24px 24px 20px;
    border-bottom: var(--border-subtle);
}

.sidebar-brand h1 {
    font-size: 1.35rem;
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.sidebar-brand .version {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-top: 2px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 24px;
}

.nav-section-title {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding: 0 12px;
    margin-bottom: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.88rem;
    font-weight: 500;
    transition: all 0.2s;
    cursor: pointer;
    position: relative;
    margin-bottom: 2px;
}

.nav-item:hover {
    background: rgba(255,255,255,0.04);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--accent-primary-soft);
    color: var(--accent-primary);
}

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

.nav-icon {
    width: 20px;
    height: 20px;
    opacity: 0.7;
    flex-shrink: 0;
}

.nav-badge {
    margin-left: auto;
    background: var(--accent-primary);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px;
    border-top: var(--border-subtle);
}

.user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: var(--radius-sm);
    transition: background 0.2s;
    cursor: pointer;
}

.user-card:hover { background: rgba(255,255,255,0.04); }

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    color: white;
    flex-shrink: 0;
}

.user-info { overflow: hidden; }
.user-info .name { font-size: 0.85rem; font-weight: 600; }
.user-info .role { font-size: 0.7rem; color: var(--text-muted); }

/* === Main Content === */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* === Top Bar === */
.topbar {
    padding: 20px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: var(--border-subtle);
    background: rgba(15, 17, 23, 0.5);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-left h2 {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.topbar-left p {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* === Page Content === */
.page-content {
    padding: 28px 32px;
    flex: 1;
}

/* === Cards === */
.card {
    background: var(--bg-card);
    border: var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all 0.3s;
}

.card:hover {
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: var(--shadow-md);
}

.card-header {
    padding: 20px 24px;
    border-bottom: var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 {
    font-size: 1rem;
    font-weight: 700;
}

.card-body {
    padding: 24px;
}

.card-footer {
    padding: 16px 24px;
    border-top: var(--border-subtle);
    background: var(--glass-highlight);
}

/* === Stat Cards === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    border: var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 22px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
    border-color: rgba(108, 99, 255, 0.15);
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 80px;
    height: 80px;
    border-radius: 0 0 0 80px;
    opacity: 0.05;
}

.stat-card.accent-purple::after { background: var(--accent-primary); }
.stat-card.accent-green::after { background: var(--accent-secondary); }
.stat-card.accent-red::after { background: var(--accent-warm); }
.stat-card.accent-amber::after { background: var(--accent-amber); }
.stat-card.accent-cyan::after { background: var(--accent-cyan); }

.stat-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    font-size: 1.2rem;
}

.stat-icon.purple { background: var(--accent-primary-soft); color: var(--accent-primary); }
.stat-icon.green { background: var(--accent-secondary-soft); color: var(--accent-secondary); }
.stat-icon.red { background: var(--accent-warm-soft); color: var(--accent-warm); }
.stat-icon.amber { background: var(--accent-amber-soft); color: var(--accent-amber); }
.stat-icon.cyan { background: rgba(54, 215, 242, 0.12); color: var(--accent-cyan); }

.stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -1px;
    line-height: 1;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 6px;
    font-weight: 500;
}

.stat-change {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.72rem;
    font-weight: 600;
    margin-top: 8px;
    padding: 3px 8px;
    border-radius: 20px;
}

.stat-change.up { background: var(--accent-secondary-soft); color: var(--color-success); }
.stat-change.down { background: var(--accent-warm-soft); color: var(--color-danger); }

/* === Forms === */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    letter-spacing: 0.3px;
}

.form-control {
    width: 100%;
    padding: 11px 14px;
    background: var(--bg-input);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 0.88rem;
    transition: all 0.2s;
    outline: none;
}

.form-control:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-primary-soft);
}

.form-control::placeholder {
    color: var(--text-muted);
}

select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238b8fa3' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

.form-inline {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.form-hint {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-primary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s;
    white-space: nowrap;
    text-decoration: none;
}

.btn-primary {
    background: var(--accent-primary);
    color: white;
    box-shadow: 0 4px 12px rgba(108, 99, 255, 0.3);
}

.btn-primary:hover {
    background: #5a52e0;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(108, 99, 255, 0.4);
    color: white;
}

.btn-gradient {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 4px 16px rgba(108, 99, 255, 0.25);
}

.btn-gradient:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(108, 99, 255, 0.35);
    color: white;
}

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: var(--border-subtle);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.btn-danger {
    background: var(--accent-warm-soft);
    color: var(--accent-warm);
}

.btn-danger:hover {
    background: var(--accent-warm);
    color: white;
}

.btn-success {
    background: var(--accent-secondary-soft);
    color: var(--accent-secondary);
}

.btn-success:hover {
    background: var(--accent-secondary);
    color: white;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.78rem;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 0.95rem;
}

.btn-icon {
    padding: 8px;
    width: 36px;
    height: 36px;
}

.btn-group {
    display: flex;
    gap: 8px;
}

/* === Tables === */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-md);
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.data-table thead th {
    background: var(--bg-elevated);
    padding: 12px 16px;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    text-align: left;
    border-bottom: var(--border-subtle);
    position: sticky;
    top: 0;
    white-space: nowrap;
}

.data-table tbody tr {
    transition: background 0.15s;
}

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

.data-table tbody td {
    padding: 14px 16px;
    font-size: 0.85rem;
    border-bottom: var(--border-subtle);
    vertical-align: middle;
}

.data-table .keyword-cell {
    font-weight: 600;
    max-width: 250px;
}

.data-table .country-cell {
    white-space: nowrap;
}

/* === Position Badges === */
.position-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
}

.position-gold { background: rgba(255,179,71,0.15); color: #ffb347; }
.position-green { background: var(--accent-secondary-soft); color: var(--color-success); }
.position-blue { background: rgba(54,215,242,0.12); color: var(--accent-cyan); }
.position-gray { background: rgba(255,255,255,0.05); color: var(--text-muted); }

/* === Tags === */
.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    background: rgba(255,255,255,0.05);
    color: var(--text-secondary);
}

.tag-device { background: rgba(54,215,242,0.1); color: var(--accent-cyan); }
.tag-engine { background: var(--accent-primary-soft); color: var(--accent-primary); }

/* === Alerts / Flash Messages === */
.flash-container {
    padding: 0 32px;
    margin-top: 16px;
}

.flash-message {
    padding: 14px 20px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    animation: flashIn 0.35s ease;
}

@keyframes flashIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.flash-success { background: var(--accent-secondary-soft); color: var(--color-success); border: 1px solid rgba(0,212,170,0.2); }
.flash-error { background: var(--accent-warm-soft); color: var(--color-danger); border: 1px solid rgba(255,107,107,0.2); }
.flash-warning { background: var(--accent-amber-soft); color: var(--color-warning); border: 1px solid rgba(255,179,71,0.2); }
.flash-info { background: rgba(54,215,242,0.1); color: var(--accent-cyan); border: 1px solid rgba(54,215,242,0.2); }

/* === Modal === */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    z-index: 500;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s;
}

.modal-overlay.active { display: flex; }

.modal {
    background: var(--bg-card);
    border: var(--border-subtle);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    padding: 24px 28px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 { font-size: 1.15rem; font-weight: 700; }

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    transition: color 0.2s;
}

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

.modal-body { padding: 0 28px 24px; }
.modal-footer {
    padding: 16px 28px;
    border-top: var(--border-subtle);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* === Empty State === */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-icon {
    font-size: 3.5rem;
    margin-bottom: 16px;
    opacity: 0.3;
}

.empty-state h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-muted);
    font-size: 0.85rem;
    max-width: 360px;
    margin: 0 auto 20px;
}

/* === Refresh Timer === */
.refresh-timer {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: var(--accent-primary-soft);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent-primary);
}

.refresh-dot {
    width: 6px;
    height: 6px;
    background: var(--accent-primary);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* === Search Box === */
.search-box {
    position: relative;
}

.search-box input {
    padding-left: 40px;
}

.search-box svg {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    width: 16px;
    height: 16px;
}

/* === Keyword Bulk Input === */
.keyword-textarea {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    line-height: 1.8;
    min-height: 160px;
}

/* === Toolbar === */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

.toolbar-filters {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-chip {
    padding: 7px 14px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 500;
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border: var(--border-subtle);
    cursor: pointer;
    transition: all 0.2s;
}

.filter-chip:hover, .filter-chip.active {
    background: var(--accent-primary-soft);
    color: var(--accent-primary);
    border-color: rgba(108, 99, 255, 0.3);
}

/* === Progress Bar === */
.progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(255,255,255,0.05);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--accent-gradient);
    border-radius: 2px;
    transition: width 0.5s ease;
}

/* === Keyword Chart placeholder === */
.chart-container {
    background: var(--bg-input);
    border-radius: var(--radius-md);
    padding: 20px;
    min-height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* === Grid layouts === */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }

/* === Website Cards === */
.website-card {
    background: var(--bg-card);
    border: var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 22px;
    transition: all 0.3s;
    cursor: pointer;
}

.website-card:hover {
    border-color: rgba(108, 99, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.website-card .domain {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.website-card .domain img {
    width: 18px;
    height: 18px;
    border-radius: 4px;
}

.website-card .meta {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.website-card .stats-row {
    display: flex;
    gap: 16px;
}

.website-card .stat-item {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.website-card .stat-item strong {
    display: block;
    font-size: 1.1rem;
    color: var(--text-primary);
}

/* === Checkbox === */
.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.85rem;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-primary);
    cursor: pointer;
}

/* === Scrollbar === */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* === Login Page === */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    background: var(--bg-card);
    border: var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 48px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}

.login-card h1 {
    font-size: 1.8rem;
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-align: center;
    margin-bottom: 8px;
}

.login-card .subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 32px;
}

.login-divider {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.75rem;
    margin: 20px 0;
    position: relative;
}

.login-divider::before, .login-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background: rgba(255,255,255,0.07);
}

.login-divider::before { left: 0; }
.login-divider::after { right: 0; }

/* === Animations === */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

.animate-fade { animation: fadeIn 0.5s ease; }
.animate-slide { animation: slideUp 0.5s ease; }

/* === Responsive === */
.mobile-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px;
}

@media (max-width: 1024px) {
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .mobile-toggle { display: block; }
    .topbar { padding: 16px 20px; }
    .page-content { padding: 20px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .form-inline { flex-direction: column; }
    .toolbar { flex-direction: column; align-items: flex-start; }
    .login-card { padding: 32px 24px; }
}

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

/* ============================================
   LIGHT THEME
   ============================================ */
[data-theme="light"] {
    --bg-deep: #f0f2f5;
    --bg-primary: #f5f6fa;
    --bg-secondary: #eceef2;
    --bg-card: #ffffff;
    --bg-card-hover: #f8f9fc;
    --bg-elevated: #edf0f5;
    --bg-input: #f5f6fa;

    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(0, 0, 0, 0.06);
    --glass-highlight: rgba(0, 0, 0, 0.02);

    --accent-primary: #5b54e0;
    --accent-primary-soft: rgba(91, 84, 224, 0.1);
    --accent-secondary: #00b894;
    --accent-secondary-soft: rgba(0, 184, 148, 0.1);
    --accent-warm: #e74c3c;
    --accent-warm-soft: rgba(231, 76, 60, 0.08);
    --accent-amber: #e67e22;
    --accent-amber-soft: rgba(230, 126, 34, 0.08);
    --accent-cyan: #0984e3;
    --accent-gradient: linear-gradient(135deg, #5b54e0 0%, #0984e3 50%, #00b894 100%);

    --text-primary: #1a1c2e;
    --text-secondary: #5a5f7a;
    --text-muted: #8b90a5;
    --text-accent: #5b54e0;

    --color-success: #00b894;
    --color-danger: #e74c3c;
    --color-warning: #e67e22;
    --color-info: #0984e3;

    --border-subtle: 1px solid rgba(0, 0, 0, 0.07);
    --border-accent: 1px solid rgba(91, 84, 224, 0.25);
    --shadow-sm: 0 1px 4px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.1);
    --shadow-glow: 0 0 20px rgba(91, 84, 224, 0.08);
}

[data-theme="light"] body::before {
    background:
        radial-gradient(ellipse at 20% 20%, rgba(91,84,224,0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(0,184,148,0.03) 0%, transparent 50%);
}

[data-theme="light"] .sidebar {
    background: rgba(255,255,255,0.85);
    box-shadow: 2px 0 12px rgba(0,0,0,0.04);
}

[data-theme="light"] .topbar {
    background: rgba(255,255,255,0.7);
}

[data-theme="light"] .data-table thead th {
    background: #f0f2f5;
    color: #5a5f7a;
}

[data-theme="light"] .data-table tbody tr:hover {
    background: rgba(91,84,224,0.03);
}

[data-theme="light"] .login-card {
    background: #ffffff;
    box-shadow: 0 12px 48px rgba(0,0,0,0.08);
}

[data-theme="light"] .position-gold { background: rgba(230,126,34,0.1); color: #d68910; }
[data-theme="light"] .position-green { background: rgba(0,184,148,0.1); color: #00a381; }
[data-theme="light"] .position-blue { background: rgba(9,132,227,0.1); color: #0869b8; }
[data-theme="light"] .position-gray { background: rgba(0,0,0,0.04); color: #8b90a5; }

[data-theme="light"] .nav-item:hover {
    background: rgba(0,0,0,0.04);
}

[data-theme="light"] .nav-item.active {
    background: rgba(91,84,224,0.08);
}

[data-theme="light"] .stat-card:hover {
    box-shadow: 0 4px 20px rgba(91,84,224,0.08);
}

[data-theme="light"] .form-control {
    background: #f5f6fa;
    border-color: rgba(0,0,0,0.1);
    color: #1a1c2e;
}

[data-theme="light"] .form-control:focus {
    border-color: #5b54e0;
    box-shadow: 0 0 0 3px rgba(91,84,224,0.12);
}

[data-theme="light"] .flash-success { background: rgba(0,184,148,0.08); color: #00a381; border-color: rgba(0,184,148,0.15); }
[data-theme="light"] .flash-error { background: rgba(231,76,60,0.06); color: #c0392b; border-color: rgba(231,76,60,0.12); }
[data-theme="light"] .flash-warning { background: rgba(230,126,34,0.06); color: #d35400; border-color: rgba(230,126,34,0.12); }
[data-theme="light"] .flash-info { background: rgba(9,132,227,0.06); color: #0869b8; border-color: rgba(9,132,227,0.12); }

[data-theme="light"] .modal {
    background: #ffffff;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

[data-theme="light"] .website-card {
    background: #ffffff;
}

[data-theme="light"] ::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); }
[data-theme="light"] ::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.2); }

/* ============================================
   CHECKING SPINNER
   ============================================ */
.checking-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid var(--accent-primary-soft);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
}

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