/**
 * Bibelleseplan — Component stylesheet
 * Design: iOS Human Interface Guidelines + Material Design
 */

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

/* ── Base ───────────────────────────────────────────────── */
html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont,
                 'SF Pro Text', 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── Header & navigation ────────────────────────────────── */
header {
    background: var(--bg-blur);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--separator);
    height: 56px;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
    gap: 1rem;
}

.logo {
    font-size: 1.0625rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: var(--text-primary);
    text-decoration: none;
    white-space: nowrap;
}
.logo:hover { opacity: 0.72; }

/* Right side of nav: links + theme toggle */
.nav-end {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    flex-shrink: 0;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.125rem;
    list-style: none;
}

.nav-links a {
    display: inline-block;
    color: var(--accent);
    text-decoration: none;
    font-size: 0.9375rem;
    font-weight: 500;
    padding: 0.4375rem 0.75rem;
    border-radius: 8px;
}
.nav-links a:hover {
    background: var(--bg-hover);
    color: var(--accent-hover);
}

/* ── Main layout ────────────────────────────────────────── */
main {
    flex: 1;
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
    padding: 1.5rem 1.5rem 4rem;
}

/* ── Cards ──────────────────────────────────────────────── */
.card {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--separator);
}

.card-header {
    font-size: 1.0625rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    margin-bottom: 1.25rem;
    padding-bottom: 0.875rem;
    border-bottom: 1px solid var(--separator);
}

/* ── Buttons ────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 44px;
    padding: 0 1.25rem;
    background: var(--accent);
    color: #ffffff;
    border: none;
    border-radius: 12px;
    font-size: 0.9375rem;
    font-weight: 600;
    font-family: inherit;
    letter-spacing: -0.01em;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    transition: opacity 0.15s ease, transform 0.1s ease;
}
.btn:hover  { opacity: 0.85; }
.btn:active { opacity: 0.68; transform: scale(0.97); }

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}
.btn-danger {
    background: var(--color-red);
    color: #ffffff;
}
.btn-sm {
    min-height: 34px;
    padding: 0 0.875rem;
    font-size: 0.875rem;
    border-radius: 9px;
}
.btn-full { width: 100%; }

/* ── Form elements ──────────────────────────────────────── */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

/* Apply to bare selects (plan page) AND to .form-group children */
select,
.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    min-height: 44px;
    padding: 0.6875rem 1rem;
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

/* Restore native select arrow */
select,
.form-group select {
    -webkit-appearance: auto;
    appearance: auto;
    cursor: pointer;
}

select:focus,
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-group textarea {
    resize: vertical;
    min-height: 110px;
    line-height: 1.6;
    padding-top: 0.75rem;
}

/* ── Alert / message banners ────────────────────────────── */
.message {
    padding: 0.875rem 1.125rem;
    border-radius: 12px;
    margin-bottom: 1rem;
    font-size: 0.9375rem;
    font-weight: 500;
}

.message-success {
    background: rgba(50, 215, 75, 0.14);
    color: var(--color-green);
    border: 1px solid rgba(50, 215, 75, 0.25);
}
.message-error {
    background: rgba(255, 69, 58, 0.12);
    color: var(--color-red);
    border: 1px solid rgba(255, 69, 58, 0.22);
}
.message-info {
    background: rgba(10, 132, 255, 0.10);
    color: var(--accent);
    border: 1px solid rgba(10, 132, 255, 0.20);
}

[data-theme="light"] .message-success {
    color: #1a7a2e;
    background: rgba(52, 199, 89, 0.10);
    border-color: rgba(52, 199, 89, 0.22);
}
[data-theme="light"] .message-error {
    color: #c0392b;
    background: rgba(255, 59, 48, 0.08);
    border-color: rgba(255, 59, 48, 0.20);
}
[data-theme="light"] .message-info {
    color: #0062cc;
    background: rgba(0, 122, 255, 0.07);
    border-color: rgba(0, 122, 255, 0.18);
}

/* ── Auth layout (login page) ───────────────────────────── */
.auth-layout {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 56px);
    padding: 2rem 1.5rem;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-secondary);
    border-radius: 20px;
    padding: 2.5rem 2rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--separator);
}

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

.auth-icon {
    font-size: 2.75rem;
    display: block;
    margin-bottom: 0.875rem;
    line-height: 1;
}

.auth-title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    margin-bottom: 0.375rem;
}

.auth-subtitle {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ── Home: verse container ──────────────────────────────── */
.verse-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem 0 2rem;
}

.verse-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 1.25rem;
    align-self: flex-start;
}

.verse-content {
    width: min(920px, 96%);
    max-width: 920px;
    font-size: 1.25rem;
    line-height: 1.8;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
    min-height: 520px;
    box-shadow: var(--card-shadow);
    text-align: left;
}

.verse-content iframe {
    border: none;
    background: transparent;
    width: 100%;
    min-height: 480px;
}

[data-theme="dark"] .verse-content iframe {
    filter: invert(1) hue-rotate(180deg) brightness(1.08) contrast(0.95);
}

/* ── Plan page: week/year selector ─────────────────────── */
.plan-selector {
    margin-bottom: 1.5rem;
}

.selector-row {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.selector-row .form-group {
    flex: 1;
    min-width: 110px;
    margin-bottom: 0;
}

/* ── Plan content ───────────────────────────────────────── */
.plan-header {
    margin-bottom: 1.5rem;
}

.plan-week {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.plan-heading {
    font-size: 1.625rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.2;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.plan-intro {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* ── Plan: day card ─────────────────────────────────────── */
.plan-day {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 0.75rem;
    border: 1px solid var(--separator);
    box-shadow: var(--card-shadow);
}

.day-header {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
    margin-bottom: 1rem;
}

/* ── Verse chips ────────────────────────────────────────── */
.day-verses {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.verse-link {
    display: inline-flex;
    align-items: center;
    padding: 0.4375rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--accent);
    text-decoration: none;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
    -webkit-tap-highlight-color: transparent;
}
.verse-link:hover  { background: var(--accent); color: #ffffff; border-color: var(--accent); }
.verse-link:active { transform: scale(0.95); }

/* ── Video embed ─────────────────────────────────────────── */
.day-video {
    margin: 1.25rem 0;
}
.day-video h3 {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}
.day-video iframe {
    width: 100%;
    max-width: 560px;
    height: 315px;
    border: none;
    border-radius: 12px;
}

/* ── Reflection questions ───────────────────────────────── */
.day-questions {
    margin-top: 1.25rem;
}
.day-questions h3 {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.question-item {
    padding: 1rem 1.125rem;
    background: var(--bg-tertiary);
    border-radius: 12px;
    margin-bottom: 0.5rem;
}
.question-text {
    font-size: 1rem;
    color: var(--text-primary);
    line-height: 1.65;
    margin-bottom: 0.5rem;
}
.question-references {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

/* ── Notes ──────────────────────────────────────────────── */
.notes-section {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--separator);
}
.notes-section h3 {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.notes-textarea {
    width: 100%;
    min-height: 130px;
    padding: 0.875rem 1rem;
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 0.9375rem;
    font-family: inherit;
    line-height: 1.6;
    resize: vertical;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    margin-bottom: 0.75rem;
}
.notes-textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.notes-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.notes-saved {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-green);
    display: none;
}
.notes-saved.show { display: inline; }

/* ── Admin panel ────────────────────────────────────────── */
.admin-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 1rem;
}
.admin-controls h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.day-form {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.25rem;
    margin-bottom: 0.75rem;
}

.verse-form {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto auto;
    gap: 0.625rem;
    margin-bottom: 0.75rem;
    align-items: end;
}
.verse-form-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    min-height: 44px;
}
.verse-form-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    min-height: unset;
    accent-color: var(--accent);
    cursor: pointer;
}

.question-form-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.75rem;
    align-items: start;
}

/* ── Loading spinner ────────────────────────────────────── */
.loading {
    display: inline-block;
    width: 22px;
    height: 22px;
    border: 2.5px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 768px) {
    header { padding: 0 1rem; }

    main { padding: 1rem 1rem 4rem; }

    .nav-links a {
        padding: 0.375rem 0.5rem;
        font-size: 0.875rem;
    }

    .plan-heading { font-size: 1.375rem; }

    .verse-content {
        font-size: 1.1rem;
        min-height: 460px;
        padding: 1rem;
    }

    .selector-row { flex-direction: column; align-items: stretch; }
    .selector-row .form-group { min-width: unset; }

    .verse-form { grid-template-columns: 1fr; }
    .question-form-row { grid-template-columns: 1fr; }

    .admin-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .auth-card { padding: 2rem 1.5rem; }
}

@media (max-width: 480px) {
    .logo { font-size: 1rem; }
    .nav-links a { font-size: 0.8125rem; padding: 0.375rem 0.4375rem; }
}

/* ── Dev footer ─────────────────────────────────────────── */
.dev-footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--separator);
    padding: 1rem 1.5rem 1.5rem;
    font-size: 0.6875rem;
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
    color: var(--text-muted);
    margin-top: auto;
}

.dev-footer-inner {
    max-width: 960px;
    margin: 0 auto;
}

.dev-footer-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.625rem;
    border-bottom: 1px solid var(--separator);
}

.dev-copyright {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.01em;
}

.dev-latest-label {
    color: var(--text-muted);
}

#dev-latest {
    color: var(--accent);
}

.dev-timestamps {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 0 2rem;
}

.dev-file-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.2rem 0;
    border-bottom: 1px solid var(--separator);
}

.dev-file-name { color: var(--text-secondary); }
.dev-file-time { color: var(--text-muted); text-align: right; }

/* ── Utilities ──────────────────────────────────────────── */
.text-center { text-align: center; }
.hidden { display: none !important; }

.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; }
