
/* =========================================================
   Futuristic • Clean • Responsive
   ========================================================= */


/* =========================================================
   01. MODAL
   ========================================================= */

.calendar-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;

    display: flex;
    align-items: center;
    justify-content: center;

    width: 100%;
    height: 100%;
    padding: 20px;

    opacity: 0;
    visibility: hidden;

    transition:
        opacity 0.25s ease,
        visibility 0.25s ease;
}

.calendar-modal.active {
    opacity: 1;
    visibility: visible;
}


/* Prevent background scrolling */

body.calendar-open {
    overflow: hidden;
}


/* =========================================================
   02. BACKDROP
   ========================================================= */

.calendar-overlay {
    position: absolute;
    inset: 0;

    background:
        radial-gradient(
            circle at center,
            rgba(220, 38, 38, 0.055),
            transparent 45%
        ),
        rgba(0, 0, 0, 0.70);

    backdrop-filter: blur(7px);
    -webkit-backdrop-filter: blur(7px);
}


/* =========================================================
   03. CALENDAR WINDOW
   ========================================================= */

.calendar-window {
    position: relative;
    z-index: 2;

    width: min(450px, 100%);
    max-height: calc(100vh - 40px);

    overflow-y: auto;

    padding: 26px;

    border: 1px solid var(--border);
    border-radius: 18px;

    background:
        linear-gradient(
            145deg,
            var(--card),
            var(--card-2)
        );

    box-shadow:
        0 30px 80px rgba(0, 0, 0, 0.50),
        0 0 35px rgba(220, 38, 38, 0.06);

    transform:
        translateY(18px)
        scale(0.97);

    transition:
        transform 0.25s ease,
        border-color 0.25s ease;
}

.calendar-modal.active .calendar-window {
    transform:
        translateY(0)
        scale(1);
}

.calendar-window:hover {
    border-color: var(--border-light);
}


/* =========================================================
   04. HEADER
   ========================================================= */

.calendar-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;

    margin-bottom: 24px;
}

.calendar-eyebrow {
    display: block;

    margin-bottom: 7px;

    color: var(--red);

    font-size: 9px;
    font-weight: 800;

    letter-spacing: 0.16em;
    line-height: 1.3;

    text-transform: uppercase;
}

.calendar-header h2 {
    margin: 0;

    color: var(--text);

    font-size: 24px;
    font-weight: 750;

    letter-spacing: -0.02em;
    line-height: 1.2;
}


/* =========================================================
   05. CLOSE BUTTON
   ========================================================= */

.calendar-close {
    width: 34px;
    height: 34px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    flex-shrink: 0;

    padding: 0;

    border: 1px solid var(--border);
    border-radius: 8px;

    background: var(--card-2);

    color: var(--muted);

    font-family: inherit;
    font-size: 21px;
    font-weight: 400;
    line-height: 1;

    cursor: pointer;

    transition:
        color 0.18s ease,
        background-color 0.18s ease,
        border-color 0.18s ease,
        box-shadow 0.18s ease,
        transform 0.15s ease;
}

.calendar-close:hover {
    color: var(--red);

    background: rgba(220, 38, 38, 0.08);

    border-color: rgba(220, 38, 38, 0.55);

    box-shadow:
        0 0 16px rgba(220, 38, 38, 0.12);

    transform: translateY(-1px);
}

.calendar-close:active {
    color: #ffffff;

    background: var(--red);
    border-color: var(--red);

    transform: scale(0.94);
}

.calendar-close:focus-visible {
    outline: none;

    border-color: var(--red);

    box-shadow:
        0 0 0 3px rgba(220, 38, 38, 0.14);
}


/* =========================================================
   06. MONTH NAVIGATION
   ========================================================= */

.calendar-controls {
    display: grid;

    grid-template-columns: 38px minmax(0, 1fr) 38px;

    align-items: center;

    gap: 10px;

    margin-bottom: 12px;

    padding: 5px;

    border: 1px solid var(--border);
    border-radius: 10px;

    background: var(--card-2);
}


/* Previous / Next */

.calendar-nav {
    width: 38px;
    height: 38px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 0;

    border: 1px solid transparent;
    border-radius: 8px;

    background: transparent;

    color: var(--muted);

    font-family: inherit;
    font-size: 22px;
    font-weight: 400;
    line-height: 1;

    cursor: pointer;

    transition:
        color 0.18s ease,
        background-color 0.18s ease,
        border-color 0.18s ease,
        transform 0.15s ease;
}

.calendar-nav:hover {
    color: var(--red);

    background: rgba(220, 38, 38, 0.08);

    border-color: rgba(220, 38, 38, 0.25);

    transform: translateY(-1px);
}

.calendar-nav:active {
    color: #ffffff;

    background: var(--red);

    border-color: var(--red);

    transform: scale(0.94);
}

.calendar-nav:focus-visible {
    outline: none;

    border-color: var(--red);

    box-shadow:
        0 0 0 2px rgba(220, 38, 38, 0.12);
}


/* Month / Year */

.calendar-month-year {
    height: 38px;

    display: flex;
    align-items: center;
    justify-content: center;

    min-width: 0;

    padding: 0 8px;

    border: 0;

    background: transparent;

    color: var(--text);

    font-family: inherit;
    font-size: 14px;
    font-weight: 750;

    letter-spacing: 0.01em;

    text-align: center;

    cursor: default;
}


/* =========================================================
   07. TODAY BUTTON
   ========================================================= */

.calendar-today-row {
    display: flex;
    justify-content: flex-end;

    margin-bottom: 17px;
}

.calendar-today {
    min-height: 29px;

    padding: 6px 11px;

    border: 1px solid var(--border);
    border-radius: 7px;

    background: transparent;

    color: var(--muted);

    font-family: inherit;
    font-size: 11px;
    font-weight: 650;

    cursor: pointer;

    transition:
        color 0.18s ease,
        background-color 0.18s ease,
        border-color 0.18s ease,
        transform 0.15s ease;
}

.calendar-today:hover {
    color: var(--red);

    background: rgba(220, 38, 38, 0.06);

    border-color: rgba(220, 38, 38, 0.45);

    transform: translateY(-1px);
}

.calendar-today:active {
    color: #ffffff;

    background: var(--red);
    border-color: var(--red);

    transform: scale(0.96);
}

.calendar-today:focus-visible {
    outline: none;

    border-color: var(--red);

    box-shadow:
        0 0 0 2px rgba(220, 38, 38, 0.12);
}


/* =========================================================
   08. WEEKDAY HEADER
   ========================================================= */

.calendar-weekdays,
.calendar-days {
    display: grid;

    grid-template-columns:
        repeat(7, minmax(0, 1fr));
}

.calendar-weekdays {
    margin-bottom: 8px;
}

.calendar-weekdays span {
    display: flex;
    align-items: center;
    justify-content: center;

    min-width: 0;
    height: 26px;

    color: var(--muted-dark);

    font-size: 9px;
    font-weight: 800;

    letter-spacing: 0.06em;

    text-transform: uppercase;
}


/* =========================================================
   09. DAY CELLS
   ========================================================= */

.calendar-day {
    position: relative;

    width: 100%;
    aspect-ratio: 1;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0;

    border: 1px solid transparent;
    border-radius: 9px;

    background: transparent;

    color: var(--text);

    font-family: inherit;
    font-size: 12px;
    font-weight: 550;

    line-height: 1;

    cursor: pointer;

    transition:
        color 0.16s ease,
        background-color 0.16s ease,
        border-color 0.16s ease,
        box-shadow 0.16s ease,
        transform 0.14s ease;
}


/* Hover */

.calendar-day:hover {
    color: var(--red);

    background:
        rgba(220, 38, 38, 0.075);

    border-color:
        rgba(220, 38, 38, 0.28);

    box-shadow:
        0 0 12px rgba(220, 38, 38, 0.06);

    transform: translateY(-1px);
}


/* Click */

.calendar-day:active {
    transform: scale(0.92);
}


/* Keyboard focus */

.calendar-day:focus-visible {
    outline: none;

    border-color: var(--red);

    box-shadow:
        0 0 0 2px rgba(220, 38, 38, 0.13);
}


/* =========================================================
   10. OTHER MONTH DAYS
   ========================================================= */

.calendar-day.other-month {
    color: var(--muted-dark);

    opacity: 0.35;
}

.calendar-day.other-month:hover {
    color: var(--red);

    opacity: 0.70;
}


/* =========================================================
   11. TODAY
   ========================================================= */

.calendar-day.today {
    color: var(--red);

    border-color:
        rgba(220, 38, 38, 0.65);

    background:
        rgba(220, 38, 38, 0.045);

    font-weight: 800;

    box-shadow:
        inset 0 0 0 1px rgba(220, 38, 38, 0.04);
}

.calendar-day.today:hover {
    background:
        rgba(220, 38, 38, 0.10);

    border-color: var(--red);

    box-shadow:
        0 0 14px rgba(220, 38, 38, 0.12);
}


/* =========================================================
   12. SELECTED DATE
   ========================================================= */

.calendar-day.selected {
    color: #ffffff;

    background:
        linear-gradient(
            145deg,
            var(--red-light),
            var(--red)
        );

    border-color: var(--red);

    font-weight: 800;

    box-shadow:
        0 5px 16px rgba(220, 38, 38, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.calendar-day.selected:hover {
    color: #ffffff;

    background:
        linear-gradient(
            145deg,
            var(--red),
            var(--red-dark)
        );

    border-color: var(--red-dark);

    box-shadow:
        0 7px 20px rgba(220, 38, 38, 0.32);
}

.calendar-day.selected:active {
    transform: scale(0.92);
}


/* =========================================================
   13. SELECTED DATE FOOTER
   ========================================================= */

.calendar-footer {
    display: flex;
    align-items: center;

    min-height: 38px;

    margin-top: 20px;
    padding-top: 14px;

    border-top: 1px solid var(--border);
}

.calendar-selected {
    display: flex;
    align-items: center;

    gap: 8px;

    min-width: 0;

    color: var(--muted);

    font-size: 11px;
    font-weight: 550;

    line-height: 1.4;
}

.calendar-selected-dot {
    width: 6px;
    height: 6px;

    flex-shrink: 0;

    border-radius: 50%;

    background: var(--red);

    box-shadow:
        0 0 8px rgba(220, 38, 38, 0.55);
}


/* =========================================================
   14. SCROLLBAR
   ========================================================= */

.calendar-window::-webkit-scrollbar {
    width: 5px;
}

.calendar-window::-webkit-scrollbar-track {
    background: transparent;
}

.calendar-window::-webkit-scrollbar-thumb {
    background: var(--border-light);

    border-radius: 10px;
}

.calendar-window::-webkit-scrollbar-thumb:hover {
    background: var(--red);
}


/* =========================================================
   15. LIGHT THEME
   ========================================================= */

body.light-mode .calendar-overlay,
body.light-theme .calendar-overlay {
    background:
        radial-gradient(
            circle at center,
            rgba(220, 38, 38, 0.035),
            transparent 45%
        ),
        rgba(0, 0, 0, 0.28);
}

body.light-mode .calendar-window,
body.light-theme .calendar-window {
    box-shadow:
        0 25px 65px rgba(0, 0, 0, 0.16),
        0 0 25px rgba(0, 0, 0, 0.03);
}

body.light-mode .calendar-day.selected,
body.light-theme .calendar-day.selected {
    color: #ffffff;
}

body.light-mode .calendar-close:active,
body.light-theme .calendar-close:active,
body.light-mode .calendar-nav:active,
body.light-theme .calendar-nav:active,
body.light-mode .calendar-today:active,
body.light-theme .calendar-today:active {
    color: #ffffff;
}


/* =========================================================
   16. TABLET / SMALL SCREENS
   ========================================================= */

@media (max-width: 600px) {

    .calendar-modal {
        padding: 15px;
    }

    .calendar-window {
        width: min(440px, 100%);

        max-height: calc(100vh - 30px);

        padding: 21px;

        border-radius: 15px;
    }

    .calendar-header {
        margin-bottom: 20px;
    }

    .calendar-header h2 {
        font-size: 21px;
    }

    .calendar-controls {
        grid-template-columns:
            35px minmax(0, 1fr) 35px;

        gap: 7px;

        padding: 4px;
    }

    .calendar-nav {
        width: 35px;
        height: 35px;
    }

    .calendar-month-year {
        height: 35px;

        font-size: 13px;
    }

    .calendar-day {
        border-radius: 7px;

        font-size: 11px;
    }

    .calendar-weekdays span {
        font-size: 8px;
    }
}


/* =========================================================
   17. MOBILE
   ========================================================= */

@media (max-width: 420px) {

    .calendar-modal {
        padding: 10px;
    }

    .calendar-window {
        max-height: calc(100vh - 20px);

        padding: 17px;

        border-radius: 13px;
    }

    .calendar-eyebrow {
        font-size: 8px;
    }

    .calendar-header h2 {
        font-size: 20px;
    }

    .calendar-close {
        width: 31px;
        height: 31px;

        font-size: 20px;
    }

    .calendar-today-row {
        margin-bottom: 13px;
    }

    .calendar-day {
        font-size: 10.5px;
    }

    .calendar-weekdays span {
        font-size: 7.5px;
        letter-spacing: 0.03em;
    }

    .calendar-footer {
        margin-top: 16px;
        padding-top: 12px;
    }
}


/* =========================================================
   18. VERY SMALL PHONES
   ========================================================= */

@media (max-width: 340px) {

    .calendar-modal {
        padding: 7px;
    }

    .calendar-window {
        padding: 14px;

        border-radius: 11px;
    }

    .calendar-header {
        margin-bottom: 16px;
    }

    .calendar-header h2 {
        font-size: 18px;
    }

    .calendar-controls {
        grid-template-columns:
            32px minmax(0, 1fr) 32px;
    }

    .calendar-nav {
        width: 32px;
        height: 32px;

        font-size: 19px;
    }

    .calendar-month-year {
        height: 32px;

        font-size: 12px;
    }

    .calendar-day {
        font-size: 10px;
        border-radius: 6px;
    }

    .calendar-selected {
        font-size: 10px;
    }
}


/* =========================================================
   19. REDUCED MOTION
   ========================================================= */

@media (prefers-reduced-motion: reduce) {

    .calendar-modal,
    .calendar-window,
    .calendar-close,
    .calendar-nav,
    .calendar-today,
    .calendar-day {
        transition: none;
    }

    .calendar-close:hover,
    .calendar-nav:hover,
    .calendar-today:hover,
    .calendar-day:hover {
        transform: none;
    }
}

