/* ==========================================================================
   Board of Directors — Shared Foundation
   Arc-inspired: calm, warm indigo accent, generous spacing, soft shadows
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* --- CSS Variables (Dark — default) --- */
:root {
    --bg: #151518;
    --surface: #1e1e22;
    --surface-raised: #282830;
    --border: #32323c;
    --text: #e8e8ec;
    --text-dim: #8c8c96;
    --accent: #5B5BD6;
    --accent-hover: #6E6EDE;
    --accent-subtle: rgba(91, 91, 214, 0.12);
    --danger: #d95555;
    --success: #5db87a;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.3);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;
}

/* --- Light Theme --- */
[data-theme="light"] {
    --bg: #F9F9F6;
    --surface: #FFFFFF;
    --surface-raised: #F0F0EC;
    --border: #E0E0DA;
    --text: #1a1a1e;
    --text-dim: #6a6a74;
    --accent: #5151CD;
    --accent-hover: #6464D6;
    --accent-subtle: rgba(81, 81, 205, 0.10);
    --danger: #c44040;
    --success: #3a9455;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.10);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3 {
    letter-spacing: -0.01em;
}

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

[data-theme="light"] ::-webkit-scrollbar-thumb { background: #c8c8ce; }
[data-theme="light"] ::-webkit-scrollbar-thumb:hover { background: #a8a8b0; }

/* --- Theme Toggle Button --- */
.btn-theme-toggle {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-dim);
    cursor: pointer;
    padding: 4px 10px;
    font-size: 14px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    line-height: 1;
    z-index: 10;
}
.btn-theme-toggle:hover {
    color: var(--text);
    border-color: var(--text-dim);
}

/* --- Form Inputs --- */
.form-group {
    margin-bottom: 20px;
}
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text-dim);
}
.form-group input {
    width: 100%;
    padding: 11px 14px;
    background: var(--surface-raised);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.form-group input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-subtle);
}
.form-hint {
    font-size: 11px;
    color: var(--text-dim);
    margin-top: 4px;
}

/* --- Submit Button --- */
.btn-submit {
    width: 100%;
    padding: 12px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    margin-top: 8px;
    transition: background 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.1s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn-submit:hover { background: var(--accent-hover); }
.btn-submit:active { transform: scale(0.98); }

/* --- Error Message --- */
.error {
    background: rgba(217, 85, 85, 0.08);
    border: 1px solid rgba(217, 85, 85, 0.25);
    color: #d95555;
    padding: 11px 14px;
    border-radius: var(--radius-md);
    font-size: 13px;
    margin-bottom: 20px;
}

/* --- Divider --- */
.divider {
    display: flex;
    align-items: center;
    margin: 24px 0;
    gap: 12px;
}
.divider::before, .divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}
.divider span {
    font-size: 12px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* --- Google Button --- */
.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 12px;
    background: var(--surface-raised);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn-google:hover {
    background: var(--border);
    border-color: var(--text-dim);
}
[data-theme="light"] .btn-google:hover {
    background: #E4E4DE;
}
.btn-google svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* --- Link --- */
.link {
    text-align: center;
    margin-top: 24px;
    font-size: 13px;
    color: var(--text-dim);
}
.link a {
    color: var(--accent-hover);
    text-decoration: none;
    transition: color 0.15s;
}
.link a:hover { text-decoration: underline; }

/* --- Auth Card (shared between login & signup) --- */
.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 48px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}
.auth-card h1 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 8px;
    text-align: center;
}
.auth-card .blurb {
    font-size: 13px;
    color: var(--text-dim);
    text-align: center;
    line-height: 1.5;
    margin-bottom: 20px;
}
.auth-card .subtitle {
    font-size: 14px;
    color: var(--text-dim);
    text-align: center;
    margin-bottom: 32px;
}

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

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

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

/* --- Spinner --- */
.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

/* --- Modal Overlay --- */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 100;
    align-items: center;
    justify-content: center;
}
.modal-overlay.open { display: flex; animation: fadeIn 0.15s ease; }
[data-theme="light"] .modal-overlay { background: rgba(0,0,0,0.3); }

/* --- Modal Container --- */
.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    width: 480px;
    max-width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
    padding: 28px;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.2s ease;
}
.modal h3 { font-size: 18px; margin-bottom: 12px; }
.modal p { font-size: 13px; color: var(--text-dim); margin-bottom: 16px; line-height: 1.5; }

/* --- Modal Textarea --- */
.modal textarea {
    width: 100%;
    background: var(--surface-raised);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 100px;
    line-height: 1.5;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.modal textarea::placeholder { color: var(--text-dim); }
.modal textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-subtle);
}

/* --- Modal Actions Bar --- */
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 16px;
}

/* --- Modal Buttons --- */
.btn-modal {
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn-modal.primary { background: var(--accent); color: white; }
.btn-modal.primary:hover { background: var(--accent-hover); }
.btn-modal.secondary { background: var(--surface-raised); color: var(--text); border: 1px solid var(--border); }
.btn-modal.secondary:hover { border-color: var(--text-dim); }
.btn-modal:disabled { opacity: 0.4; cursor: not-allowed; }

/* --- Preview Card (in modal) --- */
.preview-card {
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    margin: 16px 0;
}
.preview-card .card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}
.preview-card .card-icon { font-size: 24px; }
.preview-card .card-name { font-size: 15px; font-weight: 600; }
.preview-card .preview-fields { font-size: 12px; color: var(--text-dim); line-height: 1.5; }
.preview-card .preview-fields p { margin-bottom: 6px; }
.preview-card .preview-fields strong { color: var(--text); }

/* --- Generating Spinner --- */
.generating {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px;
    color: var(--text-dim);
    font-size: 14px;
}

/* --- Profile Value Row --- */
.profile-value-row {
    display: flex;
    gap: 4px;
    align-items: center;
}
.profile-value-row input {
    flex: 1;
    background: var(--surface-raised);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 8px;
    font-size: 13px;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.profile-value-row input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-subtle);
}
.btn-remove-value {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 16px;
    padding: 2px 6px;
}
.btn-remove-value:hover { color: var(--danger); }
.btn-add-value {
    font-size: 12px;
    color: var(--accent);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 0;
    margin-top: 4px;
}

/* --- Mobile: shared modal/value-row overrides --- */
@media (max-width: 768px) {
    .modal {
        width: calc(100vw - 24px);
        max-width: calc(100vw - 24px);
    }
    .modal textarea { font-size: 16px; }
    .btn-modal { min-height: 44px; }
    .profile-value-row input { font-size: 16px; }
    .btn-add-value {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    .btn-remove-value {
        min-height: 44px;
        min-width: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}
