/**
 * Thai Date Picker CSS Styles
 * Theme Color: #7A19C0 (Purple)
 * Compatible with Bootstrap 5
 */

 .date-picker {
    position: relative;
}

.date-input {
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    padding: 0.375rem 0.75rem;
    cursor: pointer;
    background: white;
    min-height: 38px;
    display: flex;
    align-items: center;
}

.date-input:hover {
    border-color: #7A19C0;
}

.date-input.active {
    border-color: #7A19C0;
    box-shadow: 0 0 0 0.2rem rgba(122, 25, 192, 0.25);
}

.date-input-content {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.calendar-icon {
    width: 20px;
    height: 20px;
    opacity: 0.6;
}

.dropdown-icon {
    margin-left: auto;
    color: #6c757d;
}

.dropdown-icon.rotate {
    transform: rotate(180deg);
}

.date-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    z-index: 1000;
    display: none;
    height: 420px;
    overflow: hidden;
}


.date-dropdown.show {
    display: block;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: none;
    background: #7A19C0;
    color: white;
    border-radius: 0.375rem 0.375rem 0 0;
}

.nav-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.25rem;
    color: white;
}

.nav-btn:hover {
    background-color: rgba(255, 255, 255, 0.15);
}

.nav-btn:focus {
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.25);
}

.month-year-container {
    flex: 1;
    text-align: center;
}

.month-year {
    font-weight: 600;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.25rem;
    color: white;
}

.month-year:hover {
    background-color: rgba(255, 255, 255, 0.15);
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    padding: 1rem;
    background: white;
    flex: 1;
}

.day-header {
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    color: #7A19C0;
    background: #E8D5F2;
    border-radius: 10px;
}

.day-cell {
    height: 40px;
    width: 40px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.875rem;
    background: #E8D5F2;
    border-radius: 50%;
    color: #7A19C0;
    font-weight: 500;
}

.day-cell:hover {
    background-color: #D1B3E6;
    color: #7A19C0;
}

.day-cell.selected {
    background-color: #7A19C0;
    color: white;
    font-weight: bold;
}

.day-cell.today {
    background-color: #f6d779;
    color: #000;
    font-weight: bold;
}

.day-cell.other-month {
    color: #adb5bd;
    background-color: #f0f0f0;
}

.day-cell.other-month:hover {
    background-color: #e0e0e0;
    color: #6c757d;
}

.year-selector, .month-selector {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    display: none;
    flex-direction: column;
    z-index: 10;
    border-radius: 0.375rem;
}

.year-selector.show, .month-selector.show {
    display: flex;
}

.year-header, .month-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: none;
    background: #7A19C0;
    color: white;
    border-radius: 0.375rem 0.375rem 0 0;
}

.year-grid, .month-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    padding: 1rem;
    flex: 1;
    background: white;
    overflow-y: auto;
}

.year-cell, .month-cell {
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 8px;
    border: none;
    background: #E8D5F2;
    font-weight: 500;
    color: #7A19C0;
    font-size: 0.875rem;
}

.year-cell:hover, .month-cell:hover {
    background-color: #D1B3E6;
    color: #7A19C0;
}

.year-cell.selected, .month-cell.selected {
    background-color: #7A19C0;
    color: white;
    font-weight: bold;
}

.year-cell.current, .month-cell.current {
    background-color: #f6d779;
    color: #000;
    font-weight: bold;
}

.close-btn {
    background: #E8D5F2;
    border: none;
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    margin: 1rem;
    cursor: pointer;
    text-align: center;
    color: #7A19C0;
    font-weight: 600;
}

.close-btn:hover {
    background-color: #D1B3E6;
    color: #7A19C0;
}

/* Focus styles for accessibility */
.day-cell:focus,
.year-cell:focus,
.month-cell:focus {
    outline: 2px solid #7A19C0;
    outline-offset: 2px;
}

.date-input:focus-within {
    border-color: #7A19C0;
    box-shadow: 0 0 0 0.2rem rgba(122, 25, 192, 0.25);
}

@media (max-width: 360px) {
    .date-dropdown {
        height: 370px;
    }
    .calendar-grid {
        display: grid;
        grid-template-columns: repeat(7, 1fr);
        gap: 4px;
        padding: 1rem;
        background: white;
        flex: 1;
    }
    .calendar-header,.year-header,.month-header{
        padding: 0.5rem;
    }
    .close-btn {
        padding: 0.5rem;
        margin: 0.5rem;
    }
}