/* ══════════════════════════════════════════════════════════════
   DISEASE DETAIL PAGE — /diseases/{slug}
   ══════════════════════════════════════════════════════════════ */

/* ── Page container ── */
/* Remove .main-content padding for detail pages — hero bleeds to edges, sticky tabs work */
.main-content:has(.detail-page) {
    padding: 0;
}

.detail-page {
    padding: 0 0 calc(80px + env(safe-area-inset-bottom));
    animation: detailFadeIn 0.35s ease-out;
}
@keyframes detailFadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Hero ── */
.detail-hero {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
    border-radius: 0 0 20px 20px;
    background: var(--gray-100);
}
.detail-hero-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.detail-hero-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.5rem;
    opacity: 0.7;
}
.detail-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.55) 0%, transparent 60%);
    pointer-events: none;
}
.detail-hero-badges {
    position: absolute;
    bottom: 12px;
    left: 14px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    z-index: 2;
}

/* ── Badge ── */
.detail-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    white-space: nowrap;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.detail-badge i { font-size: 0.6rem; }
.detail-badge-outline {
    background: rgba(255,255,255,0.85);
    color: var(--badge-c, var(--gray-700));
    border: 1px solid var(--badge-c, var(--gray-300));
}

/* ── Identity block ── */
.detail-identity {
    padding: 16px 16px 4px;
}
.detail-name-en {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--gray-900);
    margin: 0;
    line-height: 1.2;
}
.detail-name-hi {
    font-family: var(--font-hindi);
    font-size: 0.85rem;
    color: var(--gray-400);
    margin: 2px 0 0;
}
.detail-sci-name {
    font-size: 0.78rem;
    color: var(--gray-400);
    margin: 2px 0 0;
    font-style: italic;
}
.detail-aka {
    font-size: 0.72rem;
    color: var(--gray-500);
    margin: 4px 0 0;
}

/* ── Action bar ── */
.detail-actions {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    justify-content: center;
}
.detail-act-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 14px;
    border-radius: 20px;
    background: white;
    border: 1.5px solid rgba(0, 0, 0, 0.06);
    color: var(--gray-600);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-spring);
    -webkit-tap-highlight-color: transparent;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.detail-act-btn:active { transform: scale(0.92); }
.detail-act-btn i { font-size: 0.8rem; }

/* Active states — same as card-act-btn */
.detail-act-btn.reported {
    background: #fff7ed;
    border-color: rgba(249,115,22,0.4);
    color: #f97316;
}
.detail-act-btn.saved {
    background: #fffbeb;
    border-color: rgba(232,184,75,0.45);
    color: var(--color-accent);
}
.detail-act-btn.liked {
    background: #fee2e2;
    border-color: rgba(220,38,38,0.3);
    color: #dc2626;
}

/* ── Quick stats strip ── */
.detail-stats-scroll {
    overflow-x: auto;
    padding: 0 16px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.detail-stats-scroll::-webkit-scrollbar { display: none; }
.detail-stats {
    display: flex;
    gap: 8px;
    padding-bottom: 2px;
}
.detail-stat {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 32px;
    padding: 0 12px;
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.04);
    border-radius: var(--radius-full);
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.detail-stat i {
    font-size: 0.72rem;
    color: var(--color-primary);
}
.detail-stat-val {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--gray-800);
}
.detail-stat-unit {
    font-size: 0.65rem;
    color: var(--gray-500);
    font-weight: 500;
}
.detail-stat-warn i { color: #ea580c; }

/* ── Tab active color override (uses disease severity color) ── */
.detail-page .detail-tab.active {
    background: var(--sev-color, var(--color-primary));
    border-color: var(--sev-color, var(--color-primary));
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* ── Section containers ── */
.detail-section {
    padding: 12px 16px 0;
}

/* ── Info cards ── */
.detail-card {
    background: #fff;
    border-radius: 16px;
    padding: 0;
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(0, 0, 0, 0.03);
    overflow: hidden;
    animation: cardSlideUp 0.3s ease-out both;
}
@keyframes cardSlideUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}
.detail-card:nth-child(2) { animation-delay: 50ms; }
.detail-card:nth-child(3) { animation-delay: 100ms; }
.detail-card:nth-child(4) { animation-delay: 150ms; }

.detail-card-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.detail-card-head i {
    font-size: 0.9rem;
    color: var(--sev-color, var(--color-primary));
    width: 20px;
    text-align: center;
}
.detail-card-title {
    font-family: var(--font-display);
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--gray-800);
    margin: 0;
    flex: 1;
}
.detail-card-body {
    padding: 0 14px 14px;
}

/* Card variants */
.detail-card-green {
    border-left: 3px solid var(--color-primary);
}
.detail-card-green .detail-card-head i { color: var(--color-primary); }

.detail-card-leaf {
    border-left: 3px solid #22c55e;
    background: linear-gradient(135deg, rgba(34,197,94,0.03), transparent);
}
.detail-card-leaf .detail-card-head i { color: #22c55e; }

.detail-card-warn {
    border-left: 3px solid #f59e0b;
    background: linear-gradient(135deg, rgba(245,158,11,0.03), transparent);
}
.detail-card-warn .detail-card-head i { color: #f59e0b; }

/* ── Bilingual text ── */
.detail-text-en {
    font-size: 0.82rem;
    color: var(--gray-700);
    line-height: 1.6;
    margin: 0 0 6px;
}
.detail-text-hi {
    font-family: var(--font-hindi);
    font-size: 0.75rem;
    color: var(--gray-400);
    line-height: 1.5;
    margin: 0 0 10px;
    padding-top: 4px;
    border-top: 1px dotted var(--gray-200);
}

/* ── Numbered steps ── */
.detail-steps {
    list-style: none;
    counter-reset: step-counter;
    padding: 0;
    margin: 0;
}
.detail-step {
    counter-increment: step-counter;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 0 10px 36px;
    position: relative;
    border-bottom: 1px solid var(--gray-50);
}
.detail-step:last-child { border-bottom: none; }
.detail-step::before {
    content: counter(step-counter);
    position: absolute;
    left: 0;
    top: 10px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--sev-color, var(--color-primary));
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}
.detail-card-green .detail-step::before { background: var(--color-primary); }
.detail-card-leaf .detail-step::before { background: #22c55e; }

.detail-step-en {
    font-size: 0.82rem;
    color: var(--gray-700);
    line-height: 1.5;
}
.detail-step-hi {
    font-family: var(--font-hindi);
    font-size: 0.72rem;
    color: var(--gray-400);
    line-height: 1.4;
}

/* ── Season bar ── */
.season-bar-range {
    display: flex;
    align-items: center;
    gap: 10px;
}
.season-bar-start,
.season-bar-end {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--gray-700);
    white-space: nowrap;
}
.season-bar-line {
    flex: 1;
    height: 4px;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--sev-color, var(--color-primary)), transparent);
}

/* ── Spread chips ── */
.spread-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.spread-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--gray-50);
    border: 1px solid var(--gray-100);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-600);
}
.spread-chip i {
    font-size: 0.72rem;
    color: var(--sev-color, var(--color-primary));
}

/* ── Confused with ── */
.confused-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.confused-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--gray-50);
    border-radius: 10px;
    font-size: 0.8rem;
    color: var(--gray-700);
    font-weight: 500;
}
.confused-item i {
    color: var(--gray-400);
    font-size: 0.85rem;
}

/* ── Meter bars ── */
.detail-meter {
    margin-bottom: 12px;
}
.detail-meter:last-child { margin-bottom: 0; }
.detail-meter-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
}
.detail-meter-label {
    font-size: 0.72rem;
    color: var(--gray-500);
    font-weight: 500;
}
.detail-meter-value {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--gray-700);
}
.detail-meter-track {
    position: relative;
    width: 100%;
    height: 6px;
    background: var(--gray-100);
    border-radius: 3px;
    overflow: hidden;
}
.detail-meter-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.detail-meter-range {
    /* For range bars (altitude, temperature) — positioned with left + width */
    border-radius: 3px;
}

/* ── Gallery strip ── */
.detail-gallery {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
}
.detail-gallery::-webkit-scrollbar { display: none; }
.detail-gallery-thumb {
    flex: 0 0 auto;
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 10px;
    scroll-snap-align: start;
    cursor: pointer;
    border: 2px solid var(--gray-100);
    transition: border-color 0.15s, transform 0.1s;
}
.detail-gallery-thumb:active {
    transform: scale(0.95);
    border-color: var(--sev-color, var(--color-primary));
}

/* ── Lightbox ── */
.detail-lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0,0,0,0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: lightboxIn 0.25s ease-out;
}
.detail-lightbox[hidden] { display: none; }
@keyframes lightboxIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.lightbox-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
}
.lightbox-img {
    max-width: 100%;
    max-height: 80vh;
    border-radius: 12px;
    object-fit: contain;
}

/* ── Related section ── */
.detail-related-head {
    margin-bottom: 12px;
}
.detail-related-head .detail-card-title {
    font-size: 1rem;
}
.detail-related-scroll {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 8px;
}
.detail-related-scroll::-webkit-scrollbar { display: none; }
.detail-related-scroll .disease-card {
    min-width: 200px;
    max-width: 220px;
    flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════════════
   DESKTOP — wider hero, centered content
   ══════════════════════════════════════════════════════════════ */
/* ══════════════════════════════════════════════════════════════
   CAROUSEL — swipeable hero image gallery
   ══════════════════════════════════════════════════════════════ */
.disease-carousel {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    touch-action: pan-y;
}
.carousel-track {
    display: flex;
    width: 100%;
    height: 100%;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}
.carousel-slide {
    min-width: 100%;
    height: 100%;
    flex-shrink: 0;
}
.carousel-slide .detail-hero-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Dot indicators */
.carousel-dots {
    position: absolute;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    z-index: 5;
}
.carousel-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.5);
    padding: 0;
    cursor: pointer;
    transition: all 0.25s ease;
}
.carousel-dot.is-active {
    background: #fff;
    width: 20px;
    border-radius: 4px;
}

/* Counter badge */
.carousel-counter {
    position: absolute;
    top: 12px;
    right: 14px;
    background: rgba(0,0,0,0.5);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    z-index: 5;
    letter-spacing: 0.03em;
}

/* ── Thumbnail grid (in Identify section) ── */
.detail-thumb-grid {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 4px 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.detail-thumb-grid::-webkit-scrollbar { display: none; }

.detail-thumb-btn {
    flex-shrink: 0;
    width: 68px;
    height: 68px;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid transparent;
    padding: 0;
    cursor: pointer;
    background: none;
    transition: border-color 0.2s, transform 0.15s;
}
.detail-thumb-btn.is-active {
    border-color: var(--sev-color, #3a7d44);
}
.detail-thumb-btn:active {
    transform: scale(0.94);
}
.detail-thumb-btn img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

@media (min-width: 1024px) {
    .main-content:has(.detail-page) { padding: 0; }
    .detail-hero { height: 300px; border-radius: 0 0 24px 24px; }
    .detail-identity,
    .detail-actions,
    .detail-stats-scroll,
    .detail-section { max-width: 760px; margin-left: auto; margin-right: auto; }
    .detail-tabs-scroll .detail-tabs {
        max-width: 760px;
        margin: 0 auto;
    }
    .detail-stats { flex-wrap: wrap; overflow-x: visible; }
    .detail-related-scroll .disease-card { min-width: 220px; }
    .detail-related-scroll .disease-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
    .detail-thumb-btn { width: 80px; height: 80px; }
    .detail-thumb-btn:hover { transform: scale(1.05); box-shadow: var(--shadow-md); }
}
