/* Working Days Calculator — scoped styles, light theme by default, html.dark for dark */

.wd-card {
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(228, 228, 231, 0.95);
    box-shadow: 0 4px 20px -4px rgba(0, 0, 0, 0.05);
    backdrop-filter: saturate(180%) blur(16px);
    -webkit-backdrop-filter: saturate(180%) blur(16px);
}

html.dark .wd-card {
    background: rgba(14, 14, 18, 0.92);
    border-color: rgba(255, 255, 255, 0.07);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.35);
}

/* The blur is expensive on phones and invisible on a solid card */
@media (max-width: 767px) {
    .wd-card,
    html.dark .wd-card {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
}

.wd-result {
    border-color: rgba(99, 102, 241, 0.35);
}

html.dark .wd-result {
    border-color: rgba(129, 140, 248, 0.28);
}

/* Ensure all input cards in the left column remain static and never stick/overlap on scroll */
#working-days-workspace .wd-card:not(.wd-result),
#calculator-workspace .wd-card:not(.wd-result),
#card-dates,
#card-options,
#holiday-section {
    position: static !important;
    top: auto !important;
}

/* iOS zooms into inputs below 16px */
#working-days-workspace input[type="date"],
#working-days-workspace input[type="number"],
#working-days-workspace input[type="text"],
#calculator-workspace input[type="date"],
#calculator-workspace input[type="number"],
#calculator-workspace input[type="text"] {
    font-size: 16px;
    line-height: 1.4;
}

.wd-input {
    width: 100%;
    min-width: 0;
    height: 2.75rem;
    padding: 0 0.75rem;
    border-radius: 0.75rem;
    border: 1px solid #d4d4d8;
    background: #f4f4f5;
    color: #18181b;
    font-weight: 600;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

html.dark .wd-input {
    border-color: rgba(255, 255, 255, 0.12);
    background: rgba(0, 0, 0, 0.45);
    color: #f4f4f5;
    color-scheme: dark;
}

.wd-input:focus-visible {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

/* Toggle switch (off: zinc, on: indigo) */
.wd-switch {
    width: 2.75rem;
    height: 1.5rem;
    border-radius: 9999px;
    background-color: #d4d4d8;
    border: 1px solid #a1a1aa;
    position: relative;
    flex-shrink: 0;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

html.dark .wd-switch {
    background-color: #27272a;
    border-color: #52525b;
}

.wd-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 1.125rem;
    height: 1.125rem;
    border-radius: 9999px;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

input:checked + .wd-switch,
html.dark input:checked + .wd-switch {
    background-color: #6366f1;
    border-color: #4f46e5;
}

input:checked + .wd-switch::after {
    transform: translateX(1.25rem);
}

input:focus-visible + .wd-switch,
input:focus-visible + .wd-day {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

/* Weekend day chips: ticked = not counted */
.wd-day {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    border-radius: 0.75rem;
    border: 1px solid #e4e4e7;
    background: #fafafa;
    color: #3f3f46;
    font-size: 0.875rem;
    font-weight: 700;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    user-select: none;
}

html.dark .wd-day {
    border-color: rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.03);
    color: #d4d4d8;
}

input:checked + .wd-day {
    background: #eef2ff;
    border-color: #6366f1;
    color: #3730a3;
}

html.dark input:checked + .wd-day {
    background: rgba(99, 102, 241, 0.18);
    border-color: #818cf8;
    color: #e0e7ff;
}

/* Holiday chips */
.wd-holiday-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    max-width: 100%;
    min-height: 44px;
    padding-left: 0.75rem;
    border-radius: 0.75rem;
    border: 1px solid #e4e4e7;
    background: #f4f4f5;
    color: #27272a;
    font-size: 0.8125rem;
    font-weight: 600;
}

html.dark .wd-holiday-chip {
    border-color: rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: #e4e4e7;
}

.wd-holiday-chip.is-outside {
    opacity: 0.7;
}

.wd-holiday-outside {
    font-size: 0.75rem;
    font-weight: 500;
    color: #71717a;
    white-space: nowrap;
}

html.dark .wd-holiday-outside {
    color: #a1a1aa;
}

.wd-holiday-remove {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.75rem;
    color: #71717a;
    cursor: pointer;
}

.wd-holiday-remove:hover,
.wd-holiday-remove:focus-visible {
    color: #e11d48;
}

/* Quick range chips scroll sideways inside the card instead of widening the page */
.wd-scroll {
    scrollbar-width: none;
}

.wd-scroll::-webkit-scrollbar {
    display: none;
}

@media print {
    #btnCopy, #btnShare, #btnReset, [data-range], #btnAddHoliday, #btnClearHolidays, .wd-holiday-remove {
        display: none !important;
    }
    .wd-card {
        background: #ffffff !important;
        border: 1px solid #e4e4e7 !important;
        box-shadow: none !important;
        color: #000000 !important;
    }
}

.wd-input.wd-hours {
    width: 6rem;
}
