/* Dark theme for the gateway pages that use style.css (login, dashboard,
 * settings, admin, usage).
 *
 * Loaded AFTER style.css and only on pages that opt in. Matches the look of
 * projects.html / about.html, which follow adrian.hensler.photography/about:
 * near-black background, Playfair Display (lightest weight Google serves, 400)
 * lowercase headings, Inter body, sand accent, pill buttons, hairline borders.
 *
 * Restyles existing classes only — the class names and IDs that
 * auth.js / dashboard-v4.js / settings.js / admin.js / usage.js depend on
 * are unchanged.
 */

:root {
    --bg-color: #0a0a0a;
    --card-bg: rgba(255, 255, 255, 0.02);
    --text-primary: #f5f5f5;
    --text-secondary: rgba(245, 245, 245, 0.68);
    --border-color: rgba(255, 255, 255, 0.08);
    --primary-color: #e8d5b5;
    --primary-hover: #f1e4cc;
    --accent: #e8d5b5;
    --accent-soft: rgba(232, 213, 181, 0.35);
    --serif: 'Playfair Display', Georgia, serif;
    --sans: 'Inter', system-ui, -apple-system, sans-serif;
    --shadow: none;
    --shadow-lg: none;
    color-scheme: dark;
}

body {
    font-family: var(--sans);
    background: var(--bg-color);
    color: var(--text-primary);
}

a { color: var(--accent); }

:focus-visible {
    outline: 2px solid rgba(232, 213, 181, 0.6);
    outline-offset: 3px;
}

/* ---------- Navigation ---------- */
.navbar {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    box-shadow: none;
    padding: 1.25rem 0;
}

.nav-brand h1 {
    font-family: var(--serif);
    font-weight: 400;
    font-size: 1.6rem;
    letter-spacing: 0.04em;
    text-transform: lowercase;
    color: var(--text-primary);
    opacity: 0.6;
}

.nav-user {
    gap: 0.25rem 1.5rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.username {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Nav buttons read as quiet text links, like the photography site's nav */
.nav-user .btn {
    width: auto;
    padding: 0 0 2px;
    background: none;
    border: none;
    border-bottom: 1px solid transparent;
    border-radius: 0;
    font-family: var(--serif);
    font-weight: 400;
    font-size: 1rem;
    letter-spacing: 0.06em;
    text-transform: lowercase;
    text-decoration: none;
    color: rgba(245, 245, 245, 0.55);
}

.nav-user .btn:hover:not(:disabled) {
    background: none;
    color: rgba(232, 213, 181, 0.75);
    border-bottom-color: rgba(232, 213, 181, 0.3);
}

/* Admin Panel link (injected by dashboard-v4.js as .btn-primary) gets the accent */
.nav-user .btn-primary {
    color: rgba(232, 213, 181, 0.7);
}

/* ---------- Page headers ---------- */
.dashboard-header h2,
.settings-header h2 {
    font-family: var(--serif);
    font-weight: 400;
    font-size: clamp(2rem, 5vw, 3rem);
    letter-spacing: 0.04em;
    text-transform: lowercase;
    color: var(--text-primary);
    opacity: 0.6;
}

.dashboard-header p,
.settings-header p {
    color: var(--text-secondary);
    font-size: 1rem;
}

.settings-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

/* ---------- Buttons ---------- */
.btn {
    border-radius: 999px;
    font-family: var(--sans);
    font-weight: 500;
    font-size: 0.95rem;
    border: 1px solid #444;
    background: transparent;
    color: var(--text-primary);
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.btn-primary,
.btn-secondary {
    background: transparent;
    color: var(--text-primary);
}

a.btn {
    text-decoration: none;
}

.btn-primary:hover:not(:disabled),
.btn-secondary:hover:not(:disabled) {
    background: rgba(232, 213, 181, 0.05);
    border-color: rgba(232, 213, 181, 0.45);
    transform: translateY(-1px);
}

/* The one primary action on a form (e.g. Change Password) gets the sand fill */
.btn-full.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #0a0a0a;
}

.btn-full.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
}

.btn:disabled {
    opacity: 0.35;
}

.btn-action {
    border-radius: 999px;
    background: transparent;
    border: 1px solid #444;
    color: var(--text-primary);
    font-weight: 500;
}

.btn-action-danger {
    border-color: rgba(248, 113, 113, 0.45);
    color: #fca5a5;
}

.btn-action-danger:hover {
    background: rgba(248, 113, 113, 0.1);
}

/* ---------- Dashboard cards ---------- */
.services-grid {
    gap: 1.25rem;
}

.service-card {
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 1.75rem;
    box-shadow: none;
}

.service-card:not(.service-card-placeholder):hover {
    transform: translateY(-2px);
    box-shadow: none;
    border-color: var(--accent-soft);
    background: rgba(232, 213, 181, 0.03);
}

.service-card-placeholder {
    border: 1px dashed var(--border-color);
    background: transparent;
}

.service-icon {
    font-size: 2rem;
    margin-bottom: 0.75rem;
    filter: saturate(0.6);
    opacity: 0.85;
}

.service-card h3 {
    font-family: var(--serif);
    font-weight: 400;
    font-size: 1.35rem;
    letter-spacing: 0.03em;
    text-transform: lowercase;
    color: rgba(245, 245, 245, 0.88);
}

.service-card p {
    color: var(--text-secondary);
    flex: 1;
}

.service-status {
    align-self: flex-start;
    font-weight: 500;
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    text-transform: lowercase;
    background: transparent;
    border: 1px solid;
}

.status-active {
    background: transparent;
    color: rgba(134, 239, 172, 0.8);
    border-color: rgba(134, 239, 172, 0.3);
}

.status-coming-soon {
    background: transparent;
    color: rgba(245, 245, 245, 0.45);
    border-color: rgba(245, 245, 245, 0.15);
}

.card-github-link {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border-color);
}

.card-github-link:hover {
    background: rgba(232, 213, 181, 0.05);
    border-color: var(--accent-soft);
    color: var(--accent);
}

/* Cost / "built so far" lines under the header */
#costPanel {
    text-align: center;
    color: var(--text-secondary);
}

#costPanel a {
    text-decoration: none;
    border-bottom: 1px solid rgba(232, 213, 181, 0.3);
}

/* ---------- Settings ---------- */
.settings-section {
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border-color);
    border-radius: 0;
    box-shadow: none;
    padding: 2rem 0 2.5rem;
    margin-bottom: 0;
}

.settings-section:last-child {
    border-bottom: none;
}

.settings-section h3,
.section-header h3 {
    font-family: var(--serif);
    font-weight: 400;
    font-size: 1.5rem;
    letter-spacing: 0.04em;
    text-transform: lowercase;
    color: var(--text-primary);
    opacity: 0.6;
}

.info-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.info-label {
    font-weight: 500;
}

.badge-admin,
.badge-user {
    background: transparent;
    border: 1px solid var(--accent-soft);
    color: var(--accent);
    font-weight: 500;
}

.form-group label {
    color: var(--text-secondary);
    font-weight: 500;
}

.form-input,
.form-group input {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    color: var(--text-primary);
    font-family: var(--sans);
}

.form-input::placeholder {
    color: rgba(245, 245, 245, 0.3);
}

.form-input:focus,
.form-group input:focus {
    border-color: rgba(232, 213, 181, 0.6);
    box-shadow: 0 0 0 3px rgba(232, 213, 181, 0.12);
}

/* Must out-rank `.form-group input` and the focus rule above, or a mismatched
   confirm-password field stops looking invalid (especially while focused). */
.form-group input.input-error,
.form-group input.input-error:focus {
    border-color: rgba(248, 113, 113, 0.7);
}

.form-group input.input-error:focus {
    box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.15);
}

/* Tables (active sessions) */
.admin-table thead {
    background: transparent;
}

.admin-table th {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border-color);
}

.admin-table td {
    border-bottom: 1px solid var(--border-color);
    color: rgba(245, 245, 245, 0.82);
}

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

/* style.css makes .actions-cell a flex box, which pulls that cell out of the
   table row and misaligns its bottom border; keep it a real table cell. */
.admin-table td.actions-cell {
    display: table-cell;
}

.section-header {
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
}

/* Messages */
.message-success {
    background: rgba(16, 185, 129, 0.1);
    color: #86efac;
    border-color: rgba(16, 185, 129, 0.4);
}

.message-error {
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.4);
}

.message-info {
    background: rgba(232, 213, 181, 0.06);
    color: var(--accent);
    border-color: var(--accent-soft);
}

/* ---------- Login ---------- */
.login-card {
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-shadow: none;
}

.logo h1 {
    font-family: var(--serif);
    font-weight: 400;
    font-size: clamp(2rem, 7vw, 2.6rem);
    letter-spacing: 0.05em;
    text-transform: lowercase;
    color: var(--text-primary);
    opacity: 0.6;
}

.tagline {
    font-family: var(--serif);
    font-size: 1.05rem;
    letter-spacing: 0.12em;
    text-transform: lowercase;
    color: var(--text-primary);
    opacity: 0.5;
}

.auth-form h2 {
    font-family: var(--serif);
    font-weight: 400;
    font-size: 1.5rem;
    letter-spacing: 0.04em;
    text-transform: lowercase;
    color: var(--text-primary);
    opacity: 0.6;
}

/* Sign In is the page's one primary action */
.auth-form .btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #0a0a0a;
}

.auth-form .btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
}

.form-toggle {
    border-top-color: var(--border-color);
}

.form-toggle p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.error-message {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.4);
    color: #fca5a5;
}

/* ---------- Admin panel ---------- */
.admin-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.admin-header h2 {
    font-family: var(--serif);
    font-weight: 400;
    font-size: clamp(2rem, 5vw, 3rem);
    letter-spacing: 0.04em;
    text-transform: lowercase;
    color: var(--text-primary);
    opacity: 0.6;
}

.admin-header p {
    color: var(--text-secondary);
}

.admin-section {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    border-radius: 0;
    box-shadow: none;
    padding: 2rem 0 2.5rem;
    margin-bottom: 0;
}

.admin-section:last-child {
    border-bottom: none;
}

.section-note {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: -0.5rem 0 1.25rem;
    max-width: 70ch;
}

.section-note strong {
    color: var(--text-primary);
    font-weight: 500;
}

.admin-form {
    max-width: 500px;
}

.admin-form > .form-hint {
    margin-top: 0.75rem;
}

.btn-action-primary {
    border-color: var(--accent-soft);
    color: var(--accent);
}

.btn-action-primary:hover,
.btn-action-secondary:hover {
    background: rgba(232, 213, 181, 0.06);
}

.btn-action-success {
    border-color: rgba(134, 239, 172, 0.4);
    color: #86efac;
}

.btn-action-success:hover {
    background: rgba(134, 239, 172, 0.08);
}

.badge.status-active {
    border: 1px solid rgba(134, 239, 172, 0.3);
}

.status-disabled {
    background: transparent;
    color: #fca5a5;
    border: 1px solid rgba(248, 113, 113, 0.35);
}

.row-disabled td {
    opacity: 0.5;
}

/* Access matrix: one pill per user/service cell */
.access-table th,
.access-table td {
    white-space: nowrap;
    text-align: center;
    padding: 0.75rem 0.4rem;
}

.access-table th {
    font-size: 0.7rem;
}

.access-table th:first-child,
.access-table td:first-child {
    text-align: left;
}

.access-cell {
    min-width: 5.25rem;
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
    border: 1px solid;
    background: transparent;
    font-family: var(--sans);
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease;
}

.access-open {
    color: rgba(245, 245, 245, 0.7);
    border-color: rgba(245, 245, 245, 0.18);
}

.access-allowed {
    color: #86efac;
    border-color: rgba(134, 239, 172, 0.4);
}

.access-denied {
    color: rgba(245, 245, 245, 0.4);
    border-color: rgba(245, 245, 245, 0.1);
    border-style: dashed;
}

.access-blocked {
    color: #fca5a5;
    border-color: rgba(248, 113, 113, 0.45);
}

.access-cell:hover {
    background: rgba(232, 213, 181, 0.06);
}

.access-admin-note {
    color: var(--text-secondary);
    font-style: italic;
}

/* Confirmation modal */
.modal {
    background: rgba(0, 0, 0, 0.7);
}

.modal-content {
    background: #141414;
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

.modal-content h3 {
    font-family: var(--serif);
    font-weight: 400;
    text-transform: lowercase;
    letter-spacing: 0.03em;
}

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}

@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: 0.75rem;
    }

    .nav-user {
        justify-content: center;
    }
}
