/* ============================================================
   LicenseGuard Admin — Design System
   ============================================================ */

/* ---- Variables ---- */
:root {
    /* Richer, deeper background palette */
    --bg-base: #090a0f;
    --bg-surface: rgba(13, 15, 20, 0.85);
    --bg-elevated: rgba(22, 25, 35, 0.6);
    --bg-card: rgba(26, 30, 40, 0.5);
    --bg-hover: rgba(255, 255, 255, 0.05);

    /* Refined borders */
    --border: rgba(255, 255, 255, 0.06);
    --border-light: rgba(255, 255, 255, 0.1);
    --border-highlight: rgba(255, 255, 255, 0.15);

    /* Text Colors */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    /* Vibrant Accents */
    --accent: #6366f1;
    --accent-hover: #4f52d6;
    --accent-glow: rgba(99, 102, 241, 0.4);
    --accent-light: rgba(99, 102, 241, 0.15);
    --accent-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);

    /* Status Colors */
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.15);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.15);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.15);
    --info: #3b82f6;
    --info-bg: rgba(59, 130, 246, 0.15);

    /* Layout & Effects */
    --sidebar-w: 270px;
    --topbar-h: 70px;
    --radius: 16px;
    --radius-sm: 8px;
    --radius-lg: 24px;

    /* Premium Shadows */
    --shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
    --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.2);
    --shadow-hover: 0 20px 40px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px var(--accent-glow);

    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --backdrop: blur(16px) saturate(180%);
}

/* ============================================================
   Light Mode Overrides
   ============================================================ */
body.light-mode {
    --bg-base: #f0f2f8;
    --bg-surface: rgba(255, 255, 255, 0.92);
    --bg-elevated: rgba(240, 242, 248, 0.9);
    --bg-card: rgba(255, 255, 255, 0.85);
    --bg-hover: rgba(0, 0, 0, 0.04);

    --border: rgba(0, 0, 0, 0.08);
    --border-light: rgba(0, 0, 0, 0.12);
    --border-highlight: rgba(0, 0, 0, 0.18);

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;

    --accent-glow: rgba(99, 102, 241, 0.2);
    --accent-light: rgba(99, 102, 241, 0.1);

    --success-bg: rgba(16, 185, 129, 0.1);
    --warning-bg: rgba(245, 158, 11, 0.1);
    --danger-bg: rgba(239, 68, 68, 0.1);
    --info-bg: rgba(59, 130, 246, 0.1);

    --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-hover: 0 10px 30px rgba(0, 0, 0, 0.12);
    --shadow-glow: 0 0 16px var(--accent-glow);

    background-image:
        radial-gradient(circle at 15% 50%, rgba(99, 102, 241, 0.05), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(168, 85, 247, 0.05), transparent 25%);
}

body.light-mode .sidebar {
    background: rgba(255, 255, 255, 0.97);
    border-right: 1px solid rgba(0, 0, 0, 0.07);
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.06);
}

body.light-mode .topbar {
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid rgba(0, 0, 0, 0.07);
}

/* Global text inheriting from :root vars */
body.light-mode,
body.light-mode .main-content,
body.light-mode .card,
body.light-mode .card-body,
body.light-mode .page-header p,
body.light-mode td,
body.light-mode th,
body.light-mode label,
body.light-mode p {
    color: var(--text-primary);
}

/* Sidebar text */
body.light-mode .nav-section-label {
    color: var(--text-muted);
}

body.light-mode .nav-item {
    color: var(--text-secondary);
}

body.light-mode .nav-item:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

body.light-mode .nav-item.active {
    color: var(--accent);
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.1), transparent);
}

body.light-mode .nav-item.active i,
body.light-mode .nav-item:hover i {
    color: inherit;
}

/* Sidebar logo / version */
body.light-mode .sidebar-logo .logo-name {
    color: var(--text-primary);
}

body.light-mode .sidebar-logo .logo-version {
    color: var(--text-muted);
}

/* Tables */
body.light-mode thead th {
    background: rgba(240, 242, 248, 0.98);
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-light);
}

body.light-mode tbody tr:hover td {
    background: rgba(0, 0, 0, 0.02);
}

body.light-mode .td-muted {
    color: var(--text-secondary);
}

body.light-mode .td-mono {
    color: var(--accent);
}

/* Card headers & titles */
body.light-mode .card-header {
    border-bottom: 1px solid var(--border);
}

body.light-mode .card-title {
    color: var(--text-primary);
}

/* Form elements */
body.light-mode .form-control {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.12);
    color: var(--text-primary);
}

body.light-mode .form-control::placeholder {
    color: var(--text-muted);
}

body.light-mode .form-control:focus {
    background: #fff;
    border-color: var(--accent);
}

body.light-mode .form-label {
    color: var(--text-secondary);
}

body.light-mode .form-hint {
    color: var(--text-muted);
}

body.light-mode .form-check {
    color: var(--text-secondary);
}

/* Select dropdowns */
body.light-mode select.form-control {
    background-color: #fff;
    color: var(--text-primary);
}

/* Stat cards */
body.light-mode .stat-card {
    background: var(--bg-card);
}

body.light-mode .stat-value {
    color: var(--text-primary);
}

body.light-mode .stat-label {
    color: var(--text-muted);
}

body.light-mode .stat-card:hover {
    background: rgba(255, 255, 255, 0.98);
}

/* Activity list */
body.light-mode .activity-item {
    border-bottom: 1px solid var(--border);
}

body.light-mode .activity-text {
    color: var(--text-secondary);
}

body.light-mode .activity-time {
    color: var(--text-muted);
}

/* API endpoint rows */
body.light-mode .api-endpoint {
    background: var(--bg-surface);
    border: 1px solid var(--border);
}

body.light-mode .endpoint-url {
    color: var(--text-primary);
}

body.light-mode .endpoint-desc {
    color: var(--text-muted);
}

/* Topbar elements */
body.light-mode .topbar-right .btn-ghost {
    color: var(--text-secondary);
}

body.light-mode .topbar-right .btn-ghost:hover {
    color: var(--text-primary);
}

/* User info in sidebar bottom */
body.light-mode .user-info .user-name {
    color: var(--text-primary);
}

body.light-mode .user-info .user-role {
    color: var(--text-muted);
}

/* Page breadcrumb */
body.light-mode .breadcrumb,
body.light-mode .breadcrumb a {
    color: var(--text-muted);
}

/* Code blocks remain dark for readability */
body.light-mode .snip-pre,
body.light-mode pre,
body.light-mode code {
    background: #1e1e2e;
    color: #e6edf3;
}

/* Inline code — keep readable */
body.light-mode p code,
body.light-mode li code,
body.light-mode td code {
    background: rgba(99, 102, 241, 0.1);
    color: var(--accent);
    border-radius: 4px;
    padding: 1px 5px;
}

/* Empty state icons */
body.light-mode .empty-state {
    color: var(--text-muted);
}

/* Flash messages */
body.light-mode .flash-success {
    background: var(--success-bg);
    color: var(--success);
    border-color: var(--success);
}

body.light-mode .flash-error {
    background: var(--danger-bg);
    color: var(--danger);
    border-color: var(--danger);
}

/* Buttons */
body.light-mode .btn-ghost {
    color: var(--text-secondary);
    border-color: var(--border-light);
}

body.light-mode .btn-ghost:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

body.light-mode .btn-secondary {
    background: rgba(0, 0, 0, 0.06);
    color: var(--text-primary);
    border-color: var(--border);
}

body.light-mode .btn-secondary:hover {
    background: rgba(0, 0, 0, 0.1);
}

/* Login page */
body.light-mode .login-page {
    background: var(--bg-base);
}


/* ============================================================
   Theme Picker (Settings Page)
   ============================================================ */
.theme-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 10px;
    border-radius: var(--radius-sm);
    border: 2px solid var(--border);
    transition: all var(--transition);
    min-width: 110px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.theme-option:hover {
    border-color: var(--accent);
    color: var(--text-primary);
}

.theme-option-active {
    border-color: var(--accent);
    background: var(--accent-light);
    color: var(--accent);
    box-shadow: 0 0 12px var(--accent-glow);
}

.theme-preview {
    width: 90px;
    height: 56px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border-light);
}

.theme-preview-dark {
    background: #090a0f;
}

.theme-preview-dark .tp-bar {
    height: 10px;
    background: #0d0f14;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.theme-preview-dark .tp-content {
    display: flex;
    gap: 4px;
    padding: 5px;
}

.theme-preview-dark .tp-card {
    flex: 1;
    height: 30px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.theme-preview-light {
    background: #f0f2f8;
}

.theme-preview-light .tp-bar {
    height: 10px;
    background: #fff;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.theme-preview-light .tp-content {
    display: flex;
    gap: 4px;
    padding: 5px;
}

.theme-preview-light .tp-card {
    flex: 1;
    height: 30px;
    background: #fff;
    border-radius: 3px;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

/* ---- Reset ---- */

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 15px;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    letter-spacing: -0.015em;
    background: var(--bg-base);
    background-image:
        radial-gradient(circle at 15% 50%, rgba(99, 102, 241, 0.08), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(168, 85, 247, 0.08), transparent 25%);
    background-attachment: fixed;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--accent-hover);
}

img {
    max-width: 100%;
}

button {
    cursor: pointer;
    font-family: inherit;
}

input,
select,
textarea {
    font-family: inherit;
}

/* ============================================================
   Sidebar
   ============================================================ */
.sidebar {
    width: var(--sidebar-w);
    background: var(--bg-surface);
    backdrop-filter: var(--backdrop);
    -webkit-backdrop-filter: var(--backdrop);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    transition: transform var(--transition), width var(--transition);
    overflow: hidden;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.2)
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border);
}

.brand-icon {
    width: 40px;
    height: 40px;
    background: var(--accent-gradient);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 4px 12px var(--accent-glow);
    position: relative;
    overflow: hidden;
}

.brand-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    display: block;
    letter-spacing: -0.3px;
}

.brand-version {
    font-size: 11px;
    color: var(--text-muted);
    display: block;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 12px;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.nav-section-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 12px 8px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition);
    margin-bottom: 2px;
}

.nav-item i {
    width: 18px;
    text-align: center;
    font-size: 15px;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.1), transparent);
    color: var(--accent);
    border-left: 3px solid var(--accent);
    box-shadow: none;
    text-shadow: 0 0 10px var(--accent-glow);
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.admin-avatar {
    width: 34px;
    height: 34px;
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.admin-details {
    min-width: 0;
}

.admin-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-role {
    font-size: 11px;
    color: var(--text-muted);
    display: block;
}

.btn-logout {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    background: var(--danger-bg);
    color: var(--danger);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all var(--transition);
    flex-shrink: 0;
}

.btn-logout:hover {
    background: var(--danger);
    color: #fff;
}

/* ============================================================
   Main Wrapper
   ============================================================ */
.main-wrapper {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left var(--transition);
}

/* ============================================================
   Topbar
   ============================================================ */
.topbar {
    height: var(--topbar-h);
    background: rgba(13, 15, 20, 0.7);
    backdrop-filter: var(--backdrop);
    -webkit-backdrop-filter: var(--backdrop);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}

.sidebar-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.topbar-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

.topbar-actions {
    display: flex;
    gap: 8px;
}

/* ============================================================
   Page Content
   ============================================================ */
.page-content {
    flex: 1;
    padding: 32px 32px;
    width: 100%;
    animation: contentFadeIn 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes contentFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================================
   Flash Messages
   ============================================================ */
.flash-container {
    padding: 16px 28px 0;
}

.alert {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 12px;
    position: relative;
    animation: slideIn 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.alert-success {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.25);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.15);
}

.alert-error {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.25);
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.15);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.25);
}

.alert-info {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.25);
}

.alert-close {
    margin-left: auto;
    background: none;
    border: none;
    color: inherit;
    font-size: 18px;
    line-height: 1;
    opacity: 0.6;
    cursor: pointer;
}

.alert-close:hover {
    opacity: 1;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert.fade-out {
    animation: fadeOut 0.4s ease forwards;
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateY(-8px);
        height: 0;
        padding: 0;
        margin: 0;
    }
}

/* ============================================================
   Cards
   ============================================================ */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.card-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-title i {
    color: var(--accent);
}

.card-body {
    padding: 22px;
}

/* ============================================================
   Stats Grid
   ============================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    opacity: 0.5;
}

.stat-card:hover {
    border-color: var(--border-highlight);
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    background: rgba(40, 45, 60, 0.6);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.stat-icon.purple {
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent);
}

.stat-icon.green {
    background: var(--success-bg);
    color: var(--success);
}

.stat-icon.yellow {
    background: var(--warning-bg);
    color: var(--warning);
}

.stat-icon.red {
    background: var(--danger-bg);
    color: var(--danger);
}

.stat-icon.blue {
    background: var(--info-bg);
    color: var(--info);
}

.stat-info {
    flex: 1;
    min-width: 0;
}

.stat-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 2px;
}

/* ============================================================
   Tables
   ============================================================ */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

thead th {
    background: var(--bg-elevated);
    padding: 12px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background var(--transition), transform var(--transition);
}

tbody tr:last-child {
    border-bottom: none;
}

tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
    /* transform: scale(1.002); Subtle lift */
}

tbody td {
    padding: 16px 16px;
    color: var(--text-primary);
    vertical-align: middle;
}

.td-mono {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    color: var(--accent);
    letter-spacing: 0.5px;
}

.td-muted {
    color: var(--text-muted);
    font-size: 13px;
}

/* ============================================================
   Badges
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.badge-success {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.2);
    text-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.badge-secondary {
    background: rgba(148, 163, 184, 0.15);
    color: #cbd5e1;
    border: 1px solid rgba(148, 163, 184, 0.15);
}

.badge-info {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.badge-accent {
    background: rgba(99, 102, 241, 0.2);
    color: #818cf8;
    border: 1px solid rgba(99, 102, 241, 0.2);
    box-shadow: 0 0 10px var(--accent-glow);
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
    line-height: 1;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-xs {
    padding: 4px 9px;
    font-size: 12px;
    border-radius: 6px;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 15px;
}

.btn-primary {
    background: var(--accent-gradient);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 12px var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
}

.btn-primary:hover {
    background: var(--accent-hover);
    color: #fff;
    box-shadow: 0 0 30px var(--accent-glow);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-success {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.btn-success:hover {
    background: var(--success);
    color: #fff;
}

.btn-danger {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background: var(--danger);
    color: #fff;
}

.btn-warning {
    background: var(--warning-bg);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.btn-warning:hover {
    background: var(--warning);
    color: #fff;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* ============================================================
   Forms
   ============================================================ */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-label .required {
    color: var(--danger);
    margin-left: 2px;
}

.form-control {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 10px 14px;
    font-size: 14px;
    transition: all var(--transition);
    outline: none;
    appearance: none;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow), inset 0 1px 2px rgba(0, 0, 0, 0.1);
    background: rgba(0, 0, 0, 0.3);
}

.form-control::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

select.form-control {
    cursor: pointer;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

.form-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 5px;
}

.form-error {
    font-size: 12px;
    color: var(--danger);
    margin-top: 5px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.form-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
}

/* ============================================================
   Pagination
   ============================================================ */
.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 16px 22px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

.pagination-info {
    font-size: 13px;
    color: var(--text-muted);
    margin-right: auto;
}

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    transition: all var(--transition);
}

.page-link:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.page-link.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.page-link.disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* ============================================================
   Search / Filter Bar
   ============================================================ */
.filter-bar {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.search-input-wrap {
    position: relative;
    flex: 1;
    min-width: 200px;
    max-width: 360px;
}

.search-input-wrap i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 14px;
}

.search-input-wrap .form-control {
    padding-left: 36px;
}

/* ============================================================
   Page Header
   ============================================================ */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
    flex-wrap: wrap;
}

.page-header-left h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.page-header-left p {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 4px;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.breadcrumb a {
    color: var(--text-muted);
}

.breadcrumb a:hover {
    color: var(--accent);
}

.breadcrumb .sep {
    color: var(--text-muted);
    opacity: 0.4;
}

/* ============================================================
   Detail / View Rows
   ============================================================ */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.detail-item {
    position: relative;
}

.detail-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.detail-value {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
}

.detail-value.mono {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    color: var(--accent);
}

/* ============================================================
   Empty State
   ============================================================ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.3;
    display: block;
}

.empty-state h3 {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
}

/* ============================================================
   Login Page
   ============================================================ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-base);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, transparent 70%);
    top: -200px;
    left: -200px;
    pointer-events: none;
}

.login-page::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.1) 0%, transparent 70%);
    bottom: -100px;
    right: -100px;
    pointer-events: none;
}

.login-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow);
    position: relative;
    z-index: 1;
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo-icon {
    width: 64px;
    height: 64px;
    background: var(--accent-gradient);
    border-radius: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: #fff;
    margin-bottom: 16px;
    box-shadow: 0 10px 30px var(--accent-glow);
    position: relative;
    overflow: hidden;
}

.login-logo-icon::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transform: rotate(45deg);
    animation: shine 3s infinite;
}

@keyframes shine {
    0% {
        transform: translateX(-100%) rotate(45deg);
    }

    20% {
        transform: translateX(100%) rotate(45deg);
    }

    100% {
        transform: translateX(100%) rotate(45deg);
    }
}

.login-logo h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.login-logo p {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 6px;
}

.login-card .btn-primary {
    width: 100%;
    justify-content: center;
    padding: 12px;
    font-size: 15px;
}

/* ============================================================
   Dashboard Charts / Activity
   ============================================================ */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 24px;
}

.activity-list {
    list-style: none;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-top: 6px;
    flex-shrink: 0;
}

.activity-dot.success {
    background: var(--success);
}

.activity-dot.fail {
    background: var(--danger);
}

.activity-dot.blocked {
    background: var(--warning);
}

.activity-text {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.activity-text strong {
    color: var(--text-primary);
}

.activity-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
    display: block;
}

/* ============================================================
   Key Display
   ============================================================ */
.license-key-display {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 15px;
    color: var(--accent);
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.copy-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all var(--transition);
    font-size: 13px;
}

.copy-btn:hover {
    color: var(--accent);
    background: var(--accent-light);
}

/* ============================================================
   API Docs Section
   ============================================================ */
.api-endpoint {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.method-badge {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    flex-shrink: 0;
}

.method-get {
    background: var(--info-bg);
    color: var(--info);
}

.method-post {
    background: var(--success-bg);
    color: var(--success);
}

.endpoint-url {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    color: var(--text-primary);
}

.endpoint-desc {
    font-size: 13px;
    color: var(--text-muted);
    margin-left: auto;
}

/* ============================================================
   Utilities
   ============================================================ */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-muted {
    color: var(--text-muted);
}

.text-success {
    color: var(--success);
}

.text-danger {
    color: var(--danger);
}

.text-warning {
    color: var(--warning);
}

.text-accent {
    color: var(--accent);
}

.fw-600 {
    font-weight: 600;
}

.fw-700 {
    font-weight: 700;
}

.mt-4 {
    margin-top: 4px;
}

.mt-8 {
    margin-top: 8px;
}

.mt-16 {
    margin-top: 16px;
}

.mt-24 {
    margin-top: 24px;
}

.mb-16 {
    margin-bottom: 16px;
}

.mb-24 {
    margin-bottom: 24px;
}

.gap-8 {
    gap: 8px;
}

.flex {
    display: flex;
}

.flex-center {
    display: flex;
    align-items: center;
}

.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.flex-wrap {
    flex-wrap: wrap;
}

.actions-cell {
    display: flex;
    gap: 6px;
    align-items: center;
}

/* ============================================================
   Sidebar Collapsed
   ============================================================ */
.sidebar-collapsed .sidebar {
    transform: translateX(-100%);
}

.sidebar-collapsed .main-wrapper {
    margin-left: 0;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .main-wrapper {
        margin-left: 0;
    }

    body:not(.sidebar-collapsed) .sidebar {
        transform: translateX(0);
    }

    .form-row,
    .form-row-3 {
        grid-template-columns: 1fr;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .page-content {
        padding: 16px;
    }
}

@media (max-width: 600px) {
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .topbar {
        padding: 0 16px;
    }

    .login-card {
        padding: 28px 20px;
    }
}