/* Main container */
.datepicker-container {
    position: relative;
    display: inline-block;
    width: 100%;
}

/* Input styling */
.datepicker-display {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    background-color: white;
    cursor: pointer;
}

/* Hide original input */
.datetime-sql-input {
    display: none;
}

/* Dropdown positioning and appearance */
.datepicker-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1000;
    display: none;
    width: 100%;
    max-width: 450px; /* Ensure it doesn't get too wide */
    min-width: 425px;
    padding: 10px;
    margin-top: 5px;
    background-color: white;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    box-sizing: border-box;
}

/* Calendar header layout */
.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    font-size: 1.1rem;
}

/* Calendar grid - Fixed width issue */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
    text-align: center;
    border: solid 1px #e5e5e5;
    width: 100%; /* Ensure grid stays within container */
    box-sizing: border-box; /* Include border in width calculation */
}

/* Calendar cells */
.calendar-grid div {
    padding: 8px;
    cursor: pointer;
    border: solid 1px #e5e5e5;
    /* Better performance than border-collapse */
    box-sizing: border-box;
    /* For state transitions */
    transition: background-color 0.15s ease-in-out;
}

/* Weekday headers */
.calendar-grid .weekday {
    font-weight: 500;
    background-color: #f8f9fa;
    cursor: default;
}

/* Hover and selection state */
.calendar-grid div:hover:not(.weekday), 
.calendar-grid .selected {
    background-color: #007bff;
    color: white;
    border-radius: 5px;
}

/* Time picker layout */
.time-picker {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
}

/* Time section label */
.time-section .form-label {
    font-weight: 500;
}

/* Time labels */
.time-label {
    display: block;
    font-size: 0.8rem;
    font-weight: bold;
    margin-top: 5px;
    text-align: center;
}

/* Time section container */
.time-section {
    max-width: 300px;
    margin: auto;
}

/* Time dropdown selects */
.time-picker select {
    width: 100%;
    max-width: 110px;
    min-width: 80px;
    text-align: center;
}

/* Responsive styles for mobile */
@media (max-width: 768px) {
    .datepicker-dropdown {
        position: fixed;
        top: 50% !important; /* Override any inline styles */
        left: 50% !important;
        bottom: auto !important;
        transform: translate(-50%, -50%);
        min-width: 320px;
        width: calc(100% - 30px);
        max-width: 450px;
        border-radius: 15px;
        padding: 15px;
        margin: 0;
    }
}

/* Smaller screens */
@media (max-width: 400px) {
    .calendar-grid div {
        padding: 5px;
    }
    
    .time-picker {
        flex-direction: column;
    }
    
    .time-picker select {
        max-width: 100%;
    }
}

/* Above positioning variant */
.datepicker-dropdown-top {
    top: auto;
    bottom: 100%;
    margin-top: 0;
    margin-bottom: 5px;
}

/* Disabled day cell */
.calendar-grid .disabled {
    color: #ccc;
    background: #f8f9fa;
    cursor: not-allowed;
    pointer-events: none;
    opacity: 0.5;
}

/* Selected day cell */
.calendar-grid .selected {
    background-color: #007bff;
    color: #fff;
    border-radius: 5px;
}

/* Weekday header */
.calendar-grid .weekday {
    font-weight: 500;
    background-color: #f8f9fa;
    cursor: default;
}
.datepicker-container .calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}
