/**
 * Workdays & Public Holidays Calculator — scoped styles.
 * Reuses form-grid, form-group, form-label, form-input from main.css.
 */

/* ── Controls ─────────────────────────────────────────────────────────────── */
.wd-controls {
    margin-bottom: var(--space-6);
}

.wd-controls__top {
    margin-bottom: var(--space-5);
}

/* ── Mode tabs ────────────────────────────────────────────────────────────── */
.wd-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: var(--space-5);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.wd-tabs::-webkit-scrollbar { display: none; }

.wd-tab {
    display: inline-flex;
    align-items: center;
    padding: var(--space-3) var(--space-5);
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-2);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    cursor: pointer;
    white-space: nowrap;
    transition: color var(--transition-fast), border-color var(--transition-fast);
}
.wd-tab:hover { color: var(--color-text-1); }
.wd-tab--active {
    color: var(--color-accent);
    border-bottom-color: var(--color-accent);
}

/* ── Result area ──────────────────────────────────────────────────────────── */
.wd-result-area {
    margin-top: var(--space-6);
}

/* ── Loading spinner ──────────────────────────────────────────────────────── */
.wd-loading:not([hidden]) {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    color: var(--color-text-2);
    font-size: var(--text-sm);
    padding: var(--space-4) 0;
}

.wd-loading__spinner {
    display: inline-block;
    width: 1.1em;
    height: 1.1em;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: wd-spin 0.7s linear infinite;
    flex-shrink: 0;
}

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

/* ── Error state ──────────────────────────────────────────────────────────── */
.wd-error {
    padding: var(--space-4) var(--space-5);
    background: rgba(220, 80, 60, 0.08);
    border: 1px solid rgba(220, 80, 60, 0.25);
    border-radius: var(--radius-md);
    color: var(--color-error);
    font-size: var(--text-sm);
}

/* ── Summary cards ────────────────────────────────────────────────────────── */
.wd-cards:not([hidden]) {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-5);
}

.wd-card:not([hidden]) {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--space-5) var(--space-4);
    background: var(--color-surface-2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    gap: var(--space-2);
    transition: border-color var(--transition-fast);
}

.wd-card--primary {
    border-color: var(--color-accent);
    background: var(--color-accent-dim, rgba(var(--color-accent-rgb, 99, 179, 237), 0.06));
}



.wd-card__value {
    font-family: var(--font-mono);
    font-size: var(--text-3xl, 2rem);
    font-weight: var(--font-weight-bold, 700);
    color: var(--color-text-1);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.wd-card--primary .wd-card__value {
    color: var(--color-accent);
}



.wd-card__label {
    font-size: var(--text-xs);
    color: var(--color-text-2);
    line-height: 1.3;
    height: 35px;
}

/* ── Period label ─────────────────────────────────────────────────────────── */
.wd-period-label {
    font-size: var(--text-sm);
    color: var(--color-text-2);
    margin-bottom: var(--space-6);
    font-variant-numeric: tabular-nums;
}

/* ── Holiday section ──────────────────────────────────────────────────────── */
.wd-holidays {
    border-top: 1px solid var(--color-border);
    padding-top: var(--space-6);
}

.wd-holidays__title {
    font-size: var(--text-base);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-1);
    margin-bottom: var(--space-5);
}

/* ── Month groups ─────────────────────────────────────────────────────────── */
.wd-month-group {
    margin-bottom: var(--space-5);
}

.wd-month-group__title {
    font-size: var(--text-xs);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-2);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: var(--space-2);
}

/* ── Holiday list ─────────────────────────────────────────────────────────── */
.wd-holiday-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.wd-holiday {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    /*transition: background var(--transition-fast);*/
    background: rgba(197, 216, 229, 0.04);
    margin-top: 7px;
}

.wd-holiday:hover {
    background: var(--color-surface-2);
}

.wd-holiday--in-period {
    /*background: var(--color-accent-dim, rgba(99, 179, 237, 0.05));*/
    background: var(--color-surface-2, rgba(99, 179, 237, 0.05));
    border: 1px solid var(--color-border);
    
}

.wd-holiday--in-period:hover {
    background: var(--color-accent-dim, rgba(99, 179, 237, 0.1));
}

.wd-holiday--weekend {
     /*background: var(--color-accent-dim, rgba(224, 21, 54, 0.861));*/
    /*opacity: 0.6;*/
}


.wd-holiday__date {
    display: flex;
    flex-direction: column;
    gap: 1px;
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--color-text-2);
    white-space: nowrap;
    min-width: 4.5rem;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.wd-holiday__dow {
    font-size: 12px;
    color: var(--color-text-3);
}

.wd-holiday__name {
    flex: 1;
    color: var(--color-text-1);
}

.wd-holiday__name-alt {
    color: var(--color-text-2);
    font-size: var(--text-xs);
}

.wd-holiday__subdivisions {
    display: block;
    font-size: 10px;
    color: var(--color-text-3);
    margin-top: 2px;
    line-height: 1.3;
}

.wd-holiday__badges {
    display: flex;
    gap: var(--space-1);
    flex-shrink: 0;
}

/* ── Badges ───────────────────────────────────────────────────────────────── */
.wd-badge {
    display: inline-flex;
    align-items: center;
    padding: 1px var(--space-2);
    border-radius: var(--radius-full);
    font-size: 10px;
    font-weight: var(--font-weight-semibold);
    white-space: nowrap;
    letter-spacing: 0.02em;
}

.wd-badge--weekend {
    /*background: rgba(150, 150, 150, 0.12);
    color: var(--color-text-2);*/
    background: rgba(214, 37, 37, 0.22);
    
    color: #bf2a2a;
    
}

.wd-badge--shortened {
    background: rgba(217, 119, 6, 0.12);
    color: var(--color-warning, #d97706);
}

.wd-badge--shortened-only {
    background: rgba(63, 185, 80, 0.15);
    color: var(--color-success, #3fb950);
    border: 1px solid rgba(63, 185, 80, 0.35);
}

.wd-badge--global {
    background: rgba(88, 166, 255, 0.08);
    color: var(--color-info, #58a6ff);
    border: 1px solid rgba(88, 166, 255, 0.22);
}


/* ── Today marker ─────────────────────────────────────────────────────────── */

/*
 * .wd-today-marker  — separator <li> injected into the holiday list at the
 *                     position that corresponds to today's date.
 *
 * Rendered only when the displayed year equals the current year.
 * Uses role="separator" + aria-label so screen readers announce it correctly
 * and it is not confused with a real holiday item.
 */
.wd-today-marker {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    margin: var(--space-1) 0;
    pointer-events: none;
    user-select: none;
}

/* The horizontal rule that spans the full row */
.wd-today-marker::before,
.wd-today-marker::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--color-info);
    opacity: 0.35;
}

/* The centred pill label */
.wd-today-marker__label {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 2px var(--space-3);
    border-radius: var(--radius-full);
    background: rgba(88, 166, 255, 0.10);
    border: 1px solid rgba(88, 166, 255, 0.30);
    color: var(--color-info);
    font-family: var(--font-mono);
    font-size: var(--text-xxs);
    font-weight: var(--font-weight-semibold);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
    line-height: 1.4;
}

/* Dot pulse — a subtle living indicator that this is "now" */
.wd-today-marker__dot {
    display: inline-block;
    width: 5px;
    height: 5px;
    border-radius: var(--radius-full);
    background: var(--color-info);
    animation: wd-pulse 2.4s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes wd-pulse {
    0%, 100% { opacity: 1;   transform: scale(1);    }
    50%       { opacity: 0.4; transform: scale(0.75); }
}

/* ── Next-holiday highlight ────────────────────────────────────────────────── */

/*
 * .wd-holiday--next  — modifier on the next upcoming holiday <li>.
 *
 * Adds a left accent border and a soft amber glow so the item reads as
 * "this one is coming up soon" without competing with the primary working-days
 * stat or the today marker.
 *
 * The .wd-badge--next badge is added alongside any existing badges.
 */
.wd-holiday--next {
    border-left: 2px solid var(--color-accent);
    padding-left: calc(var(--space-3) - 2px); /* compensate for border so text stays aligned */
    background: var(--color-accent-dim);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.wd-holiday--next:hover {
    background: rgba(240, 160, 48, 0.18);
}

/* Override the weekend opacity when the next holiday also falls on a weekend —
   we still want it readable as the focal item */
.wd-holiday--next.wd-holiday--weekend {
    opacity: 1;
}

/* The "next" badge — amber pill, visually paired with the accent border */
.wd-badge--next {
    background: rgba(240, 160, 48, 0.15);
    color: var(--color-accent);
    border: 1px solid rgba(240, 160, 48, 0.35);
}

.wd-holiday{
  display: flex;
  align-items: center;
  gap: 10px;
}


.wd-holiday__name{
  flex: 1 1 auto;
  min-width: 0;
}


.wd-holiday__badges{
  flex: 0 0 auto;
  white-space: nowrap;
}
/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
    .wd-cards {
        grid-template-columns: 1fr 1fr;
    }

    .wd-card--primary {
        grid-column: 1 / -1;
    }

    .wd-card__value {
        font-size: var(--text-2xl, 1.5rem);
    }
    .wd-holiday{
    flex-wrap: wrap;
    align-items: flex-start;
  }


  .wd-holiday__badges{
    flex: 0 0 100%;
    width: 100%;
    margin-top: 6px;
    white-space: normal; 
    justify-content: flex-end;
  }
}
