/* =============================================
   alertas.css — ComerClaro Safety Intelligence
   Mobile-first, dark mode, Material Horizon
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800;900&display=swap');

/* ── Variables ── */
:root {
    --c-bio:   #ef4444;
    --c-alle:  #f97316;
    --c-supp:  #8b5cf6;
    --c-phys:  #f59e0b;
    --c-other: #64748b;
    --c-safe:  #10b981;
    --radius:  1.25rem;
    --card-shadow: 0 1px 3px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.06);
    --card-shadow-hover: 0 4px 6px rgba(0,0,0,.06), 0 12px 32px rgba(0,0,0,.10);
}

/* ── Page wrapper ── */
.al-page {
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    padding-bottom: 3rem;
}

/* ── Hero ── */
.al-hero {
    position: relative;
    padding: 2.5rem 1.25rem 2rem;
    text-align: center;
    overflow: hidden;
}
.al-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(239,68,68,.08) 0%, transparent 70%);
    pointer-events: none;
}
.dark .al-hero::before {
    background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(239,68,68,.12) 0%, transparent 70%);
}

.al-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: .375rem;
    padding: .375rem .875rem;
    border-radius: 999px;
    background: rgba(239,68,68,.1);
    color: #ef4444;
    font-size: .7rem;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
    margin-bottom: 1.25rem;
    border: 1px solid rgba(239,68,68,.2);
}
.dark .al-hero-badge {
    background: rgba(239,68,68,.15);
    border-color: rgba(239,68,68,.3);
}
.al-hero-badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #ef4444;
    animation: al-pulse 1.8s ease-in-out infinite;
}
@keyframes al-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: .4; transform: scale(.7); }
}

.al-hero-title {
    font-size: clamp(1.75rem, 6vw, 2.75rem);
    font-weight: 900;
    letter-spacing: -.03em;
    line-height: 1.1;
    color: #0f172a;
    margin-bottom: .75rem;
}
.dark .al-hero-title { color: #f8fafc; }

.al-hero-sub {
    font-size: .9rem;
    color: #64748b;
    max-width: 36rem;
    margin: 0 auto 1.75rem;
    line-height: 1.6;
}
.dark .al-hero-sub { color: #94a3b8; }

/* Stat pills row */
.al-stats {
    display: flex;
    justify-content: center;
    gap: .625rem;
    flex-wrap: wrap;
}
.al-stat {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .5rem 1rem;
    border-radius: 999px;
    background: rgba(255,255,255,.9);
    border: 1px solid rgba(203,213,225,.5);
    font-size: .8rem;
    font-weight: 700;
    color: #334155;
    backdrop-filter: blur(8px);
}
.dark .al-stat {
    background: rgba(30,41,59,.9);
    border-color: rgba(255,255,255,.08);
    color: #cbd5e1;
}
.al-stat-num {
    font-size: 1.1rem;
    font-weight: 900;
    letter-spacing: -.02em;
}
.al-stat-num.red    { color: var(--c-bio); }
.al-stat-num.orange { color: var(--c-alle); }
.al-stat-num.green  { color: var(--c-safe); }

/* ── Filtros ── */
.al-filters-wrap {
    position: sticky;
    top: 0;
    z-index: 40;
    background: rgba(248,250,252,.95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(203,213,225,.4);
    padding: .75rem 1.25rem;
}
.dark .al-filters-wrap {
    background: rgba(9,9,11,.95);
    border-bottom-color: rgba(255,255,255,.06);
}

.al-filters-inner {
    max-width: 1280px;
    margin: 0 auto;
}

.al-filters-scroll {
    display: flex;
    gap: .5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
}
.al-filters-scroll::-webkit-scrollbar { display: none; }

.al-filter {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: .375rem;
    padding: .5rem 1rem;
    border-radius: 999px;
    font-size: .8rem;
    font-weight: 700;
    border: 1.5px solid transparent;
    cursor: pointer;
    transition: all .2s;
    white-space: nowrap;
    text-decoration: none;
    background: rgba(255,255,255,.8);
    color: #475569;
    border-color: rgba(203,213,225,.6);
}
.dark .al-filter {
    background: rgba(30,41,59,.8);
    color: #94a3b8;
    border-color: rgba(255,255,255,.08);
}
.al-filter:hover { transform: translateY(-1px); box-shadow: 0 2px 8px rgba(0,0,0,.08); }

/* Active states per type */
.al-filter.f-all.on     { background:#0f172a; color:#fff; border-color:#0f172a; }
.al-filter.f-bio.on     { background:var(--c-bio); color:#fff; border-color:var(--c-bio); }
.al-filter.f-alle.on    { background:var(--c-alle); color:#fff; border-color:var(--c-alle); }
.al-filter.f-supp.on    { background:var(--c-supp); color:#fff; border-color:var(--c-supp); }
.al-filter.f-phys.on    { background:var(--c-phys); color:#fff; border-color:var(--c-phys); }
.al-filter.f-other.on   { background:var(--c-other); color:#fff; border-color:var(--c-other); }
.al-filter.f-active.on  { background:var(--c-safe); color:#fff; border-color:var(--c-safe); }
.al-filter.f-hist.on    { background:#475569; color:#fff; border-color:#475569; }
.dark .al-filter.f-all.on { background:#f8fafc; color:#0f172a; border-color:#f8fafc; }

.al-divider {
    flex-shrink: 0;
    width: 1px;
    background: rgba(203,213,225,.5);
    margin: .25rem 0;
    align-self: stretch;
}
.dark .al-divider { background: rgba(255,255,255,.08); }

/* ── Content area ── */
.al-content {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1.5rem 1.25rem 0;
}

/* Results bar */
.al-results-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}
.al-results-count {
    font-size: .8rem;
    font-weight: 700;
    color: #64748b;
}
.dark .al-results-count { color: #94a3b8; }
.al-results-count strong { color: #0f172a; }
.dark .al-results-count strong { color: #f8fafc; }
.al-sync-info {
    font-size: .7rem;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: .25rem;
}

/* ── Cards grid ── */
.al-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}
@media (min-width: 640px)  { .al-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .al-grid { grid-template-columns: repeat(3, 1fr); } }

/* ── Card ── */
.al-card {
    background: #fff;
    border-radius: var(--radius);
    border: 1px solid rgba(203,213,225,.5);
    box-shadow: var(--card-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform .25s, box-shadow .25s;
    position: relative;
    animation: al-fade-in .4s ease both;
}
.dark .al-card {
    background: #111113;
    border-color: rgba(255,255,255,.06);
}
.al-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--card-shadow-hover);
}
@keyframes al-fade-in {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Staggered animation */
.al-card:nth-child(1)  { animation-delay: .03s; }
.al-card:nth-child(2)  { animation-delay: .06s; }
.al-card:nth-child(3)  { animation-delay: .09s; }
.al-card:nth-child(4)  { animation-delay: .12s; }
.al-card:nth-child(5)  { animation-delay: .15s; }
.al-card:nth-child(6)  { animation-delay: .18s; }
.al-card:nth-child(7)  { animation-delay: .21s; }
.al-card:nth-child(8)  { animation-delay: .24s; }
.al-card:nth-child(9)  { animation-delay: .27s; }
.al-card:nth-child(10) { animation-delay: .30s; }
.al-card:nth-child(11) { animation-delay: .33s; }
.al-card:nth-child(12) { animation-delay: .36s; }

/* Left accent bar */
.al-card-bar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    border-radius: 0 0 0 0;
}
.bar-bio   { background: var(--c-bio); }
.bar-alle  { background: var(--c-alle); }
.bar-supp  { background: var(--c-supp); }
.bar-phys  { background: var(--c-phys); }
.bar-other { background: var(--c-other); }

.al-card-body {
    padding: 1.125rem 1.125rem 1.125rem 1.375rem;
    display: flex;
    flex-direction: column;
    gap: .625rem;
    flex: 1;
}

/* Top row: type badge + status */
.al-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
}

.al-type-badge {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .25rem .625rem;
    border-radius: 999px;
    font-size: .65rem;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}
.badge-bio   { background: rgba(239,68,68,.1);  color: var(--c-bio);  }
.badge-alle  { background: rgba(249,115,22,.1); color: var(--c-alle); }
.badge-supp  { background: rgba(139,92,246,.1); color: var(--c-supp); }
.badge-phys  { background: rgba(245,158,11,.1); color: var(--c-phys); }
.badge-other { background: rgba(100,116,139,.1);color: var(--c-other);}
.dark .badge-bio   { background: rgba(239,68,68,.18);  }
.dark .badge-alle  { background: rgba(249,115,22,.18); }
.dark .badge-supp  { background: rgba(139,92,246,.18); }
.dark .badge-phys  { background: rgba(245,158,11,.18); }
.dark .badge-other { background: rgba(100,116,139,.18);}

.al-status {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    font-size: .65rem;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}
.al-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}
.status-active-dot {
    background: var(--c-bio);
    animation: al-pulse 1.8s ease-in-out infinite;
}
.status-active-text { color: var(--c-bio); }
.status-expired-dot { background: #94a3b8; }
.status-expired-text { color: #94a3b8; }

/* Product name */
.al-card-name {
    font-size: 1rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.35;
    letter-spacing: -.01em;
}
.dark .al-card-name { color: #f1f5f9; }

.al-card-brand {
    font-size: .8rem;
    color: #64748b;
    font-weight: 500;
    margin-top: -.375rem;
}
.dark .al-card-brand { color: #94a3b8; }

/* Risk pill */
.al-risk-pill {
    display: inline-flex;
    align-items: center;
    gap: .375rem;
    padding: .3rem .75rem;
    border-radius: .625rem;
    font-size: .72rem;
    font-weight: 800;
    width: fit-content;
}
.risk-bio  { background: rgba(239,68,68,.08); color: #dc2626; border: 1px solid rgba(239,68,68,.2); }
.risk-alle { background: rgba(249,115,22,.08);color: #ea580c; border: 1px solid rgba(249,115,22,.2); }
.risk-supp { background: rgba(139,92,246,.08);color: #7c3aed; border: 1px solid rgba(139,92,246,.2); }
.risk-phys { background: rgba(245,158,11,.08);color: #d97706; border: 1px solid rgba(245,158,11,.2); }
.dark .risk-bio  { background: rgba(239,68,68,.15);  color: #f87171; border-color: rgba(239,68,68,.3); }
.dark .risk-alle { background: rgba(249,115,22,.15); color: #fb923c; border-color: rgba(249,115,22,.3); }
.dark .risk-supp { background: rgba(139,92,246,.15); color: #a78bfa; border-color: rgba(139,92,246,.3); }
.dark .risk-phys { background: rgba(245,158,11,.15); color: #fbbf24; border-color: rgba(245,158,11,.3); }

/* Allergen tag */
.al-allergen-tag {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .25rem .625rem;
    border-radius: .5rem;
    background: rgba(249,115,22,.08);
    border: 1px solid rgba(249,115,22,.2);
    color: #ea580c;
    font-size: .7rem;
    font-weight: 700;
    width: fit-content;
}
.dark .al-allergen-tag {
    background: rgba(249,115,22,.15);
    border-color: rgba(249,115,22,.3);
    color: #fb923c;
}

/* Description */
.al-card-desc {
    font-size: .8rem;
    color: #475569;
    line-height: 1.55;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.dark .al-card-desc { color: #94a3b8; }

/* Card footer */
.al-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: .625rem;
    margin-top: auto;
    border-top: 1px solid rgba(203,213,225,.3);
}
.dark .al-card-footer { border-top-color: rgba(255,255,255,.05); }

.al-card-date {
    font-size: .72rem;
    color: #94a3b8;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: .3rem;
}

.al-card-link {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    font-size: .72rem;
    font-weight: 800;
    color: #10b981;
    text-decoration: none;
    padding: .25rem .625rem;
    border-radius: .5rem;
    transition: background .2s;
}
.al-card-link:hover { background: rgba(16,185,129,.08); }

/* ── Empty state ── */
.al-empty {
    text-align: center;
    padding: 4rem 1.5rem;
    background: #fff;
    border-radius: var(--radius);
    border: 1px solid rgba(203,213,225,.5);
}
.dark .al-empty {
    background: #111113;
    border-color: rgba(255,255,255,.06);
}
.al-empty-icon { font-size: 2.5rem; margin-bottom: .75rem; color: var(--c-safe); }
.al-empty-title { font-size: 1.1rem; font-weight: 800; color: #0f172a; margin-bottom: .375rem; }
.dark .al-empty-title { color: #f8fafc; }
.al-empty-text { font-size: .85rem; color: #64748b; }
.dark .al-empty-text { color: #94a3b8; }

/* ── Paginación ── */
.al-pagination {
    display: flex;
    justify-content: center;
    margin-top: 2rem;
}
.al-pag-inner {
    display: flex;
    align-items: center;
    gap: .375rem;
    background: #fff;
    padding: .375rem;
    border-radius: 1rem;
    border: 1px solid rgba(203,213,225,.5);
    box-shadow: var(--card-shadow);
}
.dark .al-pag-inner {
    background: #111113;
    border-color: rgba(255,255,255,.06);
}
.al-pag-btn {
    min-width: 2.25rem;
    height: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: .625rem;
    font-size: .8rem;
    font-weight: 700;
    text-decoration: none;
    color: #475569;
    transition: all .2s;
    padding: 0 .5rem;
}
.dark .al-pag-btn { color: #94a3b8; }
.al-pag-btn:hover:not(.on) { background: #f1f5f9; }
.dark .al-pag-btn:hover:not(.on) { background: rgba(255,255,255,.06); }
.al-pag-btn.on { background: #10b981; color: #fff; box-shadow: 0 2px 8px rgba(16,185,129,.3); }
.al-pag-dots { min-width: 2rem; text-align: center; color: #94a3b8; font-size: .85rem; }

/* ── Footer note ── */
.al-foot-note {
    text-align: center;
    font-size: .72rem;
    color: #94a3b8;
    padding: 2rem 1.25rem 0;
    max-width: 1280px;
    margin: 0 auto;
}
.al-foot-note a { color: #10b981; text-decoration: none; }
.al-foot-note a:hover { text-decoration: underline; }

/* ── Alertas urgentes (banner top) ── */
.al-urgent-bar {
    background: linear-gradient(90deg, #7f1d1d, #dc2626);
    color: #fff;
    padding: .625rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .625rem;
    font-size: .78rem;
    font-weight: 700;
    text-align: center;
}
.al-urgent-bar i { animation: al-pulse 1.5s ease-in-out infinite; }