/*
============================================================
LEGATUS — Hoja de Estilos (styles.css) — v4.1 RESPONSIVE
============================================================
CAMBIOS RESPONSIVE:
- Navegación inferior (bottom-nav) para móvil
- Chips de filtro más grandes y táctiles
- Tipografía escalada con clamp()
- Padding y spacing adaptativo
- Items del BOE con mejor área táctil
- Tarjetas de resultado/notificación apiladas
- Safe area para notch de iPhone
============================================================
*/

:root {
    --bg-base: #08090c;
    --bg-card: #0f1014;
    --bg-elevated: #171a20;
    --bg-input: #12141a;

    --border-subtle: #1e2030;
    --border-medium: #282a3a;

    --text-primary: #e8e8f0;
    --text-secondary: #8c8ca0;
    --text-muted: #555568;

    --accent: #c9a84c;
    --accent-hover: #dbbf64;
    --accent-subtle: rgba(201, 168, 76, 0.08);
    --accent-border: rgba(201, 168, 76, 0.2);

    --success: #4ade80;
    --error: #f87171;
    --info: #60a5fa;

    --font-body: 'DM Sans', system-ui, -apple-system, sans-serif;
    --font-display: 'Playfair Display', Georgia, serif;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;

    --shadow-card: 0 1px 3px rgba(0,0,0,0.5), 0 1px 2px rgba(0,0,0,0.4);
    --shadow-elevated: 0 10px 40px rgba(0,0,0,0.6);

    --color-laboral: #4ade80;
    --color-fiscal: #fbbf24;
    --color-penal: #f87171;
    --color-administrativo: #60a5fa;
    --color-civil: #c084fc;
    --color-mercantil: #2dd4bf;
    --color-general: #94a3b8;

    /* Altura de las barras de navegación */
    --topbar-height: 56px;
    --bottomnav-height: 64px;

    /* Safe area para notch de iPhone */
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html {
    /* Evita el scroll horizontal accidental en móvil */
    overflow-x: hidden;
}

body {
    font-family: var(--font-body);
    background: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -webkit-text-size-adjust: 100%;
    overflow-x: hidden;
}

.hidden {
    display: none !important;
}

/* Clases de visibilidad responsive */
.desktop-only {
    /* Visible por defecto, se oculta en móvil */
}

.mobile-only {
    display: none !important;
}


/* ============================================================
   PANTALLA DE LOGIN / REGISTRO
   ============================================================ */

.auth-container {
    min-height: 100vh;
    min-height: 100dvh; /* Dynamic viewport height (móviles modernos) */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    padding-top: calc(2rem + var(--safe-top));
    background:
        radial-gradient(ellipse at 30% 40%, rgba(201,168,76,0.04) 0%, transparent 60%),
        var(--bg-base);
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 2.5rem 2rem 2rem;
    box-shadow: var(--shadow-elevated);
    animation: fadeInUp 0.5s ease;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

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

.logo-icon {
    width: 56px;
    height: 56px;
    background: var(--accent-subtle);
    border: 1px solid var(--accent-border);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
}

.logo-svg {
    width: 28px;
    height: 28px;
    color: var(--accent);
}

.auth-title {
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 5vw, 2rem);
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--accent);
}

.auth-subtitle {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.auth-tabs {
    display: flex;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    padding: 3px;
    margin-bottom: 1.75rem;
}

.auth-tab {
    flex: 1;
    padding: 0.6rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-family: var(--font-body);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
    /* Mínimo táctil 44px */
    min-height: 44px;
}

.auth-tab.active {
    background: var(--bg-elevated);
    color: var(--text-primary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

.label-hint {
    font-size: 0.6875rem;
    color: var(--text-muted);
    font-weight: 400;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 12px;
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    pointer-events: none;
}

.input-wrapper input {
    width: 100%;
    padding: 0.75rem 0.75rem 0.75rem 2.5rem;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 16px; /* 16px evita el zoom automático en iOS */
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    outline: none;
    /* Altura táctil mínima */
    min-height: 48px;
}

.input-wrapper input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-subtle);
}

.input-wrapper input::placeholder {
    color: var(--text-muted);
}

.char-count {
    display: block;
    text-align: right;
    font-size: 0.6875rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.75rem 1.25rem;
    background: var(--accent);
    color: #0a0a0c;
    font-family: var(--font-body);
    font-size: 0.9375rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
    margin-top: 0.5rem;
    min-height: 48px; /* Área táctil */
}

.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-icon { width: 16px; height: 16px; }

.error-msg { color: var(--error); font-size: 0.8125rem; text-align: center; min-height: 1.2em; }
.success-msg { color: var(--success); font-size: 0.8125rem; text-align: center; min-height: 1.2em; }

.auth-footer {
    margin-top: 1.5rem;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-align: center;
}


/* ============================================================
   DASHBOARD
   ============================================================ */

.dashboard-container {
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--bg-base);
    animation: fadeInUp 0.4s ease;
}

/* --- Topbar --- */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    padding-top: var(--safe-top);
    height: calc(var(--topbar-height) + var(--safe-top));
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-subtle);
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.topbar-logo { width: 22px; height: 22px; color: var(--accent); }

.topbar-title {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--accent);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.topbar-separator {
    width: 1px;
    height: 24px;
    background: var(--border-medium);
}

/* Nav buttons (desktop) */
.topbar-nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.7rem;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    min-height: 36px;
}

.nav-btn i { width: 15px; height: 15px; }
.nav-btn:hover { color: var(--text-secondary); background: var(--bg-elevated); }

.nav-btn.active {
    color: var(--accent);
    background: var(--accent-subtle);
    border-color: var(--accent-border);
}

/* Badge de notificaciones */
.badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 16px;
    height: 16px;
    border-radius: 99px;
    background: var(--error);
    color: white;
    font-size: 0.625rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    line-height: 1;
}

.user-greeting {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.btn-ghost {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.75rem;
    background: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-size: 0.8125rem;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 36px;
}

.btn-ghost:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.btn-ghost i { width: 14px; height: 14px; }

/* --- Main content --- */
.dashboard-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}


/* ============================================================
   BOTTOM NAV (MÓVIL)
   ============================================================
   Patrón estándar de apps móviles: barra fija abajo
   con 3 botones grandes (>44px cada uno).
   ============================================================ */

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--bottomnav-height) + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    background: var(--bg-card);
    border-top: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 200;
}

.bottom-nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    flex: 1;
    height: var(--bottomnav-height);
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-body);
    font-size: 0.625rem;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s ease;
    position: relative;
    -webkit-tap-highlight-color: transparent;
}

.bottom-nav-btn i {
    width: 22px;
    height: 22px;
}

.bottom-nav-btn.active {
    color: var(--accent);
}

.bottom-nav-btn .badge {
    top: 6px;
    right: calc(50% - 20px);
}


/* ============================================================
   BÚSQUEDA
   ============================================================ */

.search-section {
    margin-bottom: 2rem;
}

.section-heading {
    font-family: var(--font-display);
    font-size: clamp(1.2rem, 4vw, 1.5rem);
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.section-desc {
    color: var(--text-secondary);
    font-size: clamp(0.8rem, 2.5vw, 0.875rem);
    margin-bottom: 1.25rem;
}

.search-bar-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.search-bar {
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    padding: 0 0.25rem 0 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-bar:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-subtle);
}

.search-icon { width: 18px; height: 18px; color: var(--text-muted); flex-shrink: 0; }

.search-bar input {
    flex: 1;
    padding: 0.85rem 0.75rem;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 16px; /* 16px = no zoom en iOS */
    outline: none;
    min-width: 0; /* Evita desbordamiento en flex */
}

.search-bar input::placeholder { color: var(--text-muted); }

.btn-search {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    border: none;
    border-radius: var(--radius-sm);
    color: #0a0a0c;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s ease;
}

.btn-search:hover { background: var(--accent-hover); }
.btn-search i { width: 18px; height: 18px; }

.search-filters {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.filter-group label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.filter-group input[type="date"] {
    padding: 0.5rem 0.5rem;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-size: 14px;
    outline: none;
    min-height: 40px;
}

.filter-group input[type="date"]:focus { border-color: var(--accent); }


/* ============================================================
   BOE DE HOY
   ============================================================ */

.boe-hoy-section { animation: fadeInUp 0.4s ease; }

.boe-hoy-header { margin-bottom: 1rem; }

.boe-hoy-title-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.25rem;
}

.boe-hoy-title-row i { width: 22px; height: 22px; color: var(--accent); }

.boe-hoy-fecha {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.boe-hoy-count {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.boe-hoy-loading {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
    color: var(--text-muted);
    padding: 2rem 0;
    justify-content: center;
}

.boe-hoy-item {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border-subtle);
    animation: fadeInUp 0.3s ease;
    transition: background 0.15s ease;
}

.boe-hoy-item:hover { background: var(--bg-elevated); }
.boe-hoy-item:last-child { border-bottom: none; }

.boe-hoy-item-title a {
    font-size: 0.875rem;
    color: var(--text-primary);
    text-decoration: none;
    line-height: 1.5;
    display: block;
    transition: color 0.2s;
}

.boe-hoy-item-title a:hover { color: var(--accent); }

.boe-hoy-item-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: 0.4rem;
    flex-wrap: wrap;
}

.boe-hoy-item-depto { font-size: 0.6875rem; color: var(--text-muted); }
.boe-hoy-item-tags { display: flex; gap: 0.3rem; flex-wrap: wrap; }


/* ============================================================
   FILTROS TEMÁTICOS
   ============================================================ */

.tematicas-filter {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.875rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
}

.tematicas-label {
    font-size: 0.6875rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.tematicas-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.tematica-checkbox {
    cursor: pointer;
    display: flex;
    align-items: center;
}

.tematica-checkbox input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.tematica-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.4rem 0.75rem;
    border-radius: 9999px;
    border: 1.5px solid var(--border-medium);
    color: var(--text-secondary);
    background: transparent;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    text-transform: capitalize;
    min-height: 36px; /* Área táctil */
    -webkit-tap-highlight-color: transparent;
}

.tematica-pill::before {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.5;
    transition: opacity 0.2s ease;
}

.tematica-checkbox:hover .tematica-pill {
    border-color: var(--text-muted);
}

.tematica-checkbox input:checked + .tematica-pill.laboral {
    color: var(--color-laboral); border-color: var(--color-laboral);
    background: rgba(74, 222, 128, 0.1);
}
.tematica-checkbox input:checked + .tematica-pill.fiscal {
    color: var(--color-fiscal); border-color: var(--color-fiscal);
    background: rgba(251, 191, 36, 0.1);
}
.tematica-checkbox input:checked + .tematica-pill.penal {
    color: var(--color-penal); border-color: var(--color-penal);
    background: rgba(248, 113, 113, 0.1);
}
.tematica-checkbox input:checked + .tematica-pill.administrativo {
    color: var(--color-administrativo); border-color: var(--color-administrativo);
    background: rgba(96, 165, 250, 0.1);
}
.tematica-checkbox input:checked + .tematica-pill.civil {
    color: var(--color-civil); border-color: var(--color-civil);
    background: rgba(192, 132, 252, 0.1);
}
.tematica-checkbox input:checked + .tematica-pill.mercantil {
    color: var(--color-mercantil); border-color: var(--color-mercantil);
    background: rgba(45, 212, 191, 0.1);
}

/* Chips dinámicos de preferencias */
.tematica-pill.custom { border-style: dashed; }
.tematica-checkbox input:checked + .tematica-pill.custom {
    color: var(--accent); border-color: var(--accent); border-style: solid;
    background: var(--accent-subtle);
}

.tematica-checkbox input:checked + .tematica-pill::before { opacity: 1; }

.tematica-checkbox input:focus-visible + .tematica-pill {
    outline: 2px solid var(--accent); outline-offset: 2px;
}

.tematica-checkbox:active .tematica-pill { transform: scale(0.95); }


/* ============================================================
   TAGS DE TEMÁTICA (en items y resultados)
   ============================================================ */

.tematica-tag {
    font-size: 0.625rem;
    font-weight: 600;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    text-transform: capitalize;
}

.tematica-tag.laboral        { background: rgba(74,222,128,0.12); color: var(--color-laboral); }
.tematica-tag.fiscal         { background: rgba(251,191,36,0.12); color: var(--color-fiscal); }
.tematica-tag.penal          { background: rgba(248,113,113,0.12); color: var(--color-penal); }
.tematica-tag.administrativo { background: rgba(96,165,250,0.12); color: var(--color-administrativo); }
.tematica-tag.civil          { background: rgba(192,132,252,0.12); color: var(--color-civil); }
.tematica-tag.mercantil      { background: rgba(45,212,191,0.12); color: var(--color-mercantil); }
.tematica-tag.general        { background: rgba(148,163,184,0.1); color: var(--color-general); }

.fecha-mod { color: var(--accent) !important; font-weight: 500; }
.result-tags { display: flex; gap: 0.3rem; flex-wrap: wrap; margin-bottom: 0.5rem; }


/* ============================================================
   BOTONES SECUNDARIOS
   ============================================================ */

.btn-clear-search {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.75rem;
    background: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    min-height: 40px;
}

.btn-clear-search:hover {
    background: var(--bg-elevated);
    color: var(--accent);
    border-color: var(--accent-border);
}

.btn-clear-search i { width: 14px; height: 14px; }


/* ============================================================
   RESULTADOS DE BÚSQUEDA
   ============================================================ */

.results-section { min-height: 200px; }

.search-status {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: var(--accent-subtle);
    border: 1px solid var(--accent-border);
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
    color: var(--accent);
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--accent-border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
}

.empty-icon { width: 40px; height: 40px; margin-bottom: 0.75rem; opacity: 0.4; }
.empty-state p { font-size: 0.875rem; }

.result-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
    transition: border-color 0.2s ease;
    animation: fadeInUp 0.35s ease;
}

.result-card:hover { border-color: var(--border-medium); }

.result-card h4 {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.4rem;
    line-height: 1.4;
}

.result-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.result-meta a { color: var(--accent); text-decoration: none; font-weight: 500; }
.result-meta a:hover { text-decoration: underline; }

.result-resumen {
    font-size: 0.8125rem;
    line-height: 1.65;
    color: var(--text-secondary);
    padding: 0.75rem 1rem;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--accent-border);
    white-space: pre-line;
}

.result-resumen-label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.result-resumen-label i { width: 12px; height: 12px; }


/* ============================================================
   NOTIFICACIONES / RESÚMENES
   ============================================================ */

.notificaciones-section { animation: fadeInUp 0.4s ease; }

.notif-header { margin-bottom: 1.5rem; }

.notif-title-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.25rem;
}

.notif-title-row i { width: 22px; height: 22px; color: var(--accent); }

.notif-desc {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.4rem;
}

.notif-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.btn-generar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.2rem;
    background: var(--accent);
    color: #0a0a0c;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 44px;
}

.btn-generar:hover { background: var(--accent-hover); }
.btn-generar:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-generar i { width: 16px; height: 16px; }

.notif-hint { font-size: 0.75rem; color: var(--text-muted); }

.generando-status {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: var(--accent-subtle);
    border: 1px solid var(--accent-border);
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
    color: var(--accent);
}

.notif-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
    transition: border-color 0.2s ease;
    animation: fadeInUp 0.35s ease;
}

.notif-card:hover { border-color: var(--border-medium); }

.notif-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.notif-card-date {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.notif-card-date i { width: 14px; height: 14px; }

.notif-card-pref {
    display: inline-flex;
    padding: 0.2rem 0.6rem;
    background: var(--accent-subtle);
    border: 1px solid var(--accent-border);
    border-radius: 9999px;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--accent);
}

.notif-card-body { margin-bottom: 0.75rem; }

.notif-card-resumen {
    font-size: 0.8125rem;
    line-height: 1.65;
    color: var(--text-secondary);
    padding: 0.75rem 1rem;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--accent-border);
    white-space: pre-line;
}

.notif-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.notif-card-meta { font-size: 0.6875rem; color: var(--text-muted); font-weight: 500; }

.notif-card-link {
    font-size: 0.75rem;
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    min-height: 44px;
    display: flex;
    align-items: center;
}

.notif-card-link:hover { text-decoration: underline; }

.notif-paginacion {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1rem 0;
}

.btn-pag {
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 40px;
}

.btn-pag:hover {
    background: var(--bg-elevated);
    color: var(--accent);
    border-color: var(--accent-border);
}

.pag-info { font-size: 0.75rem; color: var(--text-muted); }


/* ============================================================
   PREFERENCIAS
   ============================================================ */

.perfil-section { animation: fadeInUp 0.4s ease; }

.perfil-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.5rem;
}

.perfil-header i { width: 22px; height: 22px; color: var(--accent); }

.perfil-desc {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    max-width: 600px;
}

.pref-form {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    align-items: flex-start;
}

.pref-input-wrapper { flex: 1; }

.pref-input-wrapper input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    min-height: 48px;
}

.pref-input-wrapper input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-subtle);
}

.pref-input-wrapper input::placeholder { color: var(--text-muted); }

.btn-add-pref {
    width: auto;
    margin-top: 0;
    padding: 0.75rem 1.25rem;
    flex-shrink: 0;
    min-height: 48px;
}

.pref-feedback { min-height: 1.2em; margin-bottom: 0.5rem; }

.preferencias-lista { display: flex; flex-direction: column; gap: 0; }

.pref-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    margin-bottom: 0.5rem;
    transition: all 0.3s ease;
    animation: fadeInUp 0.3s ease;
}

.pref-item:hover { border-color: var(--border-medium); }

.pref-item-content {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex: 1;
    min-width: 0;
}

.pref-item-icon { width: 16px; height: 16px; color: var(--accent); flex-shrink: 0; }

.pref-item-texto {
    font-size: 0.875rem;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pref-item-actions { display: flex; gap: 0.25rem; flex-shrink: 0; }

.btn-icon-sm {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-icon-sm:hover { background: var(--bg-elevated); color: var(--text-secondary); }

.btn-icon-sm.btn-danger:hover {
    color: var(--error);
    border-color: rgba(248, 113, 113, 0.3);
    background: rgba(248, 113, 113, 0.08);
}

.btn-icon-sm i { width: 14px; height: 14px; }


/* ============================================================
   SCROLLBAR
   ============================================================ */

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-medium); border-radius: 3px; }


/* ============================================================
   RESPONSIVE — TABLET (max 768px)
   ============================================================ */

@media (max-width: 768px) {
    /* Ocultar elementos desktop, mostrar elementos móvil */
    .desktop-only { display: none !important; }
    .mobile-only  { display: flex !important; }

    .topbar {
        padding: 0 1rem;
    }

    /* Espacio inferior para el bottom-nav */
    .dashboard-main {
        padding: 1.5rem 1rem;
        padding-bottom: calc(var(--bottomnav-height) + var(--safe-bottom) + 1rem);
    }

    .search-section {
        margin-bottom: 1.5rem;
    }

    .section-heading {
        font-size: 1.25rem;
    }

    .result-card {
        padding: 1rem;
    }

    .notif-card {
        padding: 1rem;
    }

    .notif-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .btn-generar {
        justify-content: center;
    }
}


/* ============================================================
   RESPONSIVE — MÓVIL PEQUEÑO (max 480px)
   ============================================================ */

@media (max-width: 480px) {
    .auth-container {
        padding: 1rem;
        padding-top: calc(1rem + var(--safe-top));
        justify-content: flex-start;
        padding-top: calc(2rem + var(--safe-top));
    }

    .auth-card {
        padding: 1.5rem 1.25rem 1.25rem;
        border-radius: var(--radius-md);
    }

    .auth-header {
        margin-bottom: 1.5rem;
    }

    .logo-icon {
        width: 48px;
        height: 48px;
    }

    .auth-title {
        font-size: 1.5rem;
    }

    .dashboard-main {
        padding: 1rem 0.75rem;
        padding-bottom: calc(var(--bottomnav-height) + var(--safe-bottom) + 0.75rem);
    }

    .search-bar {
        padding: 0 0.15rem 0 0.75rem;
    }

    .search-bar input {
        padding: 0.75rem 0.5rem;
    }

    .search-filters {
        flex-direction: column;
        gap: 0.5rem;
        align-items: stretch;
    }

    .filter-group {
        flex: 1;
    }

    .filter-group input[type="date"] {
        flex: 1;
    }

    /* Filtros temáticos: scroll horizontal */
    .tematicas-chips {
        overflow-x: auto;
        flex-wrap: nowrap;
        gap: 0.35rem;
        padding-bottom: 0.25rem;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .tematicas-chips::-webkit-scrollbar {
        display: none;
    }

    .tematica-pill {
        white-space: nowrap;
        flex-shrink: 0;
    }

    /* BOE items más compactos */
    .boe-hoy-item {
        padding: 0.75rem;
    }

    .boe-hoy-item-title a {
        font-size: 0.8125rem;
        line-height: 1.45;
    }

    .boe-hoy-item-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.3rem;
    }

    /* Resultados */
    .result-card {
        padding: 0.875rem;
    }

    .result-card h4 {
        font-size: 0.875rem;
    }

    .result-meta {
        gap: 0.5rem;
    }

    .result-resumen {
        padding: 0.6rem 0.75rem;
        font-size: 0.75rem;
    }

    /* Notificaciones */
    .notif-card {
        padding: 0.875rem;
    }

    .notif-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.4rem;
    }

    .notif-card-resumen {
        padding: 0.6rem 0.75rem;
        font-size: 0.75rem;
    }

    /* Preferencias */
    .pref-form {
        flex-direction: column;
    }

    .btn-add-pref {
        width: 100%;
    }

    .pref-item {
        padding: 0.75rem;
    }

    .pref-item-texto {
        font-size: 0.8125rem;
    }

    /* Paginación */
    .notif-paginacion {
        gap: 0.5rem;
    }

    .btn-pag {
        padding: 0.4rem 0.75rem;
        font-size: 0.6875rem;
    }
}