/* ==========================================================================
   Sunnah.es — Capa de diseño (refresh)
   Se carga después de style.css y tafsir.css: redefine tokens y los
   componentes principales manteniendo los mismos nombres de clase.
   ========================================================================== */

:root {
    --primary-color: #1f4a3c;
    --primary-light: #2b6250;
    --primary-lighter: #e7efe9;
    --primary-ink: #fdfcf7;
    --secondary-color: #f0ece2;
    --secondary-light: #e6e0d2;
    --accent-color: #c08f17;
    --accent-light: #d9a82c;
    --accent-soft: #f7edd2;
    --text-color: #17221e;
    --text-secondary: #3b5248;
    --text-muted: #65746d;
    --bg-color: #f6f3ec;
    --bg-warm: #fbf9f4;
    --card-bg: #fffefb;
    --card-bg-alt: #f6f3ec;
    --border-color: #e5dfd2;
    --border-light: #ece7dc;
    --arabic-bg: #faf6ec;
    --hero-from: #173a2f;
    --hero-to: #24584a;
    --focus-ring: 0 0 0 3px rgba(192, 143, 23, 0.35);

    --shadow-xs: 0 1px 2px rgba(23, 34, 30, 0.04);
    --shadow-sm: 0 1px 3px rgba(23, 34, 30, 0.06), 0 1px 2px rgba(23, 34, 30, 0.03);
    --shadow-md: 0 6px 16px -6px rgba(23, 34, 30, 0.10), 0 2px 4px rgba(23, 34, 30, 0.03);
    --shadow-lg: 0 18px 40px -16px rgba(23, 34, 30, 0.18), 0 4px 10px rgba(23, 34, 30, 0.04);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 22px;

    --header-h: 64px;
    --content-w: 1160px;
}

[data-theme="dark"] {
    --primary-color: #4fb487;
    --primary-light: #72cba2;
    --primary-lighter: #16271f;
    --primary-ink: #0d1411;
    --secondary-color: #1d2723;
    --secondary-light: #26332d;
    --accent-color: #e2b54a;
    --accent-light: #efc766;
    --accent-soft: #2b2414;
    --text-color: #e6ebe8;
    --text-secondary: #b3c4bb;
    --text-muted: #8c9c95;
    --bg-color: #0e1412;
    --bg-warm: #121a17;
    --card-bg: #151d1a;
    --card-bg-alt: #1a2420;
    --border-color: #25312c;
    --border-light: #1f2a25;
    --arabic-bg: #18211d;
    --hero-from: #0f2a21;
    --hero-to: #1a4335;

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 6px 16px -6px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 18px 40px -16px rgba(0, 0, 0, 0.6);
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */
html { scroll-padding-top: calc(var(--header-h) + 16px); }
body { background-color: var(--bg-color); color: var(--text-color); }
h1, h2, h3 { letter-spacing: -0.015em; }
a { color: var(--primary-color); }
::selection { background: var(--accent-soft); color: var(--text-color); }
:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: 6px; }
[hidden] { display: none !important; }

.skip-link {
    position: absolute;
    left: 16px;
    top: -60px;
    z-index: 200;
    padding: 0.6rem 1rem;
    background: var(--primary-color);
    color: var(--primary-ink);
    border-radius: var(--radius-sm);
    font-weight: 600;
    text-decoration: none;
    transition: top 0.2s;
}
.skip-link:focus { top: 12px; }

.container {
    max-width: var(--content-w);
    padding: 2rem 1.25rem 1rem;
}

.eyebrow {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--accent-color);
    margin-bottom: 0.5rem;
}

mark {
    background: var(--accent-soft);
    color: inherit;
    padding: 0 0.15em;
    border-radius: 3px;
}

/* --------------------------------------------------------------------------
   Cabecera
   -------------------------------------------------------------------------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 60;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s, box-shadow 0.2s;
}
/* El desenfoque va en un pseudo-elemento: backdrop-filter en la propia
   cabecera la convertiría en bloque contenedor del menú móvil (fixed). */
.site-header::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: color-mix(in srgb, var(--bg-color) 86%, transparent);
    backdrop-filter: saturate(1.4) blur(14px);
    -webkit-backdrop-filter: saturate(1.4) blur(14px);
}
.site-header.scrolled {
    border-bottom-color: var(--border-color);
    box-shadow: 0 6px 20px -14px rgba(0, 0, 0, 0.25);
}
.site-header-inner {
    max-width: var(--content-w);
    margin: 0 auto;
    height: var(--header-h);
    padding: 0 1.25rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    color: var(--text-color);
    flex-shrink: 0;
}
.brand-mark {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 11px;
    background: linear-gradient(145deg, var(--hero-to), var(--hero-from));
    color: #f3dfa6;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.brand-text {
    font-family: var(--heading-font);
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}
.brand-tld { color: var(--accent-color); }

.site-nav {
    display: flex;
    align-items: center;
    gap: 0.15rem;
    margin: 0 auto;
}
.site-nav-link {
    position: relative;
    padding: 0.5rem 0.8rem;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    white-space: nowrap;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: color 0.15s, background-color 0.15s;
}
.site-nav-link:hover { color: var(--text-color); background: var(--secondary-color); }
.site-nav-link.active { color: var(--primary-color); background: var(--primary-lighter); font-weight: 600; }
.site-nav-extra { display: none; }

.site-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
}
.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: 999px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    text-decoration: none;
    transition: color 0.15s, background-color 0.15s, border-color 0.15s;
}
.icon-btn:hover { color: var(--text-color); background: var(--secondary-color); }
.icon-btn-donate:hover { color: #d14b5a; }
/* Sobrescribe el estilo antiguo del botón de tema */
.theme-toggle,
[data-theme="dark"] .theme-toggle {
    width: 38px;
    height: 38px;
    font-size: inherit;
    border-color: transparent;
    background: transparent;
    color: var(--text-muted);
}
.theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

.btn-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1.05rem;
    border-radius: 999px;
    background: var(--primary-color);
    color: var(--primary-ink);
    font-weight: 600;
    font-size: 0.88rem;
    text-decoration: none;
    margin-left: 0.25rem;
    transition: background-color 0.15s, transform 0.15s;
}
.btn-pill:hover { background: var(--primary-light); }

.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.8rem 0.25rem 0.25rem;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-color);
    font-size: 0.86rem;
    font-weight: 600;
    text-decoration: none;
    margin-left: 0.25rem;
    max-width: 180px;
}
.user-chip:hover { border-color: var(--primary-color); }
.user-chip-avatar {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background: var(--primary-color);
    color: var(--primary-ink);
    font-size: 0.8rem;
    flex-shrink: 0;
}
.user-chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nav-toggle { display: none; }
.nav-toggle .icon-close { display: none; }
.nav-open .nav-toggle .icon-close { display: block; }
.nav-open .nav-toggle .icon-menu { display: none; }
.nav-backdrop { display: none; }

/* Buscador compacto de la sección hadith */
.searchbar {
    max-width: var(--content-w);
    margin: 0.75rem auto 0;
    padding: 0 1.25rem;
}
.searchbar-form,
.hero-search {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    padding: 0.3rem 0.3rem 0.3rem 2.6rem;
    box-shadow: var(--shadow-xs);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.searchbar-form:focus-within,
.hero-search:focus-within {
    border-color: var(--accent-color);
    box-shadow: var(--focus-ring);
}
.searchbar-icon,
.hero-search-icon {
    position: absolute;
    left: 0.95rem;
    color: var(--text-muted);
    pointer-events: none;
}
.searchbar-form input,
.hero-search input {
    flex: 1;
    min-width: 0;
    border: none;
    background: transparent;
    color: var(--text-color);
    font: inherit;
    font-size: 0.95rem;
    padding: 0.5rem 0.25rem;
}
.searchbar-form input:focus,
.hero-search input:focus { outline: none; box-shadow: none; }
.searchbar-form select,
.hero-search select {
    border: none;
    border-left: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-muted);
    font: inherit;
    font-size: 0.88rem;
    padding: 0.45rem 0.6rem;
    max-width: 170px;
    cursor: pointer;
}
.searchbar-form select:focus,
.hero-search select:focus { outline: none; color: var(--text-color); }
.searchbar-form select option,
.hero-search select option { background: var(--card-bg); color: var(--text-color); }
.searchbar-form button,
.hero-search button {
    border: none;
    border-radius: 999px;
    background: var(--primary-color);
    color: var(--primary-ink);
    font: inherit;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.55rem 1.2rem;
    cursor: pointer;
    transition: background-color 0.15s;
}
.searchbar-form button:hover,
.hero-search button:hover { background: var(--primary-light); }

/* --------------------------------------------------------------------------
   Breadcrumb
   -------------------------------------------------------------------------- */
.breadcrumb,
[data-theme="dark"] .breadcrumb {
    background: transparent;
    border-bottom: none;
    padding: 0;
}
.breadcrumb .container {
    max-width: var(--content-w);
    padding: 1.1rem 1.25rem 0;
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.15rem;
}
.breadcrumb a { color: var(--text-muted); font-weight: 500; }
.breadcrumb a:hover { color: var(--primary-color); }
.breadcrumb span { margin: 0 0.35rem; color: var(--border-color); }
.breadcrumb strong { color: var(--text-color); font-weight: 600; }
.breadcrumb + .container { padding-top: 1rem; }

/* --------------------------------------------------------------------------
   Portada
   -------------------------------------------------------------------------- */
.hero {
    position: relative;
    overflow: hidden;
    margin: -0.5rem 0 3.5rem;
    border-radius: 28px;
    background:
        radial-gradient(120% 90% at 85% 0%, rgba(217, 168, 44, 0.20), transparent 55%),
        linear-gradient(160deg, var(--hero-to), var(--hero-from));
    color: #f4f1e8;
    isolation: isolate;
}
.hero-pattern {
    position: absolute;
    inset: 0;
    z-index: -1;
    opacity: 0.09;
    /* Estrella de ocho puntas en mosaico */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'%3E%3Cg fill='none' stroke='%23f3dfa6' stroke-width='1.2'%3E%3Cpath d='M40 8l9.4 22.6L72 40l-22.6 9.4L40 72l-9.4-22.6L8 40l22.6-9.4z'/%3E%3Crect x='22' y='22' width='36' height='36' transform='rotate(45 40 40)'/%3E%3Ccircle cx='40' cy='40' r='6'/%3E%3C/g%3E%3C/svg%3E");
    background-size: 80px 80px;
    -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 95%);
    mask-image: linear-gradient(180deg, #000 0%, transparent 95%);
}
.hero-inner {
    max-width: 760px;
    margin: 0 auto;
    padding: 4.5rem 1.5rem 3.5rem;
    text-align: center;
}
.hero-arabic {
    font-family: var(--arabic-font);
    font-size: 1.6rem;
    color: #e9cf86;
    margin-bottom: 0.75rem;
    line-height: 1.4;
}
.hero-title {
    font-size: clamp(2rem, 5vw, 3.25rem);
    line-height: 1.12;
    font-weight: 700;
    color: #fbf8ef;
    margin-bottom: 1rem;
}
.hero-title span { color: #e9cf86; font-style: italic; font-weight: 500; }
.hero-title .saw {
    font-family: var(--arabic-font);
    font-style: normal;
    font-size: 0.55em;
    font-weight: 400;
    color: inherit;
    vertical-align: 0.35em;
}
.hero-lead {
    font-size: 1.05rem;
    line-height: 1.65;
    color: rgba(244, 241, 232, 0.78);
    max-width: 560px;
    margin: 0 auto 2rem;
}
.hero-search {
    max-width: 640px;
    margin: 0 auto;
    padding: 0.4rem 0.4rem 0.4rem 2.9rem;
    border: none;
    box-shadow: 0 18px 40px -12px rgba(0, 0, 0, 0.45);
    text-align: left;
}
.hero-search-icon { left: 1.1rem; }
.hero-search input { font-size: 1rem; padding: 0.7rem 0.25rem; }
.hero-search button { padding: 0.75rem 1.5rem; font-size: 0.95rem; background: var(--accent-color); color: #1b1505; }
.hero-search button:hover { background: var(--accent-light); }
.hero-suggest {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.4rem 0.5rem;
    margin-top: 1rem;
    font-size: 0.85rem;
    color: rgba(244, 241, 232, 0.6);
}
.hero-suggest a {
    color: rgba(244, 241, 232, 0.9);
    text-decoration: none;
    padding: 0.15rem 0.65rem;
    border-radius: 999px;
    border: 1px solid rgba(244, 241, 232, 0.2);
    transition: background-color 0.15s, border-color 0.15s;
}
.hero-suggest a:hover { background: rgba(244, 241, 232, 0.1); border-color: rgba(244, 241, 232, 0.4); }
.hero-stats {
    display: flex;
    justify-content: center;
    gap: 0;
    margin-top: 2.75rem;
    padding-top: 1.75rem;
    border-top: 1px solid rgba(244, 241, 232, 0.12);
}
.hero-stats div { padding: 0 2rem; }
.hero-stats div + div { border-left: 1px solid rgba(244, 241, 232, 0.12); }
.hero-stats dt {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: rgba(244, 241, 232, 0.55);
    order: 2;
}
.hero-stats dd {
    font-family: var(--heading-font);
    font-size: 1.75rem;
    font-weight: 700;
    color: #fbf8ef;
    line-height: 1.2;
}
.hero-stats div { display: flex; flex-direction: column-reverse; }

.home-section { margin-bottom: 4rem; }
.home-section-head { margin-bottom: 1.75rem; }
.home-section-head h2 { font-size: 1.75rem; font-weight: 700; color: var(--text-color); }
.home-section-head p:not(.eyebrow) { color: var(--text-muted); margin-top: 0.35rem; }

/* Tarjetas de colección */
.collections-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}
.collection-card,
[data-theme="dark"] .collection-card {
    position: relative;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.collection-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    opacity: 0;
    transition: opacity 0.2s;
}
.collection-card:hover {
    transform: translateY(-3px);
    border-color: color-mix(in srgb, var(--accent-color) 45%, var(--border-color));
    box-shadow: var(--shadow-lg);
}
.collection-card:hover::before { opacity: 1; }
.collection-card-body { padding: 1.4rem 1.4rem 1.2rem; }
.collection-card-top { align-items: center; margin-bottom: 1.1rem; }
.collection-tag {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--primary-color);
    background: var(--primary-lighter);
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
}
.collection-ar {
    font-family: var(--arabic-font);
    font-size: 1.35rem;
    color: var(--accent-color);
    line-height: 1;
}
.collection-card h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 0.2rem;
}
.collection-card:hover h3 { color: var(--primary-color); }
.collection-author { color: var(--text-muted); font-weight: 500; margin-bottom: 1.25rem; }
.collection-stats { gap: 1.5rem; padding-top: 0.9rem; }
.collection-stat { align-items: baseline; gap: 0.3rem; }
.stat-value { font-size: 1.05rem; color: var(--text-color); font-variant-numeric: tabular-nums; }
.stat-label { text-transform: none; letter-spacing: 0; font-size: 0.82rem; }
.collection-arrow {
    display: grid;
    width: 18px;
    height: 18px;
}

/* Explorar */
.explore-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}
.explore-card {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 1.3rem;
    border-radius: var(--radius-lg);
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.explore-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: color-mix(in srgb, var(--primary-color) 35%, var(--border-color));
}
.explore-icon {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--accent-soft);
    color: var(--accent-color);
    margin-bottom: 0.6rem;
    transition: background-color 0.2s, color 0.2s;
}
.explore-card:hover .explore-icon { background: var(--primary-color); color: var(--primary-ink); }
.explore-title { font-family: var(--heading-font); font-size: 1.15rem; font-weight: 700; color: var(--text-color); }
.explore-text { font-size: 0.88rem; line-height: 1.5; color: var(--text-muted); }

/* FAQ */
.home-faq { max-width: 760px; margin-left: auto; margin-right: auto; }
.home-faq .home-section-head { text-align: center; }
.faq-item {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 0.6rem;
    transition: border-color 0.15s;
}
.faq-item[open] { border-color: color-mix(in srgb, var(--primary-color) 35%, var(--border-color)); }
.faq-item summary {
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.2rem;
    font-weight: 600;
    cursor: pointer;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
    content: "";
    width: 9px;
    height: 9px;
    flex-shrink: 0;
    border-right: 2px solid var(--text-muted);
    border-bottom: 2px solid var(--text-muted);
    transform: rotate(45deg) translateY(-3px);
    transition: transform 0.2s;
}
.faq-item[open] summary::after { transform: rotate(-135deg) translateY(-2px); }
.faq-item p { padding: 0 1.2rem 1.1rem; color: var(--text-secondary); line-height: 1.7; }

/* --------------------------------------------------------------------------
   Cabeceras de página y listas
   -------------------------------------------------------------------------- */
.page-head { margin: 0.5rem 0 2rem; }
.page-head h1 {
    font-size: clamp(1.7rem, 3.5vw, 2.3rem);
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-color);
}
.page-arabic {
    font-family: var(--arabic-font);
    font-size: 1.5rem;
    color: var(--accent-color);
    margin-top: 0.4rem;
    text-align: left;
}
.page-lead { color: var(--text-muted); margin-top: 0.5rem; }
.page-lead strong { color: var(--text-color); }

.list-filter {
    position: relative;
    display: flex;
    align-items: center;
    max-width: 420px;
    margin-top: 1.25rem;
    color: var(--text-muted);
}
.list-filter svg { position: absolute; left: 0.9rem; pointer-events: none; }
.list-filter input {
    width: 100%;
    padding: 0.65rem 1rem 0.65rem 2.4rem;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-color);
    font: inherit;
    font-size: 0.92rem;
}
.list-filter input:focus { outline: none; border-color: var(--accent-color); box-shadow: var(--focus-ring); }
.list-empty { color: var(--text-muted); text-align: center; padding: 2rem 0; }

.books-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 0.75rem;
    margin-top: 0;
}
.book-item,
[data-theme="dark"] .book-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin: 0;
    padding: 1.1rem 1.2rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: none;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.book-item:hover {
    transform: translateY(-2px);
    border-color: color-mix(in srgb, var(--primary-color) 40%, var(--border-color));
    box-shadow: var(--shadow-md);
}
.book-item .book-number {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    min-width: 40px;
    height: 40px;
    padding: 0 0.4rem;
    margin: 0;
    border-radius: 10px;
    background: var(--primary-lighter);
    color: var(--primary-color);
    font-size: 0.9rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    transition: background-color 0.15s, color 0.15s;
}
.book-item:hover .book-number { background: var(--primary-color); color: var(--primary-ink); }
.book-body { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.book-item h3 {
    font-family: var(--body-font);
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--text-color);
    margin: 0.1rem 0 0;
    letter-spacing: 0;
}
.book-item .book-name-ar {
    font-size: 1.1rem;
    color: var(--accent-color);
    margin-top: 0.3rem;
    line-height: 1.6;
}
.book-item .hadith-count { font-size: 0.8rem; margin-top: 0.3rem; }

/* --------------------------------------------------------------------------
   Hadices
   -------------------------------------------------------------------------- */
.hadith-card,
[data-theme="dark"] .hadith-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    padding: 1.6rem 1.75rem;
    margin-bottom: 1.25rem;
}
.hadith-header {
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 1rem;
    margin-bottom: 1.25rem;
}
.hadith-header h2 {
    font-family: var(--body-font);
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0;
    color: var(--primary-color);
}
.hadith-header h2 a:hover { color: var(--primary-light) !important; }
.hadith-title-row { gap: 0.4rem; }
.hadith-meta { font-size: 0.86rem; color: var(--text-muted); line-height: 1.6; }
.hadith-meta strong { color: var(--text-secondary); font-weight: 600; }

/* Lectura: árabe arriba en panel, traducción debajo */
.hadith-content {
    grid-template-columns: 1fr;
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}
.hadith-arabic {
    border: none;
    padding: 1.2rem 1.4rem;
    background: var(--arabic-bg);
    border-radius: var(--radius-md);
    border-right: 3px solid var(--accent-color);
}
.hadith-spanish { border: none; padding: 0 0.25rem; }
.arabic-text,
[data-theme="dark"] .arabic-text {
    font-size: 1.55rem;
    line-height: 2.15;
    color: var(--text-color);
}
.spanish-text {
    font-size: 1.1rem;
    line-height: 1.85;
    color: var(--text-color);
}
.section-title { font-size: 0.72rem; letter-spacing: 0.14em; }
.not-translated,
[data-theme="dark"] .not-translated {
    background: var(--card-bg-alt);
    border: 1px dashed var(--border-color);
    color: var(--text-muted);
}

.chapter-info,
[data-theme="dark"] .chapter-info {
    background: transparent;
    border-left: none;
    padding: 0;
    margin-bottom: 1rem;
}
.chapter-info h4 {
    font-family: var(--arabic-font);
    font-size: 1.25rem;
    font-weight: 400;
    color: var(--accent-color);
    text-align: right;
    direction: rtl;
}

.grade-section {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-light);
}
.grade-section h3 {
    font-family: var(--body-font);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--text-muted);
}
.grade-badge {
    margin-top: 0.5rem;
    padding: 0.35rem 0.9rem;
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: none;
}
.grade-sahih { background: #e3f3ea; color: #1d6b44; }
.grade-hasan { background: #fbeedb; color: #9a5a12; }
.grade-daif  { background: #fbe4e4; color: #a12d2d; }
[data-theme="dark"] .grade-sahih { background: #12301f; color: #7fd6a4; }
[data-theme="dark"] .grade-hasan { background: #33250f; color: #f0b867; }
[data-theme="dark"] .grade-daif  { background: #3a1717; color: #f19a9a; }

.hadith-references,
[data-theme="dark"] .hadith-references {
    background: var(--card-bg-alt);
    border: none;
    border-radius: var(--radius-md);
    padding: 1rem 1.1rem;
    margin-top: 1.25rem;
    display: grid;
    gap: 0.35rem;
}
.reference-item,
[data-theme="dark"] .reference-item {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0.2rem 0;
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}
.reference-item:hover { transform: none; box-shadow: none; }
.reference-item strong { color: var(--text-muted); font-weight: 600; min-width: 200px; }

/* Botones de acción del hadiz */
.favorite-btn,
.report-btn,
.share-btn {
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.85rem;
}
.share-dropdown {
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    box-shadow: var(--shadow-lg);
}

/* Navegación anterior/siguiente */
.content-nav-arrow a,
[data-theme="dark"] .content-nav-arrow a {
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
}

/* Resultados de búsqueda */
.results-list { display: grid; gap: 0.9rem; }
.result-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.3rem 1.4rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.result-card:hover { border-color: color-mix(in srgb, var(--primary-color) 35%, var(--border-color)); box-shadow: var(--shadow-md); }
.result-head { display: flex; align-items: center; flex-wrap: wrap; gap: 0.6rem; margin-bottom: 0.4rem; }
.result-badge {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    background: var(--primary-lighter);
    color: var(--primary-color);
}
.result-id { font-weight: 700; color: var(--text-color); text-decoration: none; }
.result-id:hover { color: var(--primary-color); }
.result-meta { display: flex; flex-wrap: wrap; gap: 0.25rem 0.9rem; font-size: 0.82rem; color: var(--text-muted); margin-bottom: 0.8rem; }
.result-meta span + span::before { content: "·"; margin-right: 0.9rem; color: var(--border-color); }
.result-text { font-family: var(--spanish-font); font-size: 1.02rem; line-height: 1.75; color: var(--text-color); }
.result-text-muted { color: var(--text-muted); font-style: italic; }
.result-arabic {
    font-family: var(--arabic-font);
    font-size: 1.15rem;
    line-height: 1.9;
    color: var(--text-muted);
    margin-top: 0.6rem;
    text-align: right;
}
.result-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.9rem;
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    color: var(--primary-color);
}
.result-link svg { transition: transform 0.15s; }
.result-link:hover svg { transform: translateX(3px); }

.empty-state {
    text-align: center;
    padding: 3.5rem 1rem;
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-lg);
    color: var(--text-muted);
}
.empty-state svg { margin-bottom: 0.75rem; opacity: 0.6; }
.empty-state h2 { font-size: 1.3rem; color: var(--text-color); margin-bottom: 0.35rem; }

.notice {
    margin-top: 1.5rem;
    padding: 1rem 1.2rem;
    border-radius: var(--radius-md);
    background: var(--accent-soft);
    color: var(--text-secondary);
    border: 1px solid color-mix(in srgb, var(--accent-color) 30%, transparent);
    font-size: 0.92rem;
}

/* --------------------------------------------------------------------------
   Botones, formularios y mensajes
   -------------------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    border-radius: 999px;
    background: var(--primary-color);
    color: var(--primary-ink);
    font-weight: 600;
    font-size: 0.92rem;
    padding: 0.65rem 1.35rem;
}
.btn:hover { background: var(--primary-light); transform: none; box-shadow: var(--shadow-md); }
.btn-sm { padding: 0.45rem 1rem; font-size: 0.85rem; }
.btn-full { width: 100%; border-radius: var(--radius-md); }
.btn-secondary {
    background: var(--secondary-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}
.btn-secondary:hover { background: var(--secondary-light); transform: none; box-shadow: none; }
a.btn-secondary { text-decoration: none; display: inline-flex; align-items: center; padding: 0.65rem 1.35rem; border-radius: 999px; font-weight: 600; font-size: 0.92rem; }

.form-group input,
.form-group select,
.form-group textarea,
.note-input-area textarea {
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-warm);
    color: var(--text-color);
    font-family: inherit;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.note-input-area textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: var(--focus-ring);
}

.auth-card,
[data-theme="dark"] .auth-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
}

.user-notes-section,
[data-theme="dark"] .user-notes-section {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: none;
}

.flash-message { border-radius: var(--radius-md); }

/* Modales */
.modal-overlay,
.donate-modal { background-color: rgba(10, 16, 13, 0.55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.modal-content,
[data-theme="dark"] .modal-content,
.donate-modal-content,
[data-theme="dark"] .donate-modal-content {
    background: var(--card-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.45);
}
.modal-content { max-width: 620px; animation: refreshModalIn 0.25s ease-out; }
@keyframes refreshModalIn {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to   { opacity: 1; transform: none; }
}
.modal-header,
[data-theme="dark"] .modal-header,
[data-theme="dark"] #reportModal .modal-header {
    background: transparent;
    border-bottom: 1px solid var(--border-light);
    padding: 1.25rem 1.5rem;
}
.modal-header h2,
[data-theme="dark"] .modal-header h2 { color: var(--text-color); font-size: 1.25rem; }
.modal-close,
[data-theme="dark"] .modal-close { color: var(--text-muted); }
.modal-body { padding: 1.25rem 1.5rem; line-height: 1.7; color: var(--text-secondary); }
.modal-body p + p { margin-top: 0.8rem; }
.modal-warning,
[data-theme="dark"] .modal-warning {
    background: var(--accent-soft);
    color: var(--text-color);
    border-left: 3px solid var(--accent-color);
    border-radius: var(--radius-sm);
}
.modal-footer,
[data-theme="dark"] .modal-footer {
    background: transparent;
    border-top: 1px solid var(--border-light);
    padding: 1rem 1.5rem;
    gap: 0.5rem;
}

/* --------------------------------------------------------------------------
   Pie
   -------------------------------------------------------------------------- */
.footer,
[data-theme="dark"] .footer {
    position: relative;
    margin-top: 5rem;
    padding: 3.5rem 0 1.75rem;
    background: linear-gradient(170deg, var(--hero-to) -40%, var(--hero-from) 70%);
    color: #e9e5da;
    overflow: hidden;
}
[data-theme="dark"] .footer { background: #0a110e; border-top: 1px solid var(--border-color); }
.footer-container { max-width: var(--content-w); padding: 0 1.25rem; }
.footer-logo-icon,
[data-theme="dark"] .footer-logo-icon { background: rgba(255, 255, 255, 0.08); color: #f3dfa6; border-radius: 11px; }
.footer-logo-subtitle { color: #e9cf86; opacity: 1; }
.footer-column-title { color: #e9cf86; }
.footer-column-links a,
[data-theme="dark"] .footer-column-links a { color: rgba(233, 229, 218, 0.75); transition: color 0.15s; }
.footer-column-links a:hover { color: #fff; }
.footer-social { display: flex; gap: 0.5rem; margin-top: 1.25rem; }
.footer-social a {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: rgba(233, 229, 218, 0.85);
    transition: background-color 0.15s, color 0.15s;
}
.footer-social a:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.footer-bottom { border-top-color: rgba(255, 255, 255, 0.1); }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 960px) {
    .nav-toggle { display: inline-grid; }
    .hide-mobile { display: none; }

    .site-nav {
        position: fixed;
        top: var(--header-h);
        right: 0;
        bottom: 0;
        width: min(320px, 86vw);
        margin: 0;
        padding: 1rem;
        flex-direction: column;
        align-items: stretch;
        gap: 0.15rem;
        background: var(--card-bg);
        border-left: 1px solid var(--border-color);
        box-shadow: var(--shadow-lg);
        overflow-y: auto;
        transform: translateX(100%);
        visibility: hidden;
        transition: transform 0.25s ease, visibility 0.25s;
        z-index: 70;
    }
    .nav-open .site-nav { transform: none; visibility: visible; }
    .site-nav-link {
        border-radius: var(--radius-sm);
        padding: 0.8rem 0.9rem;
        font-size: 1rem;
        text-align: left;
        width: 100%;
    }
    .site-nav-extra {
        display: flex;
        flex-direction: column;
        gap: 0.15rem;
        margin-top: 0.75rem;
        padding-top: 0.75rem;
        border-top: 1px solid var(--border-color);
    }
    .site-nav-extra .site-nav-link { font-size: 0.92rem; }
    .site-nav-donate { color: var(--accent-color); font-weight: 600; }

    .nav-backdrop {
        display: block;
        position: fixed;
        inset: var(--header-h) 0 0 0;
        background: rgba(10, 16, 13, 0.4);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.25s;
        z-index: 55;
    }
    .nav-open .nav-backdrop { opacity: 1; pointer-events: auto; }
    .nav-open { overflow: hidden; }
    .site-actions { margin-left: auto; }
}

@media (max-width: 640px) {
    :root { --header-h: 58px; }
    .container { padding: 1.25rem 1rem 0.5rem; }
    .site-header-inner { padding: 0 1rem; gap: 0.75rem; }
    .searchbar { padding: 0 1rem; }
    .breadcrumb .container { padding: 0.9rem 1rem 0; }
    .user-chip-name { display: none; }
    .user-chip { padding: 0.2rem; }

    .searchbar-form select,
    .hero-search select { display: none; }

    .hero { border-radius: 20px; margin: -0.25rem 0 2.5rem; }
    .hero-inner { padding: 2.75rem 1.1rem 2.25rem; }
    .hero-arabic { font-size: 1.3rem; }
    .hero-lead { font-size: 0.98rem; margin-bottom: 1.5rem; }
    .hero-search button { padding: 0.7rem 1.1rem; }
    .hero-stats { margin-top: 2rem; padding-top: 1.25rem; }
    .hero-stats div { padding: 0 1rem; }
    .hero-stats dd { font-size: 1.35rem; }

    .home-section { margin-bottom: 3rem; }
    .home-section-head h2 { font-size: 1.45rem; }
    .collections-grid,
    .books-list { grid-template-columns: 1fr; }
    .explore-grid { grid-template-columns: 1fr 1fr; gap: 0.75rem; }
    .explore-card { padding: 1rem; }
    .explore-text { display: none; }

    .hadith-card { padding: 1.15rem 1.1rem; border-radius: var(--radius-md); }
    .hadith-arabic { padding: 1rem; }
    .arabic-text { font-size: 1.35rem; }
    .spanish-text { font-size: 1.04rem; }
    .reference-item strong { min-width: 0; display: block; }

    .footer { margin-top: 3.5rem; padding-top: 2.5rem; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* Ajustes finales */
:root {
    /* Amiri como respaldo para ﷺ y otros glifos árabes sueltos en texto latino */
    --spanish-font: 'Lora', 'Amiri', Georgia, serif;
    --body-font: 'Inter', 'Amiri', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --heading-font: 'Playfair Display', 'Amiri', Georgia, serif;
}
.book-item .book-name-ar { align-self: flex-start; }
