/* ==========================================================================
   Spiritual Warfare Verses - Global Styles
   - Uses CSS variables for font scaling and themes
   - Ensure all font sizes are in rem or inherit from html
   ========================================================================== */

:root {
    --font-base: 16px;
    --font-scale: 1;

    /* Shared color tokens (overridden per theme as needed) */
    --color-bg: #020617;
    --color-surface: #0b1120;
    --color-surface-soft: rgba(15, 23, 42, 0.9);
    --color-border: rgba(148, 163, 184, 0.7);
    --color-text: #e5e7eb;
    --color-muted: #9ca3af;
    --color-accent: #38bdf8;
    --color-accent-soft: rgba(56, 189, 248, 0.18);
    --color-error: #f87171;
    --color-success: #4ade80;
    --color-warning: #facc15;
    --shadow-soft: 0 18px 35px rgba(15, 23, 42, 0.55);
    --shadow-subtle: 0 12px 30px rgba(15, 23, 42, 0.45);

    --radius-lg: 1.5rem;
    --radius-md: 1rem;
    --radius-pill: 9999px;

    --transition-fast: 0.15s ease-out;
    --transition-medium: 0.25s ease-out;
}

/* HTML font scaling: all other font sizes use rem */
html {
    font-size: calc(var(--font-base) * var(--font-scale));
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Lato', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 1rem;
    background-color: var(--color-bg);
    color: var(--color-text);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* -------------------------- Theme Definitions -------------------------- */

/* Default: Dark Mode Sky Blue */
body[data-theme="dark-sky-blue"] {
    --color-bg: #020617;
    --color-surface: #020617;
    --color-surface-soft: rgba(15, 23, 42, 0.9);
    --color-border: rgba(148, 163, 184, 0.5);
    --color-text: #e5e7eb;
    --color-muted: #9ca3af;
    --color-accent: #38bdf8;
    --color-accent-soft: rgba(56, 189, 248, 0.18);
    --shadow-soft: 0 18px 40px rgba(8, 47, 73, 0.7);
    --shadow-subtle: 0 12px 25px rgba(15, 23, 42, 0.6);
}

/* Dark Emerald */
body[data-theme="dark-emerald"] {
    --color-bg: #022c22;
    --color-surface: #022c22;
    --color-surface-soft: rgba(4, 47, 46, 0.96);
    --color-border: rgba(52, 211, 153, 0.45);
    --color-text: #ecfdf5;
    --color-muted: #a7f3d0;
    --color-accent: #34d399;
    --color-accent-soft: rgba(16, 185, 129, 0.22);
    --shadow-soft: 0 18px 40px rgba(4, 120, 87, 0.7);
    --shadow-subtle: 0 12px 25px rgba(6, 95, 70, 0.6);
}

/* Dark Amber */
body[data-theme="dark-amber"] {
    --color-bg: #111827;
    --color-surface: #111827;
    --color-surface-soft: rgba(17, 24, 39, 0.94);
    --color-border: rgba(251, 191, 36, 0.52);
    --color-text: #fefce8;
    --color-muted: #facc15;
    --color-accent: #fbbf24;
    --color-accent-soft: rgba(245, 158, 11, 0.2);
    --shadow-soft: 0 18px 40px rgba(120, 53, 15, 0.75);
    --shadow-subtle: 0 12px 25px rgba(146, 64, 14, 0.6);
}

/* Dark Rose */
body[data-theme="dark-rose"] {
    --color-bg: #111827;
    --color-surface: #111827;
    --color-surface-soft: rgba(31, 41, 55, 0.9);
    --color-border: rgba(244, 114, 182, 0.5);
    --color-text: #fdf2f8;
    --color-muted: #fb7185;
    --color-accent: #fb7185;
    --color-accent-soft: rgba(244, 114, 182, 0.18);
    --shadow-soft: 0 18px 40px rgba(136, 19, 55, 0.7);
    --shadow-subtle: 0 12px 25px rgba(159, 18, 57, 0.6);
}

/* Light Sky */
body[data-theme="light-sky"] {
    --color-bg: #e5f2ff;
    --color-surface: #f9fbff;
    --color-surface-soft: rgba(255, 255, 255, 0.96);
    --color-border: rgba(148, 163, 184, 0.6);
    --color-text: #0f172a;
    --color-muted: #4b5563;
    --color-accent: #0284c7;
    --color-accent-soft: rgba(56, 189, 248, 0.25);
    --shadow-soft: 0 18px 40px rgba(15, 23, 42, 0.18);
    --shadow-subtle: 0 12px 25px rgba(15, 23, 42, 0.12);
}

/* Light Emerald */
body[data-theme="light-emerald"] {
    --color-bg: #ecfdf5;
    --color-surface: #f9fffb;
    --color-surface-soft: rgba(255, 255, 255, 0.97);
    --color-border: rgba(52, 211, 153, 0.4);
    --color-text: #064e3b;
    --color-muted: #475569;
    --color-accent: #059669;
    --color-accent-soft: rgba(16, 185, 129, 0.2);
    --shadow-soft: 0 18px 40px rgba(15, 118, 110, 0.2);
    --shadow-subtle: 0 12px 25px rgba(5, 150, 105, 0.18);
}

/* Light Amber */
body[data-theme="light-amber"] {
    --color-bg: #fffbeb;
    --color-surface: #fffbeb;
    --color-surface-soft: rgba(255, 251, 235, 0.98);
    --color-border: rgba(245, 158, 11, 0.4);
    --color-text: #78350f;
    --color-muted: #4b5563;
    --color-accent: #f59e0b;
    --color-accent-soft: rgba(245, 158, 11, 0.26);
    --shadow-soft: 0 18px 40px rgba(146, 64, 14, 0.24);
    --shadow-subtle: 0 12px 25px rgba(120, 53, 15, 0.2);
}

/* Light Rose */
body[data-theme="light-rose"] {
    --color-bg: #fdf2f8;
    --color-surface: #fdf2f8;
    --color-surface-soft: rgba(255, 255, 255, 0.98);
    --color-border: rgba(244, 114, 182, 0.4);
    --color-text: #831843;
    --color-muted: #4b5563;
    --color-accent: #ec4899;
    --color-accent-soft: rgba(244, 114, 182, 0.25);
    --shadow-soft: 0 18px 40px rgba(157, 23, 77, 0.25);
    --shadow-subtle: 0 12px 25px rgba(190, 24, 93, 0.2);
}

/* ---------------------------- Layout Shell ----------------------------- */

.app-root {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding: 1.25rem;
}

.app-header {
    margin-bottom: 1.25rem;
}

.header-inner {
    max-width: 56rem;
    margin: 0 auto;
    padding: 1.5rem 1.75rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    background: radial-gradient(circle at top left, var(--color-accent-soft), var(--color-surface));
    box-shadow: var(--shadow-soft);
}

.header-title-group {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.app-title {
    font-family: 'Gabriela', 'Times New Roman', serif;
    font-size: 2.1rem;
    font-weight: 400;
    letter-spacing: 0.03em;
    text-align: center;
    color: var(--color-text);
    text-shadow: 0 4px 14px rgba(15, 23, 42, 0.75);
    margin: 0;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.app-subtitle {
    margin: 0.85rem auto 0;
    text-align: center;
    font-size: 1rem;
    max-width: 40rem;
    color: var(--color-muted);
}

.app-main {
    flex: 1 0 auto;
    max-width: 56rem;
    width: 100%;
    margin: 0 auto 1.5rem;
}

.app-footer {
    max-width: 56rem;
    width: 100%;
    margin: 0 auto;
    padding: 0.75rem 1.25rem 1.25rem;
}

.footer-text {
    margin: 0;
    text-align: center;
    font-size: 0.9rem;
    color: var(--color-muted);
}

/* ----------------------------- Sections -------------------------------- */

.verses-section {
    margin-bottom: 1.5rem;
    padding: 1.25rem 1.5rem;
    border-radius: var(--radius-lg);
    background-color: var(--color-surface-soft);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-subtle);
    backdrop-filter: blur(16px);
}

.verses-section-error {
    border-color: var(--color-error);
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.section-header-left,
.section-header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-title {
    margin: 0;
    font-family: 'Gabriela', 'Times New Roman', serif;
    font-size: 1.5rem;
    letter-spacing: 0.02em;
    color: var(--color-text);
}

.section-description {
    margin: 0.75rem 0 1rem;
    font-size: 0.98rem;
    color: var(--color-muted);
}

.section-content {
    margin-top: 0.5rem;
}

.section-content.is-collapsed {
    display: none;
}

.section-empty-state {
    margin: 0.75rem 0 0.25rem;
    font-size: 0.96rem;
    color: var(--color-muted);
}

/* ------------------------------ Verses --------------------------------- */

.verses-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
}

.verse-card {
    border-radius: var(--radius-md);
    background: linear-gradient(
        135deg,
        rgba(15, 23, 42, 0.95),
        rgba(15, 23, 42, 0.85)
    );
    border: 1px solid rgba(148, 163, 184, 0.65);
    padding: 0.9rem 1rem 1rem;
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.7);
    position: relative;
    overflow: hidden;
}

body[data-theme^="light"] .verse-card {
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.98),
        rgba(249, 250, 251, 0.96)
    );
    border-color: rgba(148, 163, 184, 0.45);
    box-shadow: 0 14px 28px rgba(148, 163, 184, 0.4);
}

.verse-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top right, var(--color-accent-soft), transparent 55%);
    opacity: 0.9;
    pointer-events: none;
}

.verse-card > * {
    position: relative;
    z-index: 1;
}

.verse-reference {
    margin: 0;
    text-align: center;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-accent);
}

.verse-summary {
    margin: 0.5rem 0 0.75rem;
    text-align: center;
    font-size: 0.98rem;
    color: var(--color-text);
}

.verse-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.verse-full-text {
    margin: 0.2rem 0 0;
    padding-top: 0.5rem;
    border-top: 1px dashed rgba(148, 163, 184, 0.6);
    font-size: 0.96rem;
    line-height: 1.6;
    color: var(--color-text);
    display: none;
}

.verse-full-text.is-visible {
    display: block;
}

/* ------------------------------- Buttons -------------------------------- */

.btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.45rem 0.9rem;
    border-radius: var(--radius-pill);
    border: 1px solid transparent;
    background-color: var(--color-accent-soft);
    color: var(--color-accent);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    cursor: pointer;
    text-decoration: none;
    outline: none;
    transition:
        background-color var(--transition-fast),
        box-shadow var(--transition-fast),
        transform 0.12s ease-out,
        border-color var(--transition-fast),
        color var(--transition-fast);
    box-shadow: 0 10px 18px rgba(15, 23, 42, 0.45);
    -webkit-tap-highlight-color: transparent;
}

.btn:focus-visible {
    box-shadow: 0 0 0 0.12rem rgba(56, 189, 248, 0.7);
}

.btn-primary {
    background-color: var(--color-accent);
    color: #020617;
    border-color: rgba(15, 23, 42, 0.75);
}

.btn-primary:hover {
    background-color: #0ea5e9;
}

.btn-secondary {
    background-color: rgba(15, 23, 42, 0.8);
    color: var(--color-text);
    border-color: rgba(148, 163, 184, 0.7);
}

body[data-theme^="light"] .btn-secondary {
    background-color: rgba(248, 250, 252, 0.9);
    color: var(--color-text);
}

.btn-secondary:hover {
    background-color: rgba(30, 64, 175, 0.7);
}

body[data-theme^="light"] .btn-secondary:hover {
    background-color: rgba(226, 232, 240, 0.9);
}

.btn-outline {
    background-color: transparent;
    color: var(--color-accent);
    border-color: rgba(56, 189, 248, 0.6);
}

.btn-outline:hover {
    background-color: var(--color-accent-soft);
}

.btn-ghost {
    background-color: transparent;
    border-color: transparent;
    color: var(--color-accent);
    box-shadow: none;
}

.btn-ghost:hover {
    background-color: rgba(15, 23, 42, 0.6);
}

body[data-theme^="light"] .btn-ghost:hover {
    background-color: rgba(148, 163, 184, 0.14);
}

/* Hover and active states (with animated click) */
.btn:hover {
    transform: translateY(-0.05rem);
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.55);
}

.btn:active {
    transform: translateY(10px);
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.7);
}

/* --------------------------- Error Messages ---------------------------- */

.error-message {
    margin: 1rem auto;
    max-width: 40rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    background-color: rgba(248, 113, 113, 0.16);
    border: 1px solid rgba(248, 113, 113, 0.9);
    color: #fecaca;
    text-align: center;
}

/* ---------------------------- Debug Indicator -------------------------- */

.debug-indicator {
    position: fixed;
    left: 50%;
    bottom: 0.75rem;
    transform: translateX(-50%);
    padding: 0.3rem 0.9rem;
    border-radius: var(--radius-pill);
    background-color: rgba(248, 113, 113, 0.95);
    color: #111827;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    z-index: 40;
    box-shadow: 0 10px 25px rgba(127, 29, 29, 0.75);
}

/* ------------------------------ Responsive ----------------------------- */

@media (max-width: 768px) {
    .app-root {
        padding: 0.8rem;
    }

    .header-inner {
        padding: 1.1rem 1.1rem;
    }

    .app-title {
        font-size: 1.7rem;
    }

    .verses-section {
        padding: 1.05rem 1.1rem;
    }

    .verse-card {
        padding: 0.75rem 0.85rem 0.9rem;
        border-radius: 1.1rem;
    }
}

@media (min-width: 900px) {
    .verses-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
