/* ============================================================
   LEE TU BIBLIA ACADEMY - STYLE
   Con soporte de tema claro/oscuro via data-theme
   ============================================================ */

/* ----- TEMA CLARO (DEFAULT) ----- */
:root,
[data-theme="claro"] {
    --c-bg: #F6F7F9;
    --c-surface: #FFFFFF;
    --c-surface-2: #F9FAFB;
    --c-border: #E5E7EB;
    --c-border-strong: #D1D5DB;
    --c-text: #111827;
    --c-text-sub: #6B7280;
    --c-text-soft: #9CA3AF;

    --c-blue-50:  #E6F1FB;
    --c-blue-100: #B5D4F4;
    --c-blue-600: #185FA5;
    --c-blue-800: #0C447C;
    --c-blue-900: #042C53;

    --c-amber-50:  #FAEEDA;
    --c-amber-200: #FAC775;
    --c-amber-600: #BA7517;
    --c-amber-800: #633806;

    --c-teal-50:  #E1F5EE;
    --c-teal-600: #0F6E56;

    --c-purple-50: #EEEDFE;
    --c-purple-600: #3C3489;

    --c-pink-50: #FBEAF0;
    --c-pink-600: #993556;

    --c-coral-50: #FAECE7;
    --c-coral-600: #993C1D;

    --c-green-50: #EAF3DE;
    --c-green-600: #3B6D11;

    --c-red-50: #FCEBEB;
    --c-red-600: #A32D2D;

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

/* ----- TEMA OSCURO ----- */
[data-theme="oscuro"] {
    --c-bg: #0F1419;
    --c-surface: #1A2028;
    --c-surface-2: #232B35;
    --c-border: #2D3845;
    --c-border-strong: #3D4A5C;
    --c-text: #E8ECF0;
    --c-text-sub: #9CA8B8;
    --c-text-soft: #6B7785;

    --c-blue-50:  #1A3855;
    --c-blue-100: #2A5485;
    --c-blue-600: #4D9CE0;
    --c-blue-800: #7BB8EA;
    --c-blue-900: #B5D4F4;

    --c-amber-50:  #3D2D15;
    --c-amber-200: #6B4A1F;
    --c-amber-600: #FFB347;
    --c-amber-800: #FAC775;

    --c-teal-50:  #15332B;
    --c-teal-600: #4DC9A0;

    --c-purple-50: #2A2440;
    --c-purple-600: #9C92E8;

    --c-pink-50: #3D1F2C;
    --c-pink-600: #E089A6;

    --c-coral-50: #3D2218;
    --c-coral-600: #FF8C66;

    --c-green-50: #1F3315;
    --c-green-600: #7DC44D;

    --c-red-50: #3D1818;
    --c-red-600: #FF7575;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.4);
}

--radius-vars: 1; /* dummy for organization */

:root {
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-pill: 999px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--c-bg);
    color: var(--c-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    transition: background 0.2s, color 0.2s;
}

a { color: var(--c-blue-600); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0 0 8px; font-weight: 500; color: var(--c-text); }
h1 { font-size: 22px; }
h2 { font-size: 18px; }
h3 { font-size: 16px; }
h4 { font-size: 14px; }

input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="date"], input[type="time"], input[type="search"], input[type="url"],
textarea, select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    background: var(--c-surface);
    font-size: 13px;
    font-family: inherit;
    color: var(--c-text);
    transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--c-blue-600);
    box-shadow: 0 0 0 3px rgba(24, 95, 165, 0.15);
}

button, .btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid var(--c-border-strong);
    border-radius: var(--radius-md);
    background: var(--c-surface);
    color: var(--c-text);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, transform 0.05s;
    text-decoration: none !important;
}

button:hover, .btn:hover { background: var(--c-surface-2); }
button:active, .btn:active { transform: scale(0.98); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-primary {
    background: var(--c-blue-600);
    color: #fff;
    border-color: var(--c-blue-600);
}
.btn-primary:hover { background: var(--c-blue-800); color: #fff; }
.btn-block { width: 100%; justify-content: center; }

/* TOPBAR */
.topbar {
    background: var(--c-surface);
    border-bottom: 1px solid var(--c-border);
    position: sticky;
    top: 0;
    z-index: 50;
}
.topbar-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
}
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--c-text);
}
.brand i { font-size: 26px; color: var(--c-blue-600); }
.brand-text strong { display: block; font-size: 15px; font-weight: 500; line-height: 1.1; }
.brand-text span { display: block; font-size: 10px; color: var(--c-text-sub); letter-spacing: 2px; }

.search-box { flex: 1; position: relative; }
.search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--c-text-sub);
    font-size: 16px;
}
.search-box input { padding-left: 36px; }

.streak {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--c-amber-600);
    font-weight: 500;
    font-size: 14px;
}
.streak i { font-size: 20px; }

.avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--c-blue-50);
    color: var(--c-blue-800);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    font-size: 12px;
}

.theme-toggle {
    background: none;
    border: 1px solid var(--c-border);
    padding: 7px;
    border-radius: 50%;
    cursor: pointer;
    color: var(--c-text-sub);
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.theme-toggle:hover { background: var(--c-surface-2); }
.theme-toggle i { font-size: 18px; }

/* NAV TABS */
.navtabs {
    background: var(--c-surface);
    border-bottom: 1px solid var(--c-border);
    overflow-x: auto;
}
.navtabs-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 8px 20px;
    display: flex;
    gap: 6px;
}
.tab {
    padding: 5px 14px;
    border-radius: var(--radius-pill);
    font-size: 13px;
    color: var(--c-text-sub);
    white-space: nowrap;
    border: 1px solid transparent;
}
.tab:hover { background: var(--c-surface-2); color: var(--c-text); text-decoration: none; }
.tab.active { color: var(--c-text); border-color: var(--c-text); }

/* CONTAINER */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px;
}

/* HERO */
.hero {
    background: var(--c-blue-50);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    gap: 18px;
    align-items: center;
    margin-bottom: 24px;
}
.hero-content { flex: 1; min-width: 0; }
.hero-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 500;
    color: var(--c-blue-600);
    letter-spacing: 1px;
    margin-bottom: 8px;
}
.hero-label i { font-size: 16px; color: var(--c-amber-600); }
.hero-title { font-size: 18px; font-weight: 500; color: var(--c-blue-900); margin: 0 0 4px; }
.hero-sub { font-size: 12px; color: var(--c-blue-600); margin: 0 0 12px; }
.hero-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.hero-progress { position: relative; width: 80px; height: 80px; flex-shrink: 0; }
.hero-progress svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.hero-progress-text {
    position: absolute; inset: 0;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
}
.hero-progress-text strong { font-size: 17px; font-weight: 500; color: var(--c-blue-900); }
.hero-progress-text span { font-size: 9px; color: var(--c-blue-600); }

/* SECCIÓN */
.section { margin-bottom: 24px; }
.section-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 12px;
}
.section-head h2 { font-size: 16px; }
.section-head a { font-size: 12px; }

/* GRID HERRAMIENTAS */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}
.tool-card {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    padding: 14px 10px;
    text-align: center;
    color: var(--c-text);
    position: relative;
    transition: transform 0.1s, box-shadow 0.15s, border-color 0.15s;
}
.tool-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
    border-color: var(--c-border-strong);
    text-decoration: none;
}
.tool-icon {
    width: 38px; height: 38px;
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 8px;
}
.tool-icon i { font-size: 20px; }
.tool-name { font-size: 11px; font-weight: 500; line-height: 1.2; margin-bottom: 2px; }
.tool-meta { font-size: 10px; color: var(--c-text-sub); }
.tool-badge {
    position: absolute;
    top: 6px; right: 6px;
    background: var(--c-amber-50);
    color: var(--c-amber-800);
    font-size: 8px; font-weight: 500;
    padding: 1px 5px; border-radius: 4px;
    letter-spacing: 0.5px;
}

.tool-purple .tool-icon { background: var(--c-purple-50); }
.tool-purple .tool-icon i { color: var(--c-purple-600); }
.tool-pink .tool-icon { background: var(--c-pink-50); }
.tool-pink .tool-icon i { color: var(--c-pink-600); }
.tool-teal .tool-icon { background: var(--c-teal-50); }
.tool-teal .tool-icon i { color: var(--c-teal-600); }
.tool-blue .tool-icon { background: var(--c-blue-50); }
.tool-blue .tool-icon i { color: var(--c-blue-600); }
.tool-amber .tool-icon { background: var(--c-amber-50); }
.tool-amber .tool-icon i { color: var(--c-amber-600); }
.tool-coral .tool-icon { background: var(--c-coral-50); }
.tool-coral .tool-icon i { color: var(--c-coral-600); }
.tool-green .tool-icon { background: var(--c-green-50); }
.tool-green .tool-icon i { color: var(--c-green-600); }
.tool-red .tool-icon { background: var(--c-red-50); }
.tool-red .tool-icon i { color: var(--c-red-600); }

/* DEVOCIONAL */
.devocional {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-lg);
    padding: 18px;
    display: flex; gap: 14px; align-items: stretch;
}
.devocional-bar { width: 4px; background: var(--c-amber-600); border-radius: 2px; flex-shrink: 0; }
.devocional-ref { font-size: 11px; color: var(--c-amber-800); font-weight: 500; margin-bottom: 6px; letter-spacing: 0.5px; }
.devocional-verse {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 16px; font-style: italic;
    line-height: 1.5; margin: 0 0 12px;
}
.devocional-text { font-size: 13px; color: var(--c-text-sub); line-height: 1.6; margin: 0 0 14px; }
.devocional-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* PLAN */
.plan-card {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-lg);
    padding: 16px;
}
.plan-head {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px;
}
.plan-title { font-size: 14px; font-weight: 500; }
.plan-meta { font-size: 11px; color: var(--c-text-sub); margin-top: 2px; }
.plan-percent { font-size: 16px; font-weight: 500; color: var(--c-teal-600); }
.plan-bar { height: 6px; background: var(--c-teal-50); border-radius: 3px; overflow: hidden; margin-bottom: 14px; }
.plan-bar-fill { height: 100%; background: var(--c-teal-600); transition: width 0.4s ease; }

/* RECURSOS */
.recursos-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}
.recurso-item {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    padding: 12px;
    display: flex; align-items: center; gap: 12px;
    color: var(--c-text);
}
.recurso-item:hover { background: var(--c-surface-2); text-decoration: none; }
.recurso-icon {
    width: 40px; height: 40px;
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.recurso-icon i { font-size: 22px; }
.recurso-info { flex: 1; min-width: 0; }
.recurso-info strong {
    display: block; font-size: 13px; font-weight: 500;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.recurso-info small { display: block; font-size: 11px; color: var(--c-text-sub); margin-top: 2px; }
.recurso-action i { font-size: 18px; color: var(--c-blue-600); }

/* AUTH */
.auth-wrap {
    max-width: 380px;
    margin: 40px auto;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-lg);
    padding: 28px;
}
.auth-wrap h1 { text-align: center; margin-bottom: 6px; }
.auth-wrap > p { text-align: center; color: var(--c-text-sub); margin-bottom: 22px; }
.auth-wrap label { display: block; font-size: 12px; margin-bottom: 4px; color: var(--c-text-sub); }
.auth-wrap .field { margin-bottom: 14px; }
.auth-wrap .alert {
    background: var(--c-red-50); color: var(--c-red-600);
    padding: 8px 12px; border-radius: var(--radius-md);
    font-size: 12px; margin-bottom: 12px;
}
.auth-wrap .switch { text-align: center; margin-top: 16px; font-size: 12px; color: var(--c-text-sub); }

/* DICCIONARIO */
.dict-search { margin-bottom: 18px; }
.dict-result {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-lg);
    padding: 18px;
    margin-bottom: 12px;
}
.dict-result h3 { margin-bottom: 4px; }
.dict-etymology { font-size: 11px; color: var(--c-text-sub); margin-bottom: 12px; font-style: italic; }
.dict-definition { font-size: 14px; line-height: 1.6; margin-bottom: 10px; }
.dict-refs {
    font-size: 12px; color: var(--c-blue-600);
    padding-top: 10px; border-top: 1px dashed var(--c-border);
}
.dict-empty { text-align: center; padding: 40px 20px; color: var(--c-text-sub); }

/* CHAT IA */
.chat-wrap {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex; flex-direction: column;
    height: 70vh; min-height: 500px;
}
.chat-messages { flex: 1; overflow-y: auto; padding: 18px; }
.chat-msg {
    max-width: 80%; margin-bottom: 12px;
    padding: 10px 14px; border-radius: var(--radius-lg);
    font-size: 14px; line-height: 1.5;
    white-space: pre-wrap; word-wrap: break-word;
}
.chat-msg.user { background: var(--c-blue-600); color: #fff; margin-left: auto; }
.chat-msg.assistant { background: var(--c-bg); color: var(--c-text); }
.chat-form { border-top: 1px solid var(--c-border); padding: 14px; display: flex; gap: 10px; }
.chat-form input { flex: 1; }

/* NOTAS */
.notas-list { display: flex; flex-direction: column; gap: 10px; }
.nota-card {
    background: var(--c-amber-50);
    border: 1px solid var(--c-amber-50);
    border-left: 3px solid var(--c-amber-600);
    border-radius: var(--radius-md);
    padding: 14px;
}
.nota-ref { font-size: 11px; color: var(--c-amber-800); font-weight: 500; margin-bottom: 6px; }
.nota-text { font-size: 13px; line-height: 1.5; }
.nota-foot { font-size: 11px; color: var(--c-text-sub); margin-top: 8px; }

/* FOOTER */
.footer {
    margin-top: 40px;
    padding: 24px 0;
    border-top: 1px solid var(--c-border);
    text-align: center;
    color: var(--c-text-sub);
    font-size: 12px;
}
.footer a { color: var(--c-text-sub); }

/* RESPONSIVE */
@media (max-width: 720px) {
    .tools-grid { grid-template-columns: repeat(3, 1fr); }
    .recursos-grid { grid-template-columns: 1fr; }
    .topbar-inner { flex-wrap: wrap; }
    .search-box { order: 99; flex-basis: 100%; }
    .hero { flex-direction: column; align-items: flex-start; }
    .hero-progress { align-self: center; }
}
@media (max-width: 460px) {
    .tools-grid { grid-template-columns: repeat(2, 1fr); }
}
