/* --- Controls Row --- */
.calendar-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1pt;
    padding: 0 0.1rem;
    flex-wrap: nowrap; /* keep on one line unless extremely narrow */
}

/* --- Smallest breakpoint (phones ~375px–600px) --- */
@media (max-width: 600px) {

    .calendar-controls {
        gap: 0.6rem;
    }

    /* Starting-month (left) gets the larger width */
    .calendar-starting {
        flex: 0 0 55%;
    }

    /* Search (right) gets the smaller width */
    .calendar-search {
        flex: 0 0 35%;
    }

    .search-wrapper input,
    .starting-picker input[type="month"] {
        font-size: 0.85rem;
        height: 2.1rem;
        padding: 0.35rem 0.4rem;
    }

    .starting-toggle {
        font-size: 0.8rem;
        padding: 0.35rem 0.5rem;
    }

    .search-wrapper .icon {
        font-size: 0.9rem;
        right: 0.35rem;
    }
}

/* --- Ultra-small fallback (<360px) --- */
@media (max-width: 360px) {
    .calendar-controls {
        flex-wrap: wrap;
    }

    .calendar-starting,
    .calendar-search {
        flex: 1 0 100%;
    }

    .calendar-starting {
        justify-content: flex-start;
    }
}

/* --- Starting Month (Left Side) --- */
.calendar-starting {
    flex: 0 0 30%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.3rem;
    white-space: nowrap;
}

/* Toggle chip */
.starting-toggle {
    background: #f4f4f4;
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 0.45rem 0.6rem;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.15s ease;
}

.starting-toggle:hover {
    background: #e9e9e9;
}

/* Collapsible container */
.starting-picker {
    width: 100%;
    transition: max-height 0.25s ease, opacity 0.25s ease;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
}

.starting-picker.visible {
    max-height: 60px; /* enough for the month input */
    opacity: 1;
}

.starting-picker.hidden {
    max-height: 0;
    opacity: 0;
}

/* Month input inside collapsible */
.starting-picker input[type="month"] {
    width: 100%;
    height: 2.2rem;
    padding-left: 0.5rem;
    border-radius: 6px;
    border: 1px solid #ccc;
    font-size: 0.95rem;
    box-sizing: border-box;
}

/* Hide the calendar icon inside <input type="month"> */
input[type="month"]::-webkit-calendar-picker-indicator {
    opacity: 0;
    display: none;
}

/* --- Search Box (Right Side) --- */
.calendar-search {
    flex: 0 0 40%;
    display: flex;
    align-items: center;
}

.search-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
}

.search-wrapper input {
    width: 100%;
    padding: 0.5rem 0.5rem;
    border-radius: 6px;
    border: 1px solid #ccc;
    font-size: 1rem;
    height: 2.4rem;
    box-sizing: border-box;
}

.search-wrapper .icon {
    position: absolute;
    right: 0.5rem;
    font-size: 1.1rem;
    cursor: pointer;
    opacity: 0.7;
}
