/* Estilos base y reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Paletas basadas en los temas de Davar:
   claro = "Gracia", sepia = "Papiro", oscuro = "Sinaí - Noche Marina" */
:root,
[data-theme="light"] {
    color-scheme: light;
    --page-bg: #f1f5f9;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --surface-translucent: rgba(255, 255, 255, 0.92);
    --text: #334155;
    --text-strong: #1e293b;
    --muted: #64748b;
    --border: rgba(0, 0, 0, 0.09);
    --hover-bg: rgba(14, 165, 233, 0.1);
    --active-bg: rgba(14, 165, 233, 0.18);
    --header-bg: linear-gradient(135deg, #ffffff 0%, #eef4fa 100%);
    --brand: #334155;
    --secondary: #0ea5e9;
    --accent: #0284c7;
    --primary: #2c3e50;
    --light: #f1f5f9;
    --dark: #334155;
    --gray: #64748b;
    --chip-bg: #eef2f7;
    --chip-rv-bg: #e8f5e9;
    --chip-morph-bg: #f1ecfb;
    --track-bg: #e2e8f0;
    --mark-bg: #fff2a8;
    --success: #27ae60;
    --warning: #f39c12;
    --toggler-filter: invert(1) opacity(0.65);
    --hebrew-font: "Noto Sans Hebrew", sans-serif;
    --sans-font: "Inter", sans-serif;
}

[data-theme="sepia"] {
    color-scheme: light;
    --page-bg: #e4d8bf;
    --surface: #fdf9ed;
    --surface-2: rgba(247, 240, 226, 0.94);
    --surface-translucent: rgba(247, 240, 226, 0.94);
    --text: #2b1b0e;
    --text-strong: #2b1b0e;
    --muted: #6e5843;
    --border: rgba(140, 80, 20, 0.2);
    --hover-bg: rgba(140, 80, 20, 0.1);
    --active-bg: rgba(140, 80, 20, 0.2);
    --header-bg: linear-gradient(135deg, #fdf9ed 0%, #efe4cd 100%);
    --brand: #4a2c14;
    --secondary: #9e3b1e;
    --accent: #9e3b1e;
    --primary: #6b4a2a;
    --light: #f5eddc;
    --dark: #2b1b0e;
    --gray: #6e5843;
    --chip-bg: #f1e7d2;
    --chip-rv-bg: #e9e2c8;
    --chip-morph-bg: #efe3d2;
    --track-bg: #e0d3b6;
    --mark-bg: #f3d98a;
    --toggler-filter: invert(1) sepia(1) saturate(3) hue-rotate(-20deg) opacity(0.75);
}

[data-theme="dark"] {
    color-scheme: dark;
    --page-bg: #0f172a;
    --surface: #1e293b;
    --surface-2: rgba(30, 41, 59, 0.85);
    --surface-translucent: rgba(30, 41, 59, 0.88);
    --text: #f8fafc;
    --text-strong: #ffffff;
    --muted: #94a3b8;
    --border: rgba(255, 255, 255, 0.12);
    --hover-bg: rgba(125, 211, 252, 0.15);
    --active-bg: rgba(125, 211, 252, 0.25);
    --header-bg: linear-gradient(135deg, #16213c 0%, #0f172a 100%);
    --brand: #f8fafc;
    --secondary: #38bdf8;
    --accent: #7dd3fc;
    --primary: #334155;
    --light: rgba(255, 255, 255, 0.05);
    --dark: #e2e8f0;
    --gray: #94a3b8;
    --chip-bg: rgba(255, 255, 255, 0.08);
    --chip-rv-bg: rgba(74, 222, 128, 0.14);
    --chip-morph-bg: rgba(167, 139, 250, 0.16);
    --track-bg: rgba(255, 255, 255, 0.12);
    --mark-bg: #b45309;
    --toggler-filter: none;
}

[data-theme="ocean"] {
    color-scheme: dark;
    --page-bg: #012b3d;
    --surface: #06262d;
    --surface-2: rgba(45, 212, 191, 0.08);
    --surface-translucent: rgba(6, 38, 45, 0.94);
    --text: #f0fdfa;
    --text-strong: #ffffff;
    --muted: #99f6e4;
    --border: rgba(45, 212, 191, 0.22);
    --hover-bg: rgba(45, 212, 191, 0.14);
    --active-bg: rgba(45, 212, 191, 0.24);
    --header-bg: linear-gradient(135deg, #083f4d 0%, #012b3d 100%);
    --brand: #f0fdfa;
    --secondary: #2dd4bf;
    --accent: #2dd4bf;
    --primary: #0b4f5c;
    --light: rgba(255, 255, 255, 0.06);
    --dark: #e6fffb;
    --gray: #99f6e4;
    --chip-bg: rgba(45, 212, 191, 0.12);
    --chip-rv-bg: rgba(74, 222, 128, 0.14);
    --chip-morph-bg: rgba(167, 139, 250, 0.18);
    --track-bg: rgba(45, 212, 191, 0.18);
    --mark-bg: #0f766e;
    --toggler-filter: none;
}

body {
    font-family: var(--sans-font);
    background: var(--page-bg);
    color: var(--dark);
    line-height: 1.6;
    min-height: 100vh;
    padding: 10px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: var(--surface);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* Header mejorado */
header {
    background: var(--header-bg);
    color: var(--text);
    padding: 0.5rem 2rem;
    position: relative;
    overflow: hidden;
    border-bottom: 1px solid var(--border);
}

header::before {
    content: "א ב ג ד ה ו ז ח ט י כ ל מ נ ס ע פ צ ק ר ש ת";
    position: absolute;
    top: 50%;
    right: -100px;
    transform: translateY(-50%) rotate(-90deg);
    font-family: var(--hebrew-font);
    font-size: 1.2rem;
    opacity: 0.1;
    white-space: nowrap;
    letter-spacing: 10px;
}

/* Cabecera de marca: logo de Davar + título (a juego con la página de Davar) */
.brand-header {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.7rem;
    margin: 0.3rem 0 0.7rem;
}

.brand-logo {
    flex: 0 0 auto;
    display: block;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.22), 0 0 0 3px var(--hover-bg);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.brand-logo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.brand-logo:hover {
    transform: translateY(-1px) scale(1.04);
    box-shadow: 0 7px 18px rgba(0, 0, 0, 0.3), 0 0 0 3px var(--active-bg);
}

.brand-titles {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 0;
}

.brand-titles h4 {
    margin: 0;
    line-height: 1.15;
}

.brand-subtitle {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* En pantallas estrechas el distintivo sobra: el pie ya lleva la firma */
@media (max-width: 560px) {
    .brand-subtitle {
        display: none;
    }

    .brand-logo {
        width: 42px;
        height: 42px;
    }

    .brand-titles h4 {
        font-size: 1.1rem;
    }
}

h1 {
    font-size: 2.5rem;
    display: flex;
    text-align: center;
    gap: 15px;
}

h3 i {
    color: var(--secondary);
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 2rem;
}

/* Barra de navegación mejorada */
.navbar {
    border-radius: 12px;
    background: var(--surface-2) !important;
    border: 1px solid var(--border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    padding: 0.5rem 1rem;
    margin: 0.2rem 0 1rem 0;
}

.navbar-brand h6 {
    color: var(--text-strong) !important;
    font-weight: 600;
    margin: 0;
    padding: 0.5rem 0;
    font-size: 1.1rem;
}

.nav-link {
    color: var(--text) !important;
    font-weight: 500;
    padding: 0.5rem 1rem !important;
    margin: 0 0.2rem;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.nav-link:hover {
    color: var(--text-strong) !important;
    background-color: var(--hover-bg);
    transform: translateY(-2px);
}

.nav-link.active {
    background-color: var(--active-bg);
    color: var(--text-strong) !important;
    font-weight: 600;
}

.navbar-toggler {
    border-color: var(--border);
}

.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.8%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
    filter: var(--toggler-filter);
}

/* Selector de tema (paletas de Davar) */
.theme-switch {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    padding-top: 0.6rem;
}

.theme-switch button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    font-family: var(--sans-font);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.theme-switch button:hover {
    border-color: var(--secondary);
    color: var(--secondary);
}

.theme-switch button.active {
    background: var(--secondary);
    border-color: var(--secondary);
    color: #fff;
}

.theme-switch .swatch {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.2);
}

.swatch-light { background: #ffffff; }
.swatch-sepia { background: #e4d8bf; }
.swatch-dark { background: #0f172a; }
.swatch-ocean { background: #2dd4bf; }

/* En el tema océano el acento es turquesa claro: el texto del botón activo va en tinta oscura
   para no quedar blanco sobre turquesa (contraste ~1,6:1). */
[data-theme="ocean"] .theme-switch button.active {
    color: #04212a;
}

/* Search */
.search-container {
    background: var(--surface-2);
    border: 1px solid var(--border);
    padding: 1.5rem;
    border-radius: 10px;
    backdrop-filter: blur(10px);
    margin-bottom: 1rem;
}

.search-box {
    position: relative;
    margin-bottom: 1rem;
}

.search-box i {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray);
}

#searchInput {
    width: 100%;
    padding: 15px 20px 15px 50px;
    font-size: 1.1rem;
    border: none;
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    transition: all 0.3s ease;
}

#searchInput:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.3);
}

.clear-btn {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--gray);
    cursor: pointer;
    padding: 5px;
}

.clear-btn:hover {
    color: var(--accent);
}

.filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

select,
.btn-secondary {
    padding: 10px 15px;
    border: none;
    border-radius: 6px;
    font-family: var(--sans-font);
    font-size: 0.95rem;
    cursor: pointer;
}

select {
    flex: 1;
    min-width: 200px;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}

select option {
    background-color: var(--surface);
    color: var(--text);
}

.btn-secondary {
    background: var(--secondary);
    color: white;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.3s ease;
}

.btn-secondary:hover {
    background: #2980b9;
}

.stats {
    margin-top: 1rem;
    font-size: 0.9rem;
    opacity: 0.8;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

/* Main content */
main {
    padding: 2rem;
}

.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1rem;
    background: var(--light);
    border-radius: 8px;
}

.sort-controls,
.view-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-icon {
    background: var(--surface);
    border: 2px solid var(--gray);
    border-radius: 6px;
    padding: 8px 12px;
    cursor: pointer;
    color: var(--text);
    transition: all 0.3s ease;
}

.btn-icon:hover {
    border-color: var(--secondary);
    color: var(--secondary);
}

/* Entries grid */
.entries-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
    margin-bottom: 2rem;
}

.entry-card {
    background: var(--surface);
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    /* Sin `all`: al cambiar de tema no se animan 4.800 tarjetas a la vez. */
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

.entry-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    border-color: var(--secondary);
}

.entry-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--secondary), var(--accent));
}

.hebrew-word {
    font-family: var(--hebrew-font);
    font-size: 2.4rem;
    font-weight: 700;
    margin-bottom: 0.2rem;
    color: var(--text-strong);
    line-height: 1.1;
    direction: rtl;
}

.transliteration {
    font-size: 1.15rem;
    color: var(--accent);
    font-weight: 600;
    margin-bottom: 0;
}

.pron {
    font-weight: 400;
    opacity: 0.75;
    font-size: 0.95rem;
    margin-left: 4px;
}

.translation {
    font-size: 1.5rem;
    color: var(--dark);
    margin: 0.6rem 0 0.8rem;
    font-weight: 700;
}

/* --- Tarjeta enriquecida --- */
.card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
}

.card-badges {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.card-badges .strong-link {
    background: var(--primary);
    color: white;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    text-decoration: none;
    font-weight: 600;
}

.card-badges .strong-link:hover {
    background: var(--accent);
    color: white;
}

.lang-badge {
    background: var(--warning);
    color: #4a3200;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

/* Lema atestiguado en hebreo y en arameo: contorno en lugar de relleno. */
.lang-badge--mixed {
    background: transparent;
    color: var(--text-strong);
    box-shadow: inset 0 0 0 1px var(--secondary);
}

/* Lema hebreo que sólo incluye una sección aramea en su definición. */
.lang-badge--soft {
    background: transparent;
    color: var(--muted);
    box-shadow: inset 0 0 0 1px var(--border);
    font-weight: 500;
}

.frequency-badge {
    display: inline-block;
    background: linear-gradient(135deg, var(--success), #2ecc71);
    color: white;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.definition {
    background: var(--light);
    border-left: 3px solid var(--secondary);
    border-radius: 6px;
    padding: 0.7rem 0.9rem;
    font-size: 0.92rem;
    line-height: 1.5;
    color: var(--dark);
    max-height: 11rem;
    overflow-y: auto;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-items: center;
    margin-top: 0.6rem;
}

.chips-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--primary);
    margin-right: 2px;
}

.chip {
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
    background: var(--chip-bg);
    color: var(--dark);
    border-radius: 20px;
    padding: 2px 10px;
    font-size: 0.82rem;
    line-height: 1.5;
}

.chip small {
    font-size: 0.7rem;
    opacity: 0.6;
}

.chip-rv {
    background: var(--chip-rv-bg);
}

.chip-form {
    font-family: var(--hebrew-font);
    font-size: 1rem;
}

.chip-morph {
    background: var(--chip-morph-bg);
    font-family: monospace;
}

.lbla {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--gray);
    font-style: italic;
}

.meta-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px 14px;
    margin-top: 0.9rem;
    font-size: 0.85rem;
}

.stat {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    border-bottom: 1px dotted var(--border);
    padding: 2px 0;
}

.stat-label {
    color: var(--gray);
    flex: 0 0 auto;
}

.stat-value {
    color: var(--dark);
    font-weight: 600;
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.root-value {
    font-family: var(--hebrew-font);
    font-size: 1.05rem;
}

/* Distribución por secciones del Tanaj */
.sections-bar {
    display: flex;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 0.9rem;
    background: var(--track-bg);
}

.sections-bar .sec {
    height: 100%;
}

.sec-torah { background: #2e7dd1; }
.sec-prophets { background: #e67e22; }
.sec-writings { background: #27ae60; }

.sections-legend {
    display: flex;
    gap: 12px;
    font-size: 0.75rem;
    color: var(--gray);
    margin-top: 4px;
}

.sections-legend i {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 2px;
    margin-right: 4px;
}

.sections-legend .sec-torah { background: #2e7dd1; }
.sections-legend .sec-prophets { background: #e67e22; }
.sections-legend .sec-writings { background: #27ae60; }

/* Panel de detalles (carga diferida) */
.details-btn {
    width: 100%;
    margin-top: 1rem;
    padding: 8px;
    background: var(--secondary);
    color: white;
    border: none;
    border-radius: 6px;
    font-family: var(--sans-font);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.details-btn:hover:not(:disabled) {
    background: var(--primary);
}

.details-btn:disabled {
    opacity: 0.65;
    cursor: progress;
}

.details-panel {
    display: none;
    margin-top: 0.8rem;
    border-top: 1px dashed var(--border);
    padding-top: 0.8rem;
}

.det-block {
    margin-bottom: 0.9rem;
}

.det-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--secondary);
    margin-bottom: 4px;
}

.det-text {
    font-size: 0.88rem;
    line-height: 1.5;
    color: var(--dark);
}

.ref-link {
    display: inline-block;
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
}

.book-bars {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
    gap: 3px 16px;
}

.book-bar {
    display: grid;
    grid-template-columns: 92px 1fr 40px;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
}

.book-name {
    color: var(--gray);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.book-track {
    background: var(--track-bg);
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
}

.book-track i {
    display: block;
    height: 100%;
    background: var(--secondary);
}

.book-count {
    text-align: right;
    font-weight: 600;
    color: var(--dark);
}

.example {
    background: var(--light);
    border-radius: 6px;
    padding: 0.6rem 0.8rem;
    margin-bottom: 0.5rem;
}

.example-ref {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 3px;
}

.example-hebrew {
    font-family: var(--hebrew-font);
    font-size: 1.15rem;
    direction: rtl;
    text-align: right;
    line-height: 1.7;
    color: var(--dark);
}

.example-hebrew mark {
    background: var(--mark-bg);
    color: inherit;
    border-radius: 3px;
    padding: 0 2px;
}

.example-es {
    margin-top: 4px;
    font-size: 0.85rem;
    color: var(--gray);
    font-style: italic;
}

/* Procedencia de la traducción del ejemplo (RV2020 o LSB) */
.example-es .es-label {
    font-style: normal;
    font-weight: 700;
    font-size: 0.72rem;
    color: var(--primary);
}

/* Aparato de notas de la LSV (lecturas alternativas del versículo) */
.example-note {
    margin-top: 4px;
    font-size: 0.82rem;
    color: var(--gray);
}

.example-note .es-label {
    font-weight: 700;
    font-size: 0.72rem;
    color: var(--primary);
}

.details-error {
    font-size: 0.85rem;
    color: var(--gray);
    margin: 0;
}

/* No results */
.no-results {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--gray);
    display: none;
}

.no-results i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}

/* Footer (a juego con el pie de Davar) */
.site-footer {
    background: transparent;
    border-top: 1px solid var(--border);
    border-radius: 0;
    color: var(--muted);
    padding: 1.4rem 1.5rem 1.6rem;
    margin-top: 2.5rem;
    text-align: center;
}

.footer-copyright {
    margin: 0 0 0.5rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-strong);
}

.footer-license {
    max-width: 68ch;
    margin: 0 auto;
    font-size: 0.75rem;
    line-height: 1.6;
    opacity: 0.85;
}

.footer-license a {
    color: var(--secondary);
    font-weight: 600;
    text-decoration: none;
}

.footer-license a:hover {
    text-decoration: underline;
}

/* El pie, más recogido en pantallas pequeñas */
@media (max-width: 768px) {
    .site-footer {
        padding: 1.1rem 1rem 1.3rem;
        margin-top: 2rem;
    }

    .footer-copyright {
        font-size: 0.8rem;
    }

    .footer-license {
        font-size: 0.72rem;
        line-height: 1.5;
    }
}

/* Puentes con Bootstrap: el modal y los textos secundarios siguen el tema */
.modal-content {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}

.modal-header,
.modal-footer {
    border-color: var(--border);
}

.modal-title {
    color: var(--text-strong);
}

.btn-close {
    filter: var(--toggler-filter);
}

.text-muted {
    color: var(--muted) !important;
}

.credits {
    font-size: 0.85rem;
    opacity: 0.8;
    margin-top: 1rem;
    margin-bottom: 1rem;
}

.copyright {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.copyright img {
    vertical-align: middle;
    height: 22px;
    filter: brightness(0) invert(1);
    opacity: 0.9;
    margin: 0 5px;
}

/* Responsive */
@media (max-width: 768px) {
    .entries-grid {
        grid-template-columns: 1fr;
    }

    .filters {
        flex-direction: column;
    }

    select {
        min-width: 100%;
    }

    /* La fila de ordenación ocupa una sola línea también en vertical */
    .controls {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 10px;
        margin-bottom: 0.75rem;
        padding: 0.5rem 0.6rem;
    }

    .controls .sort-controls {
        flex: 1 1 150px;
        min-width: 0;
    }

    .controls .sort-controls select {
        min-width: 0;
        flex: 1 1 auto;
    }

    header p {
        font-size: 0.85rem;
        margin: 0.25rem 0;
    }

    h1 {
        font-size: 2rem;
    }

    .hebrew-word {
        font-size: 2.2rem;
    }

    header {
        padding: 1rem;
    }

    .theme-switch button {
        padding: 3px 9px;
        font-size: 0.72rem;
    }

    .stats {
        font-size: 0.8rem;
    }

    .navbar {
        margin: 0.5rem 0;
    }

    .navbar-brand h6 {
        font-size: 1rem;
    }
}

/* Solo afectar el navbar específico de tu página */
header .navbar .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 1%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") !important;
}

/* Proteger específicamente el título H4 */
header .navbar .navbar-brand h4 {
    color: #f2f3f5 !important;
    margin: 0 !important;
}

/* Enlaces de Strong */
.strong-link {
    cursor: pointer;
    color: var(--secondary);
    text-decoration: none;
    transition: color 0.2s;
    border-bottom: 1px dotted var(--secondary);
}

.strong-link:hover {
    color: var(--accent);
    text-decoration: none;
    background-color: rgba(231, 76, 60, 0.1);
    border-radius: 4px;
}

/* Grid de palabras relacionadas */
.related-words-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
}

.related-card {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px;
    background: var(--light);
    transition: transform 0.2s;
}

.related-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    background: var(--surface);
}

.related-hebrew {
    font-family: var(--hebrew-font);
    font-size: 1.5rem;
    color: var(--text-strong);
    text-align: center;
}

.related-trans {
    font-size: 0.9rem;
    text-align: center;
    color: var(--accent);
}

.related-translation {
    font-weight: 600;
    text-align: center;
    font-size: 1rem;
    margin-top: 5px;
}

/* Botón flotante */
.floating-btn {
    position: fixed;
    bottom: 30px;
    left: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--secondary);
    color: white;
    border: none;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 1000;
    display: flex;
    /* Cambiado de none a flex, JS lo ocultará si es necesario */
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    opacity: 0;
    transform: scale(0.8);
    pointer-events: none;
}

.floating-btn.visible {
    opacity: 1;
    transform: scale(1);
    pointer-events: all;
}

.floating-btn:hover {
    background: var(--accent);
    transform: scale(1.1);
}

/* Sidebar de Alfabeto Hebreo */
.alpha-sidebar {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 5px;
    z-index: 1000;
    background: var(--surface-translucent);
    padding: 10px 5px;
    border-radius: 20px;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    max-height: 90vh;
    overflow-y: auto;
    /* Ocultar barra de desplazamiento */
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE/Edge */
}

.alpha-sidebar::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari */
}

.alpha-btn {
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--hebrew-font);
    font-size: 1.2rem;
    color: var(--text-strong);
    background: var(--surface);
    border: 1px solid var(--gray);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
}

.alpha-btn:hover {
    background: var(--light);
    color: var(--secondary);
    transform: scale(1.1);
    border-color: var(--secondary);
}

.alpha-btn.active {
    background: var(--secondary);
    color: white;
    border-color: var(--secondary);
    transform: scale(1.1);
    box-shadow: 0 2px 5px rgba(52, 152, 219, 0.4);
}

/* Ajustes responsivos para el sidebar */
@media (max-width: 1400px) {

    /* En pantallas medianas (laptops), reducir un poco el tamaño */
    .alpha-sidebar {
        right: 10px;
        padding: 8px 4px;
    }

    .alpha-btn {
        width: 30px;
        height: 30px;
        font-size: 1rem;
    }
}

@media (max-width: 768px) {

    /* En móviles, pegar al borde derecho y hacer semitransparente */
    .alpha-sidebar {
        right: 0;
        top: 55%;
        /* Un poco más abajo para no chocar con el header */
        border-radius: 15px 0 0 15px;
        /* Borde redondeado solo a la izquierda */
        padding: 5px 2px;
        background: var(--surface-translucent);
        backdrop-filter: blur(5px);
        box-shadow: -2px 0 5px rgba(0, 0, 0, 0.1);
        max-height: 80vh;
    }

    .alpha-btn {
        width: 28px;
        height: 28px;
        font-size: 0.9rem;
        margin: 1px 0;
        border-radius: 5px 0 0 5px;
        /* Botones más cuadrados hacia el borde */
        border-right: none;
    }

    .alpha-btn.active {
        width: 32px;
        /* Un poco más ancho al estar activo */
        margin-left: -4px;
        /* Efecto de "salir" */
        background: var(--secondary);
    }
}

/* ------------------------------------------------------------------
   Móvil en apaisado (poca altura). Va al final a propósito: así gana a
   los bloques por anchura, que también se aplican en esta orientación.
   ------------------------------------------------------------------ */
@media (max-height: 520px) {
    header {
        padding: 0.3rem 1rem;
    }

    /* El nombre y el logo ya están en la barra de navegación */
    .brand-header {
        display: none;
    }

    .theme-switch {
        padding-top: 0.1rem;
    }

    .theme-switch button {
        padding: 2px 8px;
        font-size: 0.7rem;
    }

    .theme-switch .swatch {
        width: 9px;
        height: 9px;
    }

    .navbar {
        padding: 0.2rem 0.6rem;
        margin: 0.2rem 0 0.4rem;
    }

    .navbar-brand h6 {
        font-size: 0.95rem;
        padding: 0.2rem 0;
    }

    .search-container {
        padding: 0.5rem;
        margin-bottom: 0.5rem;
    }

    .search-box {
        margin-bottom: 0.4rem;
    }

    .search-box i {
        left: 14px;
    }

    #searchInput {
        padding: 8px 12px 8px 40px;
        font-size: 1rem;
    }

    /* Filtros en una sola fila desplazable en lugar de varias líneas */
    .filters {
        flex-direction: row;
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
        gap: 6px;
    }

    .filters::-webkit-scrollbar {
        display: none;
    }

    .filters select,
    .filters .btn-secondary {
        flex: 0 0 auto;
        /* Un mínimo para que el texto del desplegable no se parta en varias líneas */
        min-width: 160px;
        padding: 6px 10px;
        font-size: 0.8rem;
        white-space: nowrap;
    }

    .stats {
        margin-top: 0.25rem;
        font-size: 0.72rem;
        gap: 10px;
    }

    main {
        padding: 0.5rem;
    }

    .controls {
        flex-direction: row;
        align-items: center;
        gap: 8px;
        margin-bottom: 0.35rem;
        padding: 0.15rem 0.5rem;
    }

    .controls label,
    .sort-controls select {
        font-size: 0.78rem;
    }

    .sort-controls select {
        padding: 3px 6px;
    }

    .btn-icon {
        padding: 4px 8px;
    }

    .entries-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        gap: 10px;
    }

    .entry-card {
        padding: 0.9rem;
    }

    .definition {
        max-height: 7rem;
    }

    .hebrew-word {
        font-size: 1.9rem;
    }

    .site-footer {
        padding: 0.9rem 1rem 1rem;
        margin-top: 1.2rem;
    }

    .footer-license {
        font-size: 0.7rem;
        line-height: 1.5;
    }

    /* El índice alfabético vertical pasa a barra horizontal inferior:
       en apaisado una columna fija robaría el poco ancho disponible. */
    .alpha-sidebar {
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        transform: none;
        flex-direction: row;
        flex-wrap: nowrap;
        justify-content: flex-start;
        gap: 3px;
        max-height: none;
        padding: 3px 6px;
        border-radius: 12px 12px 0 0;
        overflow-x: auto;
        overflow-y: hidden;
    }

    .alpha-btn {
        flex: 0 0 auto;
        width: 26px;
        height: 26px;
        margin: 0;
        font-size: 0.85rem;
        border-radius: 6px;
        border-right: 1px solid var(--gray);
    }

    .alpha-btn.active {
        width: 26px;
        margin-left: 0;
    }

    /* Deja hueco para que la barra no tape el final del contenido */
    body {
        padding-bottom: 34px;
    }

    .floating-btn {
        bottom: 38px;
    }
}

/* ------------------------------------------------------------------
   Modo incrustado: index.html?strong=H7225&embed=1
   Davar (o cualquier otra app) puede mostrar la ficha en una ventana
   flotante; aquí se oculta todo lo que no es la ficha en sí.
   ------------------------------------------------------------------ */
.embed header,
.embed footer,
.embed .alpha-sidebar,
.embed .floating-btn,
.embed .controls {
    display: none !important;
}

.embed .container {
    max-width: 100%;
    padding-left: 0;
    padding-right: 0;
}

.embed main {
    padding: 0.6rem;
}

.embed .entries-grid {
    display: block;
}

.embed .entry-card {
    margin: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: none;
}

.embed .entry-card:hover {
    transform: none;
}

/* Barra superior del modo incrustado (título + abrir ficha completa) */
.embed-bar {
    position: sticky;
    top: 0;
    z-index: 60;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 5px 10px;
    background: var(--header-bg);
    color: var(--text-strong);
    border-bottom: 1px solid var(--border);
    font-family: var(--sans-font);
    font-size: 0.78rem;
}

.embed-bar .embed-title {
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    opacity: 0.75;
}

.embed-bar .embed-open {
    color: var(--secondary);
    font-weight: 700;
    text-decoration: none;
}

.embed-bar .embed-open:hover {
    text-decoration: underline;
}

/* Ficha abierta desde un enlace de Davar */
.entry-card.is-target {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent) inset;
}

/* Enlace al versículo en Davar, dentro de los ejemplos */
.example-ref .davar-link {
    float: right;
    font-weight: 600;
    text-decoration: none;
    color: var(--secondary);
}

.example-ref .davar-link:hover {
    text-decoration: underline;
}

/* ------------------------------------------------------------------
   Modal de Conjugación Verbal (parser / weak)
   ------------------------------------------------------------------ */
.conjugate-badge {
    background: var(--accent);
    color: white;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: background 0.2s ease, transform 0.15s ease;
}

.conjugate-badge:hover {
    background: var(--primary);
    transform: translateY(-1px);
}

.card-actions-row {
    display: flex;
    gap: 8px;
    margin-top: 1rem;
}

.card-actions-row .details-btn {
    margin-top: 0;
    flex: 1;
}

.conjugate-card-btn {
    flex: 1;
    padding: 8px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 6px;
    font-family: var(--sans-font);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background 0.2s ease;
}

.conjugate-card-btn:hover {
    background: var(--primary);
}

#conjugateModal.modal {
    position: fixed;
    inset: 0;
    z-index: 1050;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    opacity: 1;
    transition: opacity 0.2s ease;
}

#conjugateModal.hidden {
    display: none !important;
    opacity: 0;
    pointer-events: none;
}

#conjugateModal .modal-content {
    max-width: 1050px;
    width: 95vw;
    height: 88vh;
    max-height: 88vh;
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.35);
}

#conjugateModal .modal-header {
    position: sticky;
    top: 0;
    background: var(--surface);
    z-index: 10;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
}

#conjugateModal .modal-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    white-space: nowrap;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 2;
    color: var(--text-strong);
}

.conjugate-modal-root {
    font-family: var(--font-hebrew);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary);
    white-space: nowrap;
    min-width: 0;
    flex-shrink: 1;
}

.conjugate-modal-type {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 12px;
    border-radius: 9999px;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
    flex-shrink: 0;
    background: var(--surface-2);
    color: var(--text-strong);
    border: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    user-select: none;
}

.conjugate-modal-type:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

.conjugate-modal-type::before {
    content: "";
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.conjugate-modal-type.type-strong {
    background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 100%);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.35);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.32);
}

.conjugate-modal-type.type-strong::before {
    background: #93c5fd;
    box-shadow: 0 0 6px #60a5fa;
}

.conjugate-modal-type.type-weak {
    background: linear-gradient(135deg, #d97706 0%, #ea580c 100%);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.35);
    box-shadow: 0 2px 8px rgba(234, 88, 12, 0.32);
}

.conjugate-modal-type.type-weak::before {
    background: #fde68a;
    box-shadow: 0 0 6px #f59e0b;
}

#conjugateModalExternal {
    margin-left: auto;
    font-size: 0.8rem;
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    white-space: nowrap;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 2;
}

#conjugateModalExternal:hover {
    text-decoration: underline;
}

#closeConjugateModal {
    flex: 0 0 auto;
    font-size: 1.8rem;
    line-height: 1;
    color: var(--muted);
    cursor: pointer;
    background: none;
    border: none;
    padding: 0 4px;
}

#closeConjugateModal:hover {
    color: var(--text-strong);
}

#conjugateModal .modal-body {
    flex: 1;
    min-height: 0;
    padding: 0;
    background: var(--surface);
}

#conjugateModalFrame {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

#relatedWordsModal .modal-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    padding-right: 50px;
}

#relatedWordsModal .close-btn {
    position: absolute;
    top: 8px;
    right: 12px;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    line-height: 1;
    color: var(--muted);
    cursor: pointer;
    background: none;
    border: none;
    border-radius: 6px;
    padding: 0;
    opacity: 0.85;
    z-index: 20;
    transition: opacity 0.2s ease, color 0.2s ease, background 0.2s ease, transform 0.15s ease;
}

#relatedWordsModal .close-btn:hover {
    opacity: 1;
    color: var(--text-strong);
    background: var(--hover-bg);
    transform: scale(1.1);
}

/* Dropdown navigation styles */
.nav-item.dropdown {
    position: relative;
}
.nav-link.dropdown-toggle[aria-expanded="true"],
.nav-link.dropdown-toggle.show {
    color: var(--text-strong) !important;
    background-color: var(--active-bg);
}
.dropdown-menu {
    background-color: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
    border-radius: 10px;
    padding: 6px 0;
    min-width: 200px;
}
.dropdown-item {
    color: var(--text);
    font-size: 0.92rem;
    font-weight: 500;
    padding: 8px 16px;
    display: block;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
}
.dropdown-item:hover,
.dropdown-item:focus {
    background-color: var(--hover-bg);
    color: var(--text-strong);
}
.dropdown-item:active,
.dropdown-item.active {
    background-color: var(--active-bg);
    color: var(--text-strong);
}

/* --- Aviso de carga del índice de tarjetas --------------------------------- */
.loading-note {
    grid-column: 1 / -1;
    margin: 32px 0;
    text-align: center;
    color: var(--muted);
    font-size: 0.95rem;
}

/* --- Aviso de instalación (PWA) -------------------------------------------- */
.install-banner {
    position: fixed;
    left: 50%;
    bottom: max(18px, env(safe-area-inset-bottom));
    transform: translateX(-50%);
    z-index: 1040;
    display: flex;
    align-items: center;
    gap: 14px;
    max-width: min(700px, calc(100vw - 24px));
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface-translucent);
    backdrop-filter: blur(6px);
    color: var(--text);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.24);
}
.install-banner[hidden] {
    display: none;
}
.install-banner-icon {
    flex: 0 0 auto;
    border-radius: 10px;
}
.install-banner-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 0.86rem;
    line-height: 1.35;
}
.install-banner-text strong {
    color: var(--text-strong);
    font-size: 0.95rem;
}
.install-banner-hint {
    color: var(--muted);
}
.install-banner-hint[hidden] {
    display: none;
}
.install-banner-actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
    flex: 0 0 auto;
}
.install-btn,
.install-later {
    border-radius: 999px;
    border: 1px solid transparent;
    padding: 8px 16px;
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
}
.install-btn {
    background: var(--accent);
    color: #fff;
}
.install-btn:hover {
    filter: brightness(1.08);
}
.install-later {
    background: transparent;
    border-color: var(--border);
    color: var(--muted);
}
.install-later:hover {
    color: var(--text-strong);
    border-color: var(--muted);
}
@media (max-width: 620px) {
    .install-banner {
        flex-wrap: wrap;
        bottom: max(12px, env(safe-area-inset-bottom));
    }
    .install-banner-actions {
        margin-left: 0;
        width: 100%;
        justify-content: flex-end;
    }
}


/* Barra de navegación unificada (Autónoma, no depende de Bootstrap externo) */
.navbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    border-radius: 12px;
    background: var(--surface-2) !important;
    border: 1px solid var(--border, var(--border-color, rgba(0,0,0,0.1)));
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    padding: 0.5rem 1rem;
    margin: 0.2rem 0 1rem 0;
    position: relative;
    box-sizing: border-box;
}

.navbar .container-fluid {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0;
    margin: 0;
}

.navbar-brand {
    text-decoration: none !important;
    display: inline-flex;
    align-items: center;
    margin-right: 1rem;
}

.navbar-brand h6 {
    color: var(--text-strong) !important;
    font-weight: 700;
    margin: 0;
    padding: 0.35rem 0;
    font-size: 1.05rem;
    text-decoration: none !important;
}

.navbar-collapse {
    display: flex;
    flex-basis: auto;
    flex-grow: 1;
    align-items: center;
}

.navbar-nav {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    list-style: none !important;
    margin: 0;
    padding: 0;
    gap: 4px;
    align-items: center;
}

.nav-item {
    list-style: none !important;
    margin: 0;
    padding: 0;
    position: relative;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    color: var(--text, var(--text-color, #333)) !important;
    font-weight: 500;
    padding: 0.45rem 0.85rem !important;
    margin: 0;
    border-radius: 8px;
    text-decoration: none !important;
    transition: all 0.2s ease;
    font-size: 0.92rem;
    border: 1px solid transparent;
}

.nav-link:hover {
    color: var(--text-strong) !important;
    background-color: var(--hover-bg);
    text-decoration: none !important;
    transform: translateY(-1px);
}

.nav-link.active {
    background-color: var(--active-bg);
    color: var(--text-strong) !important;
    font-weight: 700;
    border-color: var(--border, var(--border-color, rgba(0,0,0,0.1)));
    text-decoration: none !important;
}

.dropdown {
    position: relative;
}

.dropdown-toggle::after {
    display: inline-block;
    margin-left: 0.35em;
    vertical-align: 0.15em;
    content: "";
    border-top: 0.35em solid;
    border-right: 0.3em solid transparent;
    border-bottom: 0;
    border-left: 0.3em solid transparent;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1050;
    min-width: 13rem;
    padding: 0.4rem 0;
    margin: 0.25rem 0 0;
    font-size: 0.9rem;
    color: var(--text, var(--text-color, #333));
    text-align: left;
    list-style: none !important;
    background-color: var(--surface);
    border: 1px solid var(--border, var(--border-color, rgba(0,0,0,0.1)));
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.dropdown:hover .dropdown-menu,
.dropdown.show .dropdown-menu,
.dropdown-menu.show {
    display: block;
}

.dropdown-item {
    display: block;
    width: 100%;
    padding: 0.5rem 1.15rem;
    clear: both;
    font-weight: 500;
    color: var(--text, var(--text-color, #333)) !important;
    text-align: inherit;
    text-decoration: none !important;
    white-space: nowrap;
    background-color: transparent;
    border: 0;
    transition: background 0.15s ease, color 0.15s ease;
}

.dropdown-item:hover,
.dropdown-item:focus {
    color: var(--text-strong) !important;
    background-color: var(--hover-bg);
    text-decoration: none !important;
}

.navbar-toggler {
    display: none;
    padding: 0.35rem 0.65rem;
    font-size: 1.1rem;
    line-height: 1;
    background-color: transparent;
    border: 1px solid var(--border, var(--border-color, rgba(0,0,0,0.1)));
    border-radius: 8px;
    cursor: pointer;
}

.navbar-toggler-icon {
    display: inline-block;
    width: 1.5em;
    height: 1.5em;
    vertical-align: middle;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(120, 100, 80, 0.85)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 100%;
    filter: var(--toggler-filter);
}

@media (max-width: 991px) {
    .navbar-toggler {
        display: block;
    }
    .navbar-collapse {
        flex-basis: 100%;
        display: none;
        padding-top: 0.75rem;
    }
    .navbar-collapse.show {
        display: block;
    }
    .navbar-nav {
        flex-direction: column;
        align-items: stretch;
    }
    .nav-link {
        padding: 0.6rem 1rem !important;
    }
    .dropdown-menu {
        position: static;
        box-shadow: none;
        border: 1px solid var(--border, var(--border-color, rgba(0,0,0,0.1)));
        margin: 0.25rem 0.5rem;
    }
}

/* Fallbacks para iconos si FontAwesome es bloqueado por CSP */
.fa-search:empty::before,
.fas.fa-search:empty::before {
    content: "🔍";
    font-style: normal;
}

.fa-times:empty::before,
.fas.fa-times:empty::before {
    content: "✕";
    font-style: normal;
}
