/* Deal Expiry Pulse v1.0.5 */
/* FIX Rule 3: box-sizing reset on wrapper and on pulse bar (separate shortcode output) */
.dep-wrapper * { box-sizing: border-box !important; }
.dep-wrapper a { line-height: inherit !important; text-decoration: none !important; }
/* dep-pulse-bar is rendered by [expiry_pulse_bar] — a standalone element outside .dep-wrapper,
   so it needs its own box-sizing reset to satisfy DESIGN_GUIDE Rule 3. */
.dep-pulse-bar, .dep-pulse-bar * { box-sizing: border-box !important; }

:root {
    --brand-primary: #20C997;
    --font-primary: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --radius-md: 12px;
    --radius-sm: 8px;
    --radius-pill: 9999px;
    --shadow-md: 0 4px 12px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
    --transition-base: 250ms ease;

    /* Zone colours */
    --zone-critical-color: #ef4444;
    --zone-critical-bg: #fef2f2;
    --zone-today-color: #f97316;
    --zone-today-bg: #fff7ed;
    --zone-week-color: #f59e0b;
    --zone-week-bg: #fffbeb;
    --zone-fresh-color: #10b981;
    --zone-fresh-bg: #f0fdf4;
    --zone-evergreen-color: #3b82f6;
    --zone-evergreen-bg: #eff6ff;
}

.dep-wrapper { font-family: var(--font-primary); margin: 0 0 2rem; }

/* Header */
.dep-header { margin-bottom: 1.25rem; }

/* FIX Rule 2: .dep-heading is a heading element (h2) with flex children (icon + text).
   This is a layout container, not a text-only button — flex is correct here. */
.dep-heading {
    font-size: 1.25rem;
    font-weight: 700;
    color: #111827;
    margin: 0 0 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    line-height: 1.3;
}

/* BUG FIX: .dep-icon class was used in PHP heading but had no CSS rule. */
.dep-icon { font-size: 1.1rem; flex-shrink: 0; line-height: 1; }

.dep-subtitle { font-size: 0.85rem; color: #6b7280; margin: 0; }

/* Pulse bar */
.dep-pulse-bar {
    display: flex;
    height: 6px;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 1.5rem;
    background: #f3f4f6;
}

.dep-bar-seg { height: 100%; transition: width 0.4s ease; }
.dep-bar-seg.dep-zone-critical  { background: var(--zone-critical-color); }
.dep-bar-seg.dep-zone-today     { background: var(--zone-today-color); }
.dep-bar-seg.dep-zone-week      { background: var(--zone-week-color); }
.dep-bar-seg.dep-zone-fresh     { background: var(--zone-fresh-color); }
.dep-bar-seg.dep-zone-evergreen { background: var(--zone-evergreen-color); }

/* Swimlane */
.dep-swimlane {
    margin-bottom: 1.5rem;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    background: #fff;
}

.dep-zone-empty { opacity: 0.45; }

.dep-lane-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid #f3f4f6;
    background: #f9fafb;
}

.dep-lane-icon { font-size: 1.1rem; flex-shrink: 0; }

.dep-lane-labels { flex: 1; min-width: 0; }

.dep-lane-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: #111827;
    margin: 0;
    line-height: 1.2;
}

.dep-lane-sub {
    font-size: 0.75rem;
    color: #6b7280;
    display: block;
}

/* BUG FIX: #6b7280 on #e5e7eb had ~3.0:1 contrast — below WCAG AA.
   Changed to #4b5563 which achieves ~5.2:1 on #e5e7eb. */
.dep-lane-count {
    font-size: 0.8rem;
    font-weight: 700;
    color: #4b5563;
    background: #e5e7eb;
    border-radius: var(--radius-pill);
    padding: 0.15em 0.6em;
    flex-shrink: 0;
}

/* Zone header accent */
.dep-zone-critical .dep-lane-header  { border-left: 3px solid var(--zone-critical-color); }
.dep-zone-today    .dep-lane-header  { border-left: 3px solid var(--zone-today-color); }
.dep-zone-week     .dep-lane-header  { border-left: 3px solid var(--zone-week-color); }
.dep-zone-fresh    .dep-lane-header  { border-left: 3px solid var(--zone-fresh-color); }
.dep-zone-evergreen .dep-lane-header { border-left: 3px solid var(--zone-evergreen-color); }

/* Cards list */
.dep-cards {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.dep-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f9fafb;
    transition: background var(--transition-base);
}

.dep-card:last-child { border-bottom: none; }
.dep-card:hover { background: #f9fafb; }

/* Badges */
.dep-card-badges { display: flex; flex-direction: column; gap: 0.25rem; flex-shrink: 0; min-width: 48px; }

.dep-type-badge {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    padding: 0.15em 0.5em;
    border-radius: var(--radius-pill);
    text-align: center;
    text-transform: uppercase;
}

.dep-type-code .dep-type-badge { background: #f0fdf4; color: #15803d; }
.dep-type-sale .dep-type-badge { background: #eff6ff; color: #1d4ed8; }

.dep-pct-badge {
    font-size: 0.7rem;
    font-weight: 700;
    color: #374151;
    text-align: center;
}

/* Card body */
.dep-card-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.dep-card-brand {
    font-size: 0.82rem;
    font-weight: 700;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dep-card-title {
    font-size: 0.8rem;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Footer */
.dep-card-footer {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.3rem;
    flex-shrink: 0;
}

.dep-countdown {
    font-size: 0.7rem;
    font-weight: 700;
    color: #6b7280;
    white-space: nowrap;
}

.dep-zone-critical .dep-countdown { color: var(--zone-critical-color); }
.dep-zone-today    .dep-countdown { color: var(--zone-today-color); }

/* CTA */
/* FIX Rule 1: no visible border+border-radius combo — uses border:none + inset box-shadow only */
/* FIX Rule 2: text-only CTA link — uses display:inline-block + line-height (not inline-flex+align-items) */
.dep-cta {
    font-size: 0.75rem;
    font-weight: 600;
    color: #374151;
    padding: 0.5rem 0.7rem;
    border-radius: var(--radius-pill);
    border: none;
    box-shadow: inset 0 0 0 1.5px #d1d5db, 0 1px 2px rgba(0,0,0,0.04);
    transition: box-shadow var(--transition-base), color var(--transition-base);
    white-space: nowrap;
    /* BUG FIX: min-height was 36px — below 44px minimum touch target per DESIGN_GUIDE. */
    min-height: 44px;
    display: inline-block;
    line-height: 1.6;
    text-align: center;
}

.dep-cta:hover {
    box-shadow: inset 0 0 0 1.5px var(--brand-primary), 0 1px 2px rgba(0,0,0,0.04);
    color: #1AA67D;
}

/* Rebucket animation */
.dep-rebucketed {
    animation: dep-slide-in 0.3s ease forwards;
}

@keyframes dep-slide-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Mobile */
@media (max-width: 480px) {
    .dep-card { flex-wrap: wrap; gap: 0.5rem; }
    .dep-card-footer { flex-direction: row; align-items: center; width: 100%; justify-content: space-between; }
    .dep-cta { width: 100%; text-align: center; }
}

/* FIX Rule 4: Dark mode */
@media (prefers-color-scheme: dark) {
    .dep-wrapper, .dep-swimlane { color-scheme: dark; }
    .dep-heading { color: #f9fafb; }
    .dep-swimlane { background: #1f2937; }
    .dep-lane-header { background: #111827; border-bottom-color: #374151; }
    .dep-lane-title { color: #f9fafb; }
    /* BUG FIX v1.0.3: #9ca3af on #374151 = 3.2:1 (WCAG fail). Changed to #d1d5db (~8.5:1). */
    .dep-lane-count { background: #374151; color: #d1d5db; }
    .dep-card { border-bottom-color: #374151; }
    .dep-card:hover { background: #374151; }
    .dep-card-brand { color: #f9fafb; }
    .dep-card-title { color: #9ca3af; }
    /* BUG FIX v1.0.3: .dep-subtitle had no dark override — #6b7280 on dark bg = 3.6:1 (WCAG fail). */
    .dep-subtitle { color: #9ca3af; }
    /* BUG FIX v1.0.3: .dep-lane-sub had no dark override — #6b7280 on #111827 = 4.1:1 (WCAG fail). */
    .dep-lane-sub { color: #9ca3af; }
    /* BUG FIX v1.0.3: .dep-countdown had no dark override for week/fresh/evergreen zones.
       #6b7280 on #1f2937 = 3.6:1 (WCAG fail). Critical/today zones use zone-specific overrides. */
    .dep-countdown { color: #9ca3af; }
    /* BUG FIX v1.0.3: .dep-pct-badge had no dark override — #374151 on #1f2937 = 1.7:1 (invisible). */
    .dep-pct-badge { color: #d1d5db; }
    .dep-cta { color: #d1d5db; box-shadow: inset 0 0 0 1.5px #4b5563, 0 1px 2px rgba(0,0,0,0.3); }
    .dep-cta:hover { color: var(--brand-primary); box-shadow: inset 0 0 0 1.5px var(--brand-primary), 0 1px 2px rgba(0,0,0,0.3); }
    .dep-type-code .dep-type-badge { background: rgba(16,185,129,0.15); color: #6ee7b7; }
    .dep-type-sale .dep-type-badge { background: rgba(59,130,246,0.15); color: #93c5fd; }
    /* BUG FIX v1.0.4: .dep-pulse-bar bg had no dark override — #f3f4f6 on dark page is jarring. */
    .dep-pulse-bar { background: #374151; }
}

/* BUG FIX v1.0.4: :focus-visible for keyboard navigation (WCAG 2.4.7). */
.dep-cta:focus-visible {
    outline: 2px solid var(--brand-primary);
    outline-offset: 2px;
    box-shadow: inset 0 0 0 1.5px var(--brand-primary), 0 0 0 4px rgba(32,201,151,0.25);
}

/* FIX Rule 5: Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .dep-card, .dep-cta, .dep-bar-seg { transition: none; }
    .dep-rebucketed { animation: none; }
}
