/* Modern system font stack */
:root {
    --pico-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --pico-font-size: 15px;
    --pico-line-height: 1.6;
    --pico-border-radius: 8px;

    /* Custom colors - Vercel inspired */
    --bg-primary: #fafafa;
    --bg-card: #ffffff;
    --border-color: #eaeaea;
    --text-primary: #171717;
    --text-secondary: #666666;
    --accent: #0070f3;
    --success: #0070f3;
    --warning: #f5a623;
    --danger: #ee0000;
}

* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background: var(--bg-primary);
}

/* Dark navbar */
.navbar {
    background: var(--text-primary);
    border-bottom: 1px solid #333;
    padding: 0 1.5rem;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0;
}

.navbar ul {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.navbar li {
    padding: 0;
}

.navbar .brand {
    color: #fff;
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
}

.navbar a {
    color: #888;
    font-size: 0.875rem;
    text-decoration: none;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
}

.navbar a:hover {
    color: #fff;
    background: rgba(255,255,255,0.1);
}

/* Main container */
main.container {
    max-width: 1000px;
    padding: 2rem 1.5rem;
}

/* Page header */
.page-header {
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.25rem 0;
}

.page-header p {
    color: var(--text-secondary);
    margin: 0;
    font-size: 0.95rem;
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--pico-border-radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

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

.card-header h2 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
}

/* Stats grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--pico-border-radius);
    padding: 1.25rem 1.5rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.stat-card .label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    margin-bottom: 0.5rem;
}

.stat-card .value {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1;
}

.stat-card .value.success { color: var(--success); }
.stat-card .value.warning { color: var(--warning); }
.stat-card .value.danger { color: var(--danger); }

/* Status indicator */
.status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.status::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-secondary);
}

.status.success::before { background: var(--success); }
.status.warning::before { background: var(--warning); }
.status.danger::before { background: var(--danger); }

/* Action buttons grid */
.actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.75rem;
}

.actions-grid a,
.actions-grid button {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.15s;
    cursor: pointer;
    border: none;
}

.btn-primary {
    background: var(--text-primary);
    color: #fff;
}

.btn-primary:hover {
    background: #333;
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

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

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

.btn-danger:hover {
    background: #cc0000;
}

.btn-link {
    background: none;
    border: none;
    color: #888;
    font-size: 0.875rem;
    text-decoration: none;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
    font-family: inherit;
    width: auto;
}

.btn-link:hover {
    color: #fff;
    background: rgba(255,255,255,0.1);
}

/* Auth layout */
.auth-layout {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
    background: var(--bg-primary);
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--pico-border-radius);
    padding: 2rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.auth-card header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.auth-card h1 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 0.25rem 0;
}

.auth-card header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 0;
}

.auth-card footer {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.auth-card footer a {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Forms */
label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.375rem;
}

input:not([type="checkbox"]) {
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.625rem 0.875rem;
    font-size: 0.9375rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus {
    border-color: var(--text-primary);
    box-shadow: 0 0 0 1px var(--text-primary);
    outline: none;
}

button[type="submit"] {
    width: 100%;
    background: var(--text-primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0.75rem 1rem;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}

button[type="submit"]:hover {
    background: #333;
}

/* Code input */
input.code {
    text-align: center;
    font-size: 1.25rem;
    letter-spacing: 0.3em;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
}

/* QR code */
.qr-code {
    text-align: center;
    padding: 1.5rem;
    background: var(--bg-primary);
    border-radius: var(--pico-border-radius);
    margin: 1.5rem 0;
}

.qr-code img {
    border-radius: 6px;
}

.qr-code .secret {
    margin-top: 1rem;
    padding: 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-family: ui-monospace, SFMono-Regular, monospace;
    font-size: 0.8rem;
    word-break: break-all;
    color: var(--text-secondary);
}

/* Backup codes */
.backup-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    margin: 1.5rem 0;
}

.backup-grid code {
    display: block;
    text-align: center;
    padding: 0.75rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-family: ui-monospace, SFMono-Regular, monospace;
    font-size: 0.9rem;
}

/* Alerts */
.alert {
    padding: 0.875rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.alert-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}

.alert-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #15803d;
}

/* Details/Accordion */
details {
    border: 1px solid var(--border-color);
    border-radius: var(--pico-border-radius);
    padding: 1rem;
    margin-top: 1.5rem;
}

details summary {
    font-weight: 500;
    cursor: pointer;
    color: var(--text-secondary);
}

details[open] summary {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

/* Checkbox */
label:has(input[type="checkbox"]) {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    font-weight: 400;
}

input[type="checkbox"] {
    margin-top: 0.125rem;
}

/* Steps list */
ol {
    padding-left: 1.25rem;
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

ol li {
    padding: 0.25rem 0;
}

/* Icon */
.icon-lg {
    font-size: 2.5rem;
    line-height: 1;
    margin-bottom: 1rem;
}

/* Link */
a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Small text */
small {
    color: var(--text-secondary);
}

/* Disabled button */
button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ==================== */
/* Mobile Responsive    */
/* ==================== */

@media (max-width: 768px) {
    /* Navbar */
    .navbar {
        padding: 0 1rem;
        height: 56px;
    }

    .navbar .brand {
        font-size: 0.875rem;
    }

    .navbar ul {
        gap: 0.25rem;
    }

    .navbar a {
        font-size: 0.8rem;
        padding: 0.375rem 0.5rem;
    }

    /* Main container */
    main.container {
        padding: 1.25rem 1rem;
    }

    /* Page header */
    .page-header {
        margin-bottom: 1.5rem;
    }

    .page-header h1 {
        font-size: 1.5rem;
    }

    /* Stats grid - stack on mobile */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .stat-card {
        padding: 1rem 1.25rem;
    }

    .stat-card .value {
        font-size: 1.5rem;
    }

    /* Cards */
    .card {
        padding: 1.25rem;
        margin-bottom: 1.25rem;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    /* Actions grid - stack on mobile */
    .actions-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    /* Auth layout */
    .auth-layout {
        padding: 1rem;
        align-items: flex-start;
        padding-top: 3rem;
    }

    .auth-card {
        padding: 1.5rem;
    }

    .auth-card h1 {
        font-size: 1.125rem;
    }

    /* QR code */
    .qr-code {
        padding: 1rem;
    }

    .qr-code img {
        width: 160px;
        height: 160px;
    }

    /* Backup codes - smaller text */
    .backup-grid {
        gap: 0.375rem;
    }

    .backup-grid code {
        padding: 0.625rem;
        font-size: 0.8rem;
    }

    /* Forms */
    input.code {
        font-size: 1.125rem;
        letter-spacing: 0.25em;
    }

    /* Details */
    details {
        padding: 0.875rem;
    }
}

@media (max-width: 480px) {
    /* Very small screens */
    .navbar .brand {
        font-size: 0.8rem;
    }

    .navbar a {
        font-size: 0.75rem;
        padding: 0.25rem 0.375rem;
    }

    .page-header h1 {
        font-size: 1.25rem;
    }

    .stat-card .label {
        font-size: 0.7rem;
    }

    .stat-card .value {
        font-size: 1.25rem;
    }

    /* Stack backup codes on very small screens */
    .backup-grid {
        grid-template-columns: 1fr;
    }
}
