﻿/* ========================================
   TIME PICKER DROPDOWN STYLES
   Custom dropdown time selector for business hours
   Supports typing + dropdown selection
   ======================================== */

.time-picker-wrapper {
    position: relative;
    display: inline-block;
    min-width: 120px;
}

/* Input container with toggle button */
.time-picker-input-container {
    position: relative;
    display: flex;
    align-items: center;
}

/* The text input for typing */
.time-picker-input {
    width: 100%;
    padding-right: 32px !important;
    font-size: 0.875rem;
    line-height: 1.5;
}

    .time-picker-input:focus {
        border-color: #86b7fe;
        box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
    }

/* Dropdown toggle button */
.time-picker-toggle {
    position: absolute;
    right: 1px;
    top: 1px;
    bottom: 1px;
    width: 30px;
    background: transparent;
    border: none;
    border-left: 1px solid #ced4da;
    border-radius: 0 0.375rem 0.375rem 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    transition: background-color 0.15s ease, color 0.15s ease;
}

    .time-picker-toggle:hover {
        background-color: #f8f9fa;
        color: #495057;
    }

    .time-picker-toggle i {
        font-size: 0.75rem;
        transition: transform 0.2s ease;
    }

.time-picker-wrapper.open .time-picker-toggle i {
    transform: rotate(180deg);
}

/* The dropdown panel */
.time-picker-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1050;
    display: none;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    margin-top: 4px;
    overflow: hidden;
}

.time-picker-wrapper.open .time-picker-dropdown {
    display: block;
    animation: timePickerFadeIn 0.15s ease-out;
}

@keyframes timePickerFadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Scrollable options container */
.time-picker-options {
    max-height: 240px;
    overflow-y: auto;
    padding: 0.25rem 0;
}

    /* Custom scrollbar for options */
    .time-picker-options::-webkit-scrollbar {
        width: 8px;
    }

    .time-picker-options::-webkit-scrollbar-track {
        background: #f8f9fa;
        border-radius: 4px;
    }

    .time-picker-options::-webkit-scrollbar-thumb {
        background: #ced4da;
        border-radius: 4px;
    }

        .time-picker-options::-webkit-scrollbar-thumb:hover {
            background: #adb5bd;
        }

/* Individual time option */
.time-picker-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: background-color 0.1s ease;
    color: #212529;
    font-size: 0.9rem;
}

    .time-picker-option:hover,
    .time-picker-option:focus {
        background-color: #f8f9fa;
        outline: none;
    }

    .time-picker-option.selected {
        background-color: #e8f4fd;
        font-weight: 500;
    }

        .time-picker-option.selected:hover {
            background-color: #d6ebfa;
        }

.time-picker-option-text {
    flex: 1;
}

.time-picker-check {
    color: #0d6efd;
    font-size: 0.875rem;
    margin-left: 0.5rem;
}

/* Hide original input */
.time-picker-hidden-input {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Responsive adjustments */
@media (max-width: 576px) {
    .time-picker-wrapper {
        min-width: 100px;
    }

    .time-picker-input {
        font-size: 0.8125rem;
    }

    .time-picker-option {
        padding: 0.625rem 0.75rem;
    }

    .time-picker-options {
        max-height: 200px;
    }
}

/* Integration with business hours layout */
.time-inputs-row .time-picker-wrapper {
    flex-shrink: 0;
    width: 120px;
}

/* Ensure dropdown doesn't get cut off */
.time-inputs-row {
    position: relative;
    z-index: 1;
}

    .time-inputs-row:focus-within {
        z-index: 10;
    }

/* Validation states */
.time-picker-wrapper.is-invalid .time-picker-input {
    border-color: #dc3545;
}

.time-picker-wrapper.is-valid .time-picker-input {
    border-color: #198754;
}
