:root {
    --calendar-selector-size: 50px;

    @media screen and (max-width: 756px) {
        --calendar-selector-size: 35px; /* slightly bigger than 25px for usability */
    }

    --ui-ctrl-calendar-accent-color: var(--accent-color);
    --ui-ctrl-calendar-accent-color-hover: var(--accent-color-hover);
    --ui-ctrl-calendar-accent-color-active: var(--accent-color-active);
    --ui-ctrl-calendar-accent-color-disabled: var(--accent-color-disabled);
}

.ui-ctrl-calendar-base {
    width: 100%;
    max-width: 700px;
    background: #fff;
    border-radius: 20px;
    padding: 40px;
    box-sizing: border-box;
    color: #333;
    margin: 0 auto;

    @media screen and (max-width: 756px) {
        padding: 20px;
    }
}

.ui-ctrl-calendar-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 10px;
}

.ui-ctrl-calendar-nav {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.ui-ctrl-calendar-nav button {
    background: var(--ui-ctrl-calendar-accent-color);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    min-width: 40px;

    display: flex;
    align-items: center;
    justify-content: center;
}

.ui-ctrl-calendar-nav button:hover {
    background: var(--ui-ctrl-calendar-accent-color-hover);
}

.ui-ctrl-calendar-year {
    font-size: clamp(18px, 4vw, 28px);
    cursor: pointer;
    position: relative;
    text-align: right;
    flex: 1;
}
.ui-ctrl-calendar-year > span {
    font-weight: bold;
}

.ui-ctrl-calendar-year-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 5px;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    margin-top: 5px;
    z-index: 10;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.ui-ctrl-calendar-year-dropdown.ui-ctrl-calendar-active {
    max-height: 300px;
    opacity: 1;
}

.ui-ctrl-calendar-year-dropdown-content {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 12px;
    max-height: 280px;
    overflow-y: auto;
}

.ui-ctrl-calendar-year-option {
    padding: 8px 12px;
    text-align: center;
    border-radius: 5px;
    cursor: pointer;
    transition: 0.2s ease;
    font-size: 14px;
}

.ui-ctrl-calendar-year-option:hover {
    background: #f0f0f0;
}

.ui-ctrl-calendar-year-option.ui-ctrl-calendar-selected {
    background: var(--ui-ctrl-calendar-accent-color);
    color: white;
    font-weight: bold;
}

.ui-ctrl-calendar-months {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: clamp(10px, 2vw, 14px);
    color: #888;
    padding-bottom: 10px;
    border-bottom: #AAA solid 1px;
}

.ui-ctrl-calendar-months span {
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 5px;
    transition: 0.2s ease;
    flex: 1 0 14%;
    text-align: center;
}

.ui-ctrl-calendar-months span:hover {
    background: #f0f0f0;
}

.ui-ctrl-calendar-disabled {
    opacity: 0.6;
    pointer-events: none;
    cursor: not-allowed;
}

.ui-ctrl-calendar-month-color {
    color: var(--ui-ctrl-calendar-accent-color);
    font-weight: bold;
    background: #f0fff4;
}

.ui-ctrl-calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    margin-top: 20px;
    font-weight: 600;
    color: #999;
    text-align: center;
}
.ui-ctrl-calendar-days div {
    width: var(--calendar-selector-size);
}

.ui-ctrl-calendar-num-dates {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    margin-top: 15px;
    text-align: center;

    @media screen and (max-width: 756px) {
        gap: 5px;
    }
}

.ui-ctrl-calendar-num-dates div {
    border-radius: 50%;
    cursor: pointer;
    transition: 0.2s ease;
    width: var(--calendar-selector-size);
    height: var(--calendar-selector-size);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: clamp(12px, 2vw, 16px);
}

.ui-ctrl-calendar-num-dates div:hover:not(.ui-ctrl-calendar-grey) {
    background: #f0f0f0;
}

.ui-ctrl-calendar-num-dates div.ui-ctrl-calendar-selectable {
    cursor: pointer;
}
.ui-ctrl-calendar-num-dates div:not(.ui-ctrl-calendar-selectable) {
    font-weight: bold;
    color: #777;
}

.ui-ctrl-calendar-active-day:not(.ui-ctrl-calendar-grey) {
    background-color: var(--ui-ctrl-calendar-accent-color);
    color: white;
    font-weight: bold;
}
.ui-ctrl-calendar-active-day:not(.ui-ctrl-calendar-grey):hover {
    background-color: var(--ui-ctrl-calendar-accent-color-hover) !important;
}

.ui-ctrl-calendar-active-day.ui-ctrl-calendar-grey {
    background-color: var(--ui-ctrl-calendar-accent-color-disabled);
    color: white;
    font-weight: bold;
}

.ui-ctrl-calendar-today {
    border: 2px solid var(--ui-ctrl-calendar-accent-color);
    font-weight: bold;
    color: var(--ui-ctrl-calendar-accent-color);
}

.ui-ctrl-calendar-today.ui-ctrl-calendar-active-day {
    border: 2px solid white;
    color: white;
}