/* Week Number Calculator — scoped styles, light and dark */

.wn-grid-bg {
    background-size: 40px 40px;
    background-image:
        linear-gradient(to right, rgba(6, 182, 212, 0.04) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(6, 182, 212, 0.04) 1px, transparent 1px);
}
html.dark .wn-grid-bg {
    background-image:
        linear-gradient(to right, rgba(6, 182, 212, 0.03) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(6, 182, 212, 0.03) 1px, transparent 1px);
}

/* Cards */
#week-workspace .apple-glass,
#educational-content .apple-glass {
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(228, 228, 231, 0.9);
    box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.05);
}
html.dark #week-workspace .apple-glass,
html.dark #educational-content .apple-glass {
    background: rgba(10, 10, 14, 0.92);
    border-color: rgba(255, 255, 255, 0.07);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

/* Inputs: 16px minimum so iOS does not zoom */
#week-workspace input[type="date"],
#week-workspace input[type="number"] {
    font-size: 16px !important;
    line-height: 1.5;
}
.wn-label {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #3f3f46;
    cursor: pointer;
}
html.dark .wn-label { color: #d4d4d8; }

.wn-input {
    height: 44px;
    padding: 0 0.875rem;
    border-radius: 0.75rem;
    border: 1px solid #e4e4e7;
    background: #f4f4f5;
    color: #18181b;
    font-weight: 600;
    outline: none;
    transition: border-color 0.15s ease;
}
.wn-input:focus { border-color: rgba(6, 182, 212, 0.6); }
html.dark .wn-input {
    background: rgba(0, 0, 0, 0.5);
    border-color: rgba(255, 255, 255, 0.1);
    color: #f4f4f5;
    color-scheme: dark;
}

.wn-stepper {
    height: 44px;
    border-radius: 0.75rem;
    border: 1px solid #e4e4e7;
    background: #f4f4f5;
    overflow: hidden;
}
.wn-stepper:focus-within { border-color: rgba(6, 182, 212, 0.6); }
html.dark .wn-stepper {
    background: rgba(0, 0, 0, 0.5);
    border-color: rgba(255, 255, 255, 0.1);
}
.wn-step {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    font-weight: 700;
    color: #52525b;
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
}
.wn-step:hover { background: #e4e4e7; color: #18181b; }
html.dark .wn-step { color: #a1a1aa; }
html.dark .wn-step:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }

input[type="number"].no-spinners::-webkit-inner-spin-button,
input[type="number"].no-spinners::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type="number"].no-spinners { -moz-appearance: textfield; appearance: textfield; }

/* Tabs */
.wn-tab {
    min-height: 44px;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 700;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #52525b;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}
.wn-tab:hover { color: #18181b; }
html.dark .wn-tab { color: #a1a1aa; }
html.dark .wn-tab:hover { color: #fff; }
.wn-tab.wn-tab-active,
html.dark .wn-tab.wn-tab-active {
    background: #06b6d4;
    color: #000;
    box-shadow: 0 2px 6px rgba(6, 182, 212, 0.25);
}
.wn-tab:focus-visible,
.wn-icon-btn:focus-visible,
.wn-btn-primary:focus-visible,
.wn-btn-secondary:focus-visible,
.wn-step:focus-visible {
    outline: 2px solid #06b6d4;
    outline-offset: 2px;
}

/* Buttons */
.wn-icon-btn {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f4f4f5;
    border: 1px solid #e4e4e7;
    color: #52525b;
    cursor: pointer;
}
.wn-icon-btn:hover { color: #e11d48; background: rgba(244, 63, 94, 0.08); }
html.dark .wn-icon-btn { background: #18181b; border-color: rgba(255, 255, 255, 0.1); color: #a1a1aa; }

.wn-btn-primary,
.wn-btn-secondary {
    min-height: 44px;
    min-width: 44px;
    padding: 0 0.875rem;
    border-radius: 0.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    font-size: 0.875rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.15s ease, transform 0.1s ease;
}
.wn-btn-primary:active,
.wn-btn-secondary:active { transform: scale(0.97); }
.wn-btn-primary { background: #06b6d4; color: #000; }
.wn-btn-primary:hover { background: #22d3ee; }
.wn-btn-secondary {
    background: #f4f4f5;
    color: #27272a;
    border: 1px solid #e4e4e7;
}
.wn-btn-secondary:hover { background: #e4e4e7; }
html.dark .wn-btn-secondary { background: #18181b; color: #e4e4e7; border-color: rgba(255, 255, 255, 0.1); }
html.dark .wn-btn-secondary:hover { background: #27272a; }

/* Result */
.wn-output-error {
    font-size: 1.5rem !important;
    line-height: 2rem !important;
    color: #b45309 !important;
}
html.dark .wn-output-error { color: #fcd34d !important; }

.wn-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    background: #f4f4f5;
    border: 1px solid #e4e4e7;
    color: #3f3f46;
}
html.dark .wn-chip { background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.1); color: #d4d4d8; }
.wn-chip[hidden] { display: none; }

/* Seven-day strip */
.wn-strip {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.25rem;
    list-style: none;
    padding: 0;
}
.wn-day {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.3rem 0;
    border-radius: 0.6rem;
    background: #f4f4f5;
    color: #27272a;
    position: relative;
}
html.dark .wn-day { background: rgba(255, 255, 255, 0.05); color: #e4e4e7; }
.wn-day-weekend { background: #e4e4e7; color: #52525b; }
html.dark .wn-day-weekend { background: rgba(255, 255, 255, 0.02); color: #a1a1aa; }
.wn-day-name { font-size: 0.75rem; font-weight: 600; opacity: 0.8; }
.wn-day-num { font-size: 0.95rem; font-weight: 800; line-height: 1.2; }
.wn-day-today { box-shadow: inset 0 0 0 2px rgba(6, 182, 212, 0.55); }
.wn-day-selected,
html.dark .wn-day-selected { background: #06b6d4; color: #000; }

/* Content */
.wn-h2 {
    font-size: 1.375rem;
    line-height: 1.25;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: #18181b;
}
html.dark .wn-h2 { color: #fff; }
@media (min-width: 640px) { .wn-h2 { font-size: 1.75rem; } }
.wn-link { color: #0891b2; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
html.dark .wn-link { color: #22d3ee; }
.wn-example {
    padding: 1rem;
    border-radius: 0.875rem;
    background: rgba(244, 244, 245, 0.8);
    border: 1px solid rgba(228, 228, 231, 0.8);
    font-size: 0.875rem;
    line-height: 1.55;
    color: #52525b;
}
html.dark .wn-example { background: rgba(9, 9, 11, 0.4); border-color: rgba(255, 255, 255, 0.05); color: #a1a1aa; }
.wn-example-title { font-weight: 700; color: #18181b; margin-bottom: 0.35rem; }
html.dark .wn-example-title { color: #fff; }

.wn-table-scroll {
    max-height: 22rem;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.wn-thead { position: sticky; top: 0; z-index: 1; background: #f4f4f5; }
html.dark .wn-thead { background: #111114; }
.wn-th {
    padding: 0.6rem 1rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #52525b;
}
html.dark .wn-th { color: #a1a1aa; }
.wn-td {
    padding: 0.5rem 1rem;
    border-top: 1px solid rgba(228, 228, 231, 0.7);
    color: #3f3f46;
    white-space: nowrap;
}
html.dark .wn-td { border-top-color: rgba(255, 255, 255, 0.05); color: #d4d4d8; }
.wn-row-current { background: rgba(6, 182, 212, 0.14); }
.wn-row-current .wn-td { color: #0e7490; font-weight: 700; }
html.dark .wn-row-current { background: rgba(6, 182, 212, 0.18); }
html.dark .wn-row-current .wn-td { color: #67e8f9; }

/* Desktop: result column spans the rows so left cards stack without gaps */
@media (min-width: 1024px) {
    .wn-results-column {
        grid-column: 8 / span 5 !important;
        grid-row: 1 / span 12 !important;
        align-self: start !important;
    }
}

@media (max-width: 767px) {
    #week-workspace .apple-glass { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
}

@media print {
    #btn-reset, #btn-copy, #btn-share, #btn-today, #btn-this-week { display: none !important; }
}
