﻿/* Обгортка маршруту — без горизонтального «роздування» сторінки */
.calendar-route-root {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-width: 0;
}

.calendar-page {
    background: #191c24;
    padding: clamp(10px, 2.5vw, 24px);
    border-radius: clamp(10px, 2vw, 16px);
    color: #fff;
    width: 100%;
    max-width: min(100%, 1400px);
    margin-inline: auto;
    box-sizing: border-box;
    min-width: 0;
}

.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: clamp(12px, 2vw, 20px);
}

    .calendar-header h3,
    .calendar-header__title {
        margin: 0;
        font-weight: 700;
        text-transform: capitalize;
        text-align: center;
        flex: 1 1 auto;
        min-width: 0;
        font-size: clamp(0.95rem, 2.8vw + 0.35rem, 1.5rem);
        line-height: 1.25;
        order: 0;
    }

@media (max-width: 400px) {
    .calendar-header {
        flex-wrap: nowrap;
    }

        .calendar-header__title {
            flex: 1 1 0;
            font-size: clamp(0.8rem, 4.2vw, 1rem);
        }
}

.calendar-nav {
    width: 38px;
    height: 38px;
    min-width: 38px;
    min-height: 38px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.08);
    background: #0b1118;
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* На дуже вузьких екранах дозволяємо горизонтальний скрол сітки, щоб комірки не ламали верстку */
.calendar-grid-scroll {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: clamp(3px, 1.2vw, 8px);
    width: 100%;
    box-sizing: border-box;
}

@media (min-width: 400px) {
    .calendar-grid-scroll {
        overflow-x: visible;
    }
}

@media (max-width: 399.98px) {
    .calendar-grid {
        min-width: calc(7 * 40px + 6 * 3px);
    }
}

.calendar-grid--days {
    align-content: start;
}

.calendar-weekdays {
    margin-bottom: 8px;
}

    .calendar-weekdays div {
        text-align: center;
        color: #9aa4ad;
        font-weight: 600;
        font-size: clamp(10px, 1.8vw + 0.2rem, 13px);
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        padding: 0 1px;
    }

.calendar-day {
    min-height: clamp(58px, 12vw, 110px);
    background: #0f1722;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: clamp(6px, 1.5vw, 12px);
    padding: clamp(4px, 1.2vw, 10px);
    cursor: pointer;
    transition: 0.2s ease;
    min-width: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

    .calendar-day:hover {
        border-color: rgba(255, 77, 77, 0.4);
        background: #111b28;
    }

@media (hover: none) {
    .calendar-day:active {
        border-color: rgba(255, 77, 77, 0.35);
        background: #111b28;
    }
}

.other-month {
    opacity: 0.35;
}

.day-number {
    font-weight: 700;
    margin-bottom: clamp(4px, 1vw, 8px);
    color: #fff;
    font-size: clamp(11px, 2vw + 0.25rem, 16px);
    line-height: 1.2;
    flex-shrink: 0;
}

.calendar-event {
    background: rgba(255, 0, 0, 0.18);
    color: #ff4d6d;
    border: 1px solid rgba(255, 0, 0, 0.35);
    border-radius: clamp(4px, 1vw, 8px);
    padding: clamp(3px, 0.8vw, 5px) clamp(4px, 1vw, 8px);
    font-size: clamp(9px, 1.5vw + 0.2rem, 12px);
    margin-bottom: clamp(3px, 0.8vw, 5px);
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    cursor: pointer;
    touch-action: manipulation;
}

.calendar-event__title {
    color: #fff;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.25;
}

.calendar-event__desc {
    color: rgba(255, 255, 255, 0.92) !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
    margin-top: 2px;
}

@media (max-width: 420px) {
    .calendar-event__desc {
        display: none;
    }

    .calendar-event {
        margin-bottom: 3px;
        padding: 3px 4px;
    }
}

@media (min-width: 1200px) {
    .calendar-day {
        min-height: 120px;
    }
}

/* Альбомна орієнтація на невисокому екрані */
@media (max-height: 520px) and (orientation: landscape) {
    .calendar-day {
        min-height: 52px;
        padding: 4px;
    }

    .calendar-event__desc {
        display: none;
    }
}

@media (pointer: coarse) {
    .calendar-nav {
        min-width: 44px;
        min-height: 44px;
        width: 44px;
        height: 44px;
    }
}

.color-select {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    background: #111827;
    color: white;
    border: 1px solid #1f2937;
    box-sizing: border-box;
}

.color-preview {
    margin-top: 10px;
    height: 35px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
}

.task-btn-delete {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px 18px;
    cursor: pointer;
}

    .task-btn-delete:hover {
        background: #bb2d3b;
    }

@media (max-width: 768px) {
    .task-modal-footer .task-btn-delete {
        width: 100%;
        order: -1;
    }
}
