/* ===== Skeleton Loading ===== */
.skeleton-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 22px;
    overflow: hidden;
    position: relative;
}
.skeleton-card::after {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent 25%, rgba(255,255,255,0.05) 50%, transparent 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s ease-in-out infinite;
}
.skel {
    background: var(--surface2);
    border-radius: 6px;
    margin-bottom: 12px;
}
.skel-top   { height: 18px; width: 38%; }
.skel-title { height: 14px; width: 60%; }
.skel-body  { height: 11px; width: 92%; margin-bottom: 8px; }
.skel-footer{ height: 11px; width: 28%; margin-bottom: 0; }

/* ===== Badges ===== */
.badge {
    padding: 3px 10px;
    border-radius: 50px;
    font-size: 0.68rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.04em;
}

.badge-food { background: var(--food-bg); color: var(--food); border: 1px solid rgba(52, 211, 153, 0.2); }
.badge-drug { background: var(--drug-bg); color: var(--drug); border: 1px solid rgba(167, 139, 250, 0.2); }
.badge-device { background: var(--device-bg); color: var(--device); border: 1px solid rgba(56, 189, 248, 0.2); }
.badge-consumer { background: var(--consumer-bg); color: var(--consumer); border: 1px solid rgba(249, 115, 22, 0.2); }
.badge-vehicle { background: var(--vehicle-bg); color: var(--vehicle); border: 1px solid rgba(250, 204, 21, 0.2); }

.badge-class-i { background: var(--class-i-bg); color: var(--class-i); border: 1px solid rgba(248, 113, 113, 0.2); box-shadow: 0 0 8px rgba(248, 113, 113, 0.15); }
.badge-class-ii { background: var(--class-ii-bg); color: var(--class-ii); border: 1px solid rgba(251, 191, 36, 0.2); }
.badge-class-iii { background: var(--class-iii-bg); color: var(--class-iii); border: 1px solid rgba(163, 230, 53, 0.2); }

/* ===== Recall Card ===== */
.recall-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    position: relative; overflow: hidden;
    display: flex; align-items: stretch;
}

.card-content {
    flex: 1;
    min-width: 0;
    padding: 18px 22px;
}

.recall-card::before {
    content: '';
    position: absolute; left: 0; top: 0; bottom: 0;
    width: 3px;
    transition: width var(--transition);
}

.recall-card[data-cat="food"]::before { background: var(--food); }
.recall-card[data-cat="drug"]::before { background: var(--drug); }
.recall-card[data-cat="device"]::before { background: var(--device); }
.recall-card[data-cat="consumer"]::before { background: var(--consumer); }
.recall-card[data-cat="vehicle"]::before { background: var(--vehicle); }

.recall-card:hover {
    border-color: var(--border-light);
    background: var(--surface2);
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.3);
}

.recall-card:hover::before { width: 4px; }

.card-top {
    display: flex; align-items: center;
    gap: 8px; margin-bottom: 10px; flex-wrap: wrap;
}

.card-firm { font-size: 0.98rem; font-weight: 600; margin-bottom: 4px; }

.card-product {
    font-size: 0.84rem; color: var(--text-muted);
    margin-bottom: 8px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.card-reason {
    font-size: 0.82rem; color: var(--text-muted);
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    border-left: 3px solid var(--border-light);
    margin-bottom: 12px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.recall-card[data-cat="food"] .card-reason { border-left-color: var(--food); }
.recall-card[data-cat="drug"] .card-reason { border-left-color: var(--drug); }
.recall-card[data-cat="device"] .card-reason { border-left-color: var(--device); }
.recall-card[data-cat="consumer"] .card-reason { border-left-color: var(--consumer); }
.recall-card[data-cat="vehicle"] .card-reason { border-left-color: var(--vehicle); }

.card-footer {
    display: flex; align-items: center;
    justify-content: space-between;
    font-size: 0.75rem; color: var(--text-dim);
}

.card-status { display: flex; align-items: center; gap: 6px; }

.card-actions {
    display: flex; align-items: center; gap: 2px;
}

.card-action {
    background: none; border: none;
    color: var(--text-dim); cursor: pointer;
    padding: 4px 6px; border-radius: 6px;
    transition: all var(--transition);
    display: flex; align-items: center;
}

.card-action:hover { color: var(--text); background: rgba(255,255,255,0.05); }
.card-action.bookmarked { color: var(--class-ii); }

.status-dot { width: 7px; height: 7px; border-radius: 50%; }

.status-dot.ongoing { background: var(--class-i); box-shadow: 0 0 6px rgba(248, 113, 113, 0.5); animation: pulse 2s ease-in-out infinite; }
.status-dot.completed { background: var(--food); }
.status-dot.terminated { background: var(--text-dim); }

/* ===== Card Image Panel ===== */
.card-img-panel {
    width: 156px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 14px 14px 0;
    border-left: 1px solid var(--border);
}

.card-img-wrap {
    width: 132px;
    height: 98px;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(255,255,255,0.04);
    flex-shrink: 0;
}

.card-img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
    transition: opacity 0.2s;
}

.card-img-dots, .modal-img-dots {
    display: flex; gap: 5px;
    align-items: center; justify-content: center;
}

.img-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
    flex-shrink: 0;
}
.img-dot:hover { background: rgba(255,255,255,0.5); }
.img-dot.active { background: var(--text-muted); transform: scale(1.2); }

/* Hide image panel in horizontal scroll strip (too cramped) */
.card-scroll .recall-card .card-img-panel { display: none; }
.card-scroll .recall-card .card-img-mobile { display: none; }

/* Mobile inline image — hidden on desktop, revealed via media query */
.card-img-mobile { display: none; margin: 10px 0 12px; }

.card-img-wrap-mobile {
    width: 100%; height: 160px;
    border-radius: 10px; overflow: hidden;
    background: rgba(255,255,255,0.04);
    position: relative;
}

.card-img-m {
    width: 100%; height: 100%;
    object-fit: cover; display: block;
    opacity: 0; transition: opacity 0.3s;
}
.card-img-wrap-mobile.img-loaded .card-img-m { opacity: 1; }

.card-img-wrap-mobile::after {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent 25%, rgba(255,255,255,0.07) 50%, transparent 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s ease-in-out infinite;
    border-radius: inherit;
    pointer-events: none; z-index: 1;
}
.card-img-wrap-mobile.img-loaded::after { display: none; }

.card-img-dots-mobile {
    position: absolute;
    bottom: 8px; left: 50%; transform: translateX(-50%);
    display: flex; gap: 5px;
    background: rgba(0,0,0,0.45);
    padding: 4px 10px; border-radius: 20px;
    z-index: 2;
}
.card-img-dots-mobile .img-dot { background: rgba(255,255,255,0.45); }
.card-img-dots-mobile .img-dot.active { background: #fff; transform: scale(1.2); }

/* ===== Modal Image Carousel ===== */
.modal-img-carousel {
    margin-bottom: 4px;
    display: flex; flex-direction: column;
    align-items: center; gap: 10px;
}
.img-disclaimer {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-align: center;
    margin: 0 0 16px;
    opacity: 0.7;
}

.modal-img-wrap {
    width: 100%;
    height: clamp(160px, 30vw, 260px);
    border-radius: 10px;
    overflow: hidden;
    background: rgba(255,255,255,0.04);
}

.modal-img {
    width: 100%; height: 100%;
    object-fit: contain; display: block;
    opacity: 0; transition: opacity 0.3s;
}
.modal-img-wrap.img-loaded .modal-img { opacity: 1; }

/* ===== Image Shimmer ===== */
.card-img-wrap, .modal-img-wrap { position: relative; }

.card-img-wrap::after, .modal-img-wrap::after {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent 25%, rgba(255,255,255,0.07) 50%, transparent 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s ease-in-out infinite;
    border-radius: inherit;
    pointer-events: none;
    z-index: 1;
}
.card-img-wrap.img-loaded::after, .modal-img-wrap.img-loaded::after { display: none; }

.card-img { opacity: 0; transition: opacity 0.3s; }
.card-img-wrap.img-loaded .card-img { opacity: 1; }

/* ===== Class I Danger Pulse ===== */
.badge-class-i { animation: dangerPulse 2s ease-in-out infinite; }

/* ===== Card Status Pill ===== */
.card-status {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 0.72rem; font-weight: 600;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
}

/* ===== Empty State ===== */
.empty-state {
    padding: 64px 24px;
    text-align: center;
    color: var(--text-dim);
}
.empty-state-icon { font-size: 3rem; margin-bottom: 16px; opacity: 0.5; }
.empty-state-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.1rem; font-weight: 600;
    color: var(--text-muted); margin-bottom: 8px;
}
.empty-state-sub { font-size: 0.85rem; }

.recall-date { font-size: 0.75rem; color: var(--text-dim); margin-left: auto; }

/* ===== Modal ===== */
.modal-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    z-index: 200;
    align-items: center; justify-content: center;
    padding: 20px;
}

.modal-overlay.active { display: flex; }

.modal {
    background: var(--bg2);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    max-width: 640px; width: 100%;
    max-height: 85vh; overflow-y: auto;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
    animation: modalIn 0.25s ease-out;
}

.modal-header {
    display: flex; align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1rem; font-weight: 700;
    flex: 1; min-width: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.modal-actions {
    display: flex; align-items: center; gap: 4px;
    flex-shrink: 0;
}

.modal-action-btn {
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-muted);
    transition: all var(--transition);
}

.modal-action-btn:hover { color: var(--text); background: var(--surface2); }
.modal-action-btn.bookmarked { color: var(--class-ii); border-color: var(--class-ii); }

.modal-close {
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    border: 1px solid var(--border-light);
    background: var(--surface);
    border-radius: 8px;
    cursor: pointer; font-size: 1.1rem;
    color: var(--text-muted);
    transition: all var(--transition);
}

.modal-close:hover { background: var(--surface2); color: var(--text); }

.modal-body { padding: 24px; }

.detail-row {
    display: flex; gap: 16px;
    margin-bottom: 14px; padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

.detail-row:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

.modal-ad-wrap {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    text-align: center;
}

.modal-ad-slot {
    margin: 8px auto 0;
    max-width: 300px;
    min-height: 250px;
}

.detail-label {
    font-size: 0.75rem; color: var(--text-dim);
    font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.05em;
    min-width: 120px; flex-shrink: 0;
}

.detail-value {
    font-size: 0.88rem; color: var(--text); line-height: 1.6;
}

/* ===== Toast ===== */
.toast {
    position: fixed;
    bottom: -60px; left: 50%;
    transform: translateX(-50%);
    background: var(--surface2);
    border: 1px solid var(--border-light);
    color: var(--text);
    padding: 12px 24px;
    border-radius: 50px;
    font-size: 0.85rem; font-weight: 600;
    z-index: 400;
    transition: bottom 0.3s ease;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.toast.show { bottom: 28px; }

/* ===== Ad Slot ===== */
.ad-slot {
    background: rgba(255, 255, 255, 0.02);
    border: 1px dashed var(--border-light);
    border-radius: var(--radius);
    padding: 24px; text-align: center;
    color: var(--text-dim); font-size: 0.78rem;
    margin: 20px 0;
}

/* ===== Scan Modal ===== */
.scan-live-area {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    background: #000;
    margin-bottom: 12px;
}
.scan-live-area #scan-reader { width: 100%; }
/* Strip the default html5-qrcode injected styles */
.scan-live-area #scan-reader > div { border: none !important; box-shadow: none !important; }
.scan-live-hint {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-dim);
    padding: 8px 0 4px;
}
.scan-upload-fallback {
    text-align: center;
    margin-bottom: 8px;
}
.scan-upload-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.78rem;
    text-decoration: underline;
    cursor: pointer;
    font-family: inherit;
    padding: 4px;
}
.scan-upload-btn:hover { color: var(--text); }
.scan-rescan-btn {
    display: block;
    width: 100%;
    margin-top: 8px;
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.82rem;
    font-family: inherit;
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
}
.scan-rescan-btn:hover { border-color: var(--border-light); color: var(--text); }
.scan-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    z-index: 300;
    align-items: center; justify-content: center;
    padding: 20px;
}

.scan-overlay.active { display: flex; }

.scan-modal {
    background: var(--bg2);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    max-width: 500px; width: 100%;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
    animation: modalIn 0.25s ease-out;
    overflow: hidden;
}

.scan-modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
}

.scan-modal-header h2 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1rem; font-weight: 700;
}

.scan-body { padding: 24px; }

.scan-drop {
    border: 2px dashed var(--border-light);
    border-radius: var(--radius);
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
}

.scan-drop:hover { border-color: #3b82f6; background: rgba(59, 130, 246, 0.04); }

.scan-drop-title { font-size: 0.95rem; font-weight: 600; color: var(--text); margin-top: 16px; margin-bottom: 4px; }
.scan-drop-sub { font-size: 0.8rem; color: var(--text-dim); }
.scan-drop-note { font-size: 0.72rem; color: var(--text-dim); margin-top: 10px; padding: 0 8px; line-height: 1.5; opacity: 0.75; }

.scan-preview { position: relative; border-radius: var(--radius); overflow: hidden; margin-bottom: 16px; }
.scan-preview img { width: 100%; max-height: 240px; object-fit: cover; display: block; border-radius: var(--radius); border: 1px solid var(--border); }
.scan-remove { position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,0.7); color: var(--text); border: none; border-radius: 6px; padding: 4px 12px; font-size: 0.75rem; cursor: pointer; font-family: inherit; font-weight: 600; }
.scan-remove:hover { background: rgba(239, 68, 68, 0.8); }

.scan-progress { margin: 20px 0; }
.scan-progress-bar { height: 6px; background: var(--border); border-radius: 6px; overflow: hidden; margin-bottom: 10px; }
.scan-progress-fill { height: 100%; width: 0%; background: linear-gradient(90deg, #3b82f6, #06b6d4); border-radius: 6px; transition: width 0.3s ease; }
.scan-progress-text { font-size: 0.8rem; color: var(--text-muted); text-align: center; }

.scan-results { margin-top: 16px; }
.scan-warning { font-size: 0.78rem; color: var(--text-muted); background: rgba(251,191,36,0.07); border: 1px solid rgba(251,191,36,0.2); border-radius: 8px; padding: 10px 14px; margin-bottom: 12px; line-height: 1.5; }
.scan-extracted { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.scan-results-label { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); display: block; margin-bottom: 8px; }
.scan-extracted-text { font-size: 0.88rem; color: var(--text); line-height: 1.6; max-height: 120px; overflow-y: auto; white-space: pre-wrap; word-break: break-word; }
.scan-search-btn { width: 100%; justify-content: center; }

/* ===== Subscribe Modal ===== */
.subscribe-modal {
    background: var(--bg2);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    max-width: 480px; width: 100%;
    padding: 32px;
    position: relative;
    animation: modalIn 0.25s ease both;
    max-height: 90vh;
    overflow-y: auto;
}

.subscribe-modal > .modal-close {
    position: absolute;
    top: 16px; right: 16px;
}

.sub-modal-icon {
    width: 52px; height: 52px;
    border-radius: 14px;
    background: rgba(59, 130, 246, 0.12);
    color: #3b82f6;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 16px;
}
.sub-icon-success { background: rgba(16, 185, 129, 0.12); color: #10b981; }

.sub-modal-title {
    font-size: 1.25rem; font-weight: 700;
    color: var(--text); margin: 0 0 6px;
}
.sub-modal-sub { font-size: 0.88rem; color: var(--text-muted); margin: 0 0 24px; }

.sub-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.sub-label { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }

.sub-input {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.9rem;
    padding: 10px 14px;
    width: 100%;
    box-sizing: border-box;
    transition: border-color 0.2s;
}
.sub-input:focus { outline: none; border-color: #3b82f6; }
.sub-select { appearance: none; cursor: pointer; }

.sub-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.sub-freq-row { display: flex; gap: 16px; flex-wrap: wrap; }
.sub-freq-opt {
    display: flex; align-items: center; gap: 8px;
    font-size: 0.88rem; color: var(--text-muted);
    cursor: pointer;
}
.sub-freq-opt input { accent-color: #3b82f6; }

.sub-submit-btn { width: 100%; justify-content: center; margin-top: 8px; font-size: 0.95rem; padding: 12px; }

.sub-fine { font-size: 0.72rem; color: var(--text-dim); text-align: center; margin: 10px 0 0; }
.sub-link { color: var(--text-muted); }

/* ── Keyword tag input ── */
.sub-keywords-field { margin-top: 4px; }
.sub-label-opt { font-size: 0.7rem; font-weight: 400; color: var(--text-dim); text-transform: none; letter-spacing: 0; margin-left: 6px; }
.sub-keywords-suggestions { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.kw-suggest {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: 50px;
    padding: 4px 12px;
    font-size: 0.78rem;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.kw-suggest:hover { border-color: #3b82f6; color: #3b82f6; }
.kw-suggest-active { background: rgba(59,130,246,0.15); border-color: #3b82f6; color: #3b82f6; }
.sub-keywords-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.kw-chip {
    display: inline-flex; align-items: center; gap: 5px;
    background: rgba(59,130,246,0.2);
    border: 1px solid rgba(59,130,246,0.4);
    color: #93c5fd;
    border-radius: 50px;
    padding: 4px 10px;
    font-size: 0.78rem;
    font-weight: 500;
}
.kw-chip-remove {
    background: none; border: none; color: #60a5fa;
    cursor: pointer; padding: 0; font-size: 14px; line-height: 1; opacity: 0.7;
}
.kw-chip-remove:hover { opacity: 1; }
.sub-keyword-input { margin-top: 0; }

@media (max-width: 480px) {
    .subscribe-modal { padding: 24px 20px; }
    .sub-row { grid-template-columns: 1fr; }
}
