/* ============================================
   COMMAND CENTER — Dark Dashboard Theme
   Inspired by Vercel / Linear aesthetics
   ============================================ */

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

/* ---- DESIGN TOKENS ---- */
:root {
    /* Surface palette */
    --bg-root:        #09090b;
    --bg-surface:     #0f0f12;
    --bg-raised:      #18181b;
    --bg-overlay:     #1c1c20;
    --bg-hover:       #27272a;
    --bg-active:      #2e2e33;

    /* Border */
    --border-subtle:  #1e1e23;
    --border-default: #27272a;
    --border-strong:  #3f3f46;

    /* Text */
    --text-primary:   #fafafa;
    --text-secondary: #a1a1aa;
    --text-muted:     #71717a;
    --text-disabled:  #52525b;

    /* Accent (cool blue — professional, not playful) */
    --accent:         #3b82f6;
    --accent-hover:   #2563eb;
    --accent-muted:   rgba(59, 130, 246, 0.12);
    --accent-text:    #60a5fa;

    /* Semantic */
    --success:        #22c55e;
    --success-muted:  rgba(34, 197, 94, 0.12);
    --warning:        #eab308;
    --warning-muted:  rgba(234, 179, 8, 0.12);
    --danger:         #ef4444;
    --danger-muted:   rgba(239, 68, 68, 0.12);

    /* Typography */
    --font-sans:      'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono:      'Geist Mono', 'SF Mono', 'Fira Code', monospace;

    /* Sizing */
    --sidebar-width:  260px;
    --header-height:  56px;
    --radius-sm:      6px;
    --radius-md:      8px;
    --radius-lg:      12px;
    --radius-xl:      16px;

    /* Shadows */
    --shadow-sm:      0 1px 2px rgba(0,0,0,0.3);
    --shadow-md:      0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg:      0 8px 30px rgba(0,0,0,0.5);

    /* Transitions */
    --ease-out:       cubic-bezier(0.16, 1, 0.3, 1);
    --duration:       150ms;
}

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

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

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

a {
    color: var(--accent-text);
    text-decoration: none;
    transition: color var(--duration) var(--ease-out);
}
a:hover { color: var(--accent); }

/* ---- LOGIN PAGE ---- */
.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(59, 130, 246, 0.06) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, rgba(59, 130, 246, 0.03) 0%, transparent 50%),
        var(--bg-root);
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
}

.login-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.login-logo .logo-icon {
    width: 36px;
    height: 36px;
    background: var(--accent);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    color: #fff;
}

.login-logo h1 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.login-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.75rem;
}

/* ---- FORMS ---- */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-input {
    width: 100%;
    padding: 0.7rem 0.85rem;
    background: var(--bg-raised);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    transition: all var(--duration) var(--ease-out);
    outline: none;
}

.form-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-muted);
}

.form-input::placeholder {
    color: var(--text-disabled);
}

.form-input.mono {
    font-family: var(--font-mono);
    font-size: 1.3rem;
    text-align: center;
    letter-spacing: 0.5em;
    padding: 0.85rem;
}

/* ---- BUTTONS ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1.25rem;
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all var(--duration) var(--ease-out);
    text-decoration: none;
    line-height: 1.4;
}

.btn:active { transform: scale(0.98); }

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

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border-default);
}
.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}
.btn-danger:hover {
    background: #dc2626;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 0.4rem 0.85rem;
    font-size: 0.82rem;
}

/* ---- ALERTS ---- */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    margin-bottom: 1.25rem;
    border: 1px solid;
}

.alert-error {
    background: var(--danger-muted);
    border-color: rgba(239, 68, 68, 0.25);
    color: #fca5a5;
}

.alert-success {
    background: var(--success-muted);
    border-color: rgba(34, 197, 94, 0.25);
    color: #86efac;
}

.alert-warning {
    background: var(--warning-muted);
    border-color: rgba(234, 179, 8, 0.25);
    color: #fde047;
}

/* ---- DASHBOARD LAYOUT ---- */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-surface);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform 0.3s var(--ease-out);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid var(--border-subtle);
}

.sidebar-brand .brand-icon {
    width: 32px;
    height: 32px;
    background: var(--accent);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
    color: #fff;
    flex-shrink: 0;
}

.sidebar-brand span {
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: -0.02em;
}

.sidebar-nav {
    flex: 1;
    padding: 0.75rem;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 1.5rem;
}

.nav-section-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 0 0.75rem;
    margin-bottom: 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.55rem 0.75rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--duration) var(--ease-out);
    cursor: pointer;
    text-decoration: none;
}

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

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

.nav-item svg,
.nav-item .nav-icon {
    width: 18px;
    height: 18px;
    opacity: 0.7;
    flex-shrink: 0;
}

.nav-item.active svg,
.nav-item.active .nav-icon {
    opacity: 1;
}

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-subtle);
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-active);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--accent-text);
    flex-shrink: 0;
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-info .name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-info .role {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: capitalize;
}

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

.content-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-surface);
    position: sticky;
    top: 0;
    z-index: 50;
}

.content-header h2 {
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.content-body {
    padding: 2rem;
    max-width: 1200px;
}

/* ---- CARDS ---- */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-subtle);
}

.card-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* ---- MODULE GRID ---- */
.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.module-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    transition: all var(--duration) var(--ease-out);
    cursor: pointer;
    text-decoration: none;
    display: block;
}

.module-card:hover {
    border-color: var(--border-strong);
    background: var(--bg-raised);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

.module-card h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
    color: var(--text-primary);
}

.module-card p {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.module-tag {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 99px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-top: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.tag-active {
    background: var(--success-muted);
    color: var(--success);
}

.tag-soon {
    background: var(--warning-muted);
    color: var(--warning);
}

/* ---- TABLE ---- */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-default);
}

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

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

/* Status badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.6rem;
    border-radius: 99px;
    font-size: 0.78rem;
    font-weight: 500;
}

.badge-success { background: var(--success-muted); color: var(--success); }
.badge-warning { background: var(--warning-muted); color: var(--warning); }
.badge-danger  { background: var(--danger-muted); color: var(--danger); }
.badge-default { background: var(--bg-active); color: var(--text-secondary); }

.badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* ---- QR CODE SETUP ---- */
.totp-setup {
    text-align: center;
    padding: 1.5rem;
}

.totp-setup img {
    border-radius: var(--radius-md);
    margin: 1rem auto;
    background: #fff;
    padding: 0.5rem;
}

.totp-secret {
    font-family: var(--font-mono);
    font-size: 0.95rem;
    background: var(--bg-raised);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    letter-spacing: 0.15em;
    color: var(--accent-text);
    display: inline-block;
    margin: 0.75rem 0;
}

/* ---- UTILITIES ---- */
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-mono { font-family: var(--font-mono); }
.text-sm { font-size: 0.82rem; }
.text-center { text-align: center; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }

.hidden { display: none !important; }

/* ---- LOADING SPINNER ---- */
.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-default);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* ---- RESPONSIVE ---- */
.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 0.5rem;
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
    .sidebar-toggle {
        display: flex;
    }
    .content-body {
        padding: 1.25rem;
    }
    .module-grid {
        grid-template-columns: 1fr;
    }
}

/* ---- ANIMATIONS ---- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.animate-in {
    animation: fadeIn 0.4s var(--ease-out) both;
}

.animate-in:nth-child(2) { animation-delay: 0.05s; }
.animate-in:nth-child(3) { animation-delay: 0.1s; }
.animate-in:nth-child(4) { animation-delay: 0.15s; }
.animate-in:nth-child(5) { animation-delay: 0.2s; }
