/* ============================================================================
   Time Window Picker - Visual 24-Hour Timeline Component
   Iteration 60, Increment 1
   ============================================================================ */

.time-window-picker {
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

/* ============================================================================
   Header Section
   ============================================================================ */

.picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e9ecef;
}

.picker-header h5 {
    margin: 0;
    color: #212529;
    font-weight: 600;
}

.no-restriction-toggle {
    display: flex;
    align-items: center;
}

.no-restriction-toggle label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    cursor: pointer;
    font-weight: 500;
    color: #495057;
}

.no-restriction-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.no-restriction-message {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 2rem;
    background: #e7f3ff;
    border: 2px solid #0d6efd;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 500;
    color: #0d6efd;
}

.no-restriction-message i {
    font-size: 1.5rem;
}

/* ============================================================================
   Preset Buttons
   ============================================================================ */

.preset-buttons {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.preset-buttons .btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ============================================================================
   Timeline Container
   ============================================================================ */

.timeline-container {
    margin-bottom: 2rem;
    padding: 2rem 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    position: relative;
}

.timeline-track {
    position: relative;
    height: 60px;
    background: linear-gradient(to right, #e9ecef 0%, #dee2e6 50%, #e9ecef 100%);
    border-radius: 30px;
    cursor: pointer;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* ============================================================================
   Hour Markers
   ============================================================================ */

.timeline-markers {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: 30px;
    pointer-events: none;
}

.hour-marker {
    position: absolute;
    transform: translateX(-50%);
}

.hour-label {
    display: block;
    margin-top: 8px;
    font-size: 0.75rem;
    color: #6c757d;
    font-weight: 500;
    text-align: center;
}

/* Show only certain hour labels to avoid crowding */
.hour-marker:nth-child(3n) .hour-label {
    display: block;
}

.hour-marker:not(:nth-child(3n)) .hour-label {
    display: none;
}

/* ============================================================================
   Selected Window Highlight
   ============================================================================ */

.timeline-highlight {
    position: absolute;
    top: 0;
    height: 100%;
    background: linear-gradient(135deg, rgba(13, 110, 253, 0.3), rgba(13, 110, 253, 0.5));
    border: 2px solid #0d6efd;
    border-radius: 30px;
    pointer-events: none;
    z-index: 1;
    box-shadow: 0 2px 8px rgba(13, 110, 253, 0.3);
}

/* Midnight crossing highlights */
.timeline-highlight.midnight-crossing-start {
    border-radius: 30px 30px 30px 0;
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.3), rgba(220, 53, 69, 0.5));
    border-color: #dc3545;
}

.timeline-highlight.midnight-crossing-end {
    border-radius: 30px 0 30px 30px;
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.3), rgba(220, 53, 69, 0.5));
    border-color: #dc3545;
}

.midnight-indicator {
    position: absolute;
    top: -30px;
    right: 10px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    background: #dc3545;
    color: white;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* ============================================================================
   Drag Handles
   ============================================================================ */

.drag-handle {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: grab;
    z-index: 10;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.drag-handle:hover,
.drag-handle:focus {
    transform: translate(-50%, -50%) scale(1.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.drag-handle.dragging {
    cursor: grabbing;
    transform: translate(-50%, -50%) scale(1.3);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
}

.drag-handle:focus {
    outline: 3px solid rgba(13, 110, 253, 0.5);
    outline-offset: 2px;
}

/* Start handle - Blue */
.handle-start {
    background: #0d6efd;
    border: 3px solid #ffffff;
}

.handle-start::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
}

/* End handle - Orange */
.handle-end {
    background: #fd7e14;
    border: 3px solid #ffffff;
}

.handle-end::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
}

/* ============================================================================
   Handle Tooltips
   ============================================================================ */

.handle-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 8px;
    padding: 0.375rem 0.75rem;
    background: #212529;
    color: white;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.handle-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #212529;
}

.drag-handle:hover .handle-tooltip,
.drag-handle:focus .handle-tooltip,
.drag-handle.dragging .handle-tooltip {
    opacity: 1;
}

/* ============================================================================
   Manual Time Inputs
   ============================================================================ */

.manual-inputs {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.time-input-group {
    flex: 1;
}

.time-input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #495057;
    font-size: 0.875rem;
}

.time-input-group input[type="time"] {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 1rem;
}

.time-input-group input[type="time"]:focus {
    border-color: #0d6efd;
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.time-separator {
    font-size: 1.5rem;
    color: #6c757d;
    margin-top: 1.5rem;
}

/* ============================================================================
   Validation Error
   ============================================================================ */

.validation-error {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: #f8d7da;
    border: 1px solid #dc3545;
    border-radius: 4px;
    color: #dc3545;
    font-weight: 500;
    margin-bottom: 1rem;
}

.validation-error i {
    font-size: 1.25rem;
}

/* ============================================================================
   Preview Section
   ============================================================================ */

.preview-section {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.preview-label {
    font-weight: 600;
    color: #495057;
    font-size: 0.875rem;
}

.preview-text {
    flex: 1;
    font-size: 1rem;
    color: #212529;
    font-weight: 500;
}

/* ============================================================================
   Mobile Responsive
   ============================================================================ */

@media (max-width: 768px) {
    .time-window-picker {
        padding: 1rem;
    }

    .picker-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .timeline-container {
        padding: 1.5rem 0.5rem;
    }

    .timeline-track {
        height: 50px;
    }

    .drag-handle {
        width: 28px;
        height: 28px;
    }

    .manual-inputs {
        flex-direction: column;
        gap: 1rem;
    }

    .time-separator {
        margin-top: 0;
        transform: rotate(90deg);
    }

    .preview-section {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    /* Show fewer hour labels on mobile */
    .hour-marker:nth-child(4n) .hour-label {
        display: block;
    }

    .hour-marker:not(:nth-child(4n)) .hour-label {
        display: none;
    }
}

@media (max-width: 576px) {
    .preset-buttons {
        flex-direction: column;
    }

    .preset-buttons .btn {
        width: 100%;
        justify-content: center;
    }

    /* Show even fewer hour labels on small screens */
    .hour-marker:nth-child(6n) .hour-label {
        display: block;
    }

    .hour-marker:not(:nth-child(6n)) .hour-label {
        display: none;
    }
}

/* ============================================================================
   Animation and Transitions
   ============================================================================ */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.time-window-picker {
    animation: fadeIn 0.3s ease;
}

/* ============================================================================
   Touch Device Support
   ============================================================================ */

@media (hover: none) and (pointer: coarse) {
    /* Increase touch target sizes for mobile */
    .drag-handle {
        width: 32px;
        height: 32px;
    }

    .no-restriction-toggle input[type="checkbox"] {
        width: 24px;
        height: 24px;
    }
}

/* ============================================================================
   High Contrast Mode Support
   ============================================================================ */

@media (prefers-contrast: high) {
    .timeline-track {
        border: 2px solid #000000;
    }

    .timeline-highlight {
        border-width: 3px;
    }

    .drag-handle {
        border-width: 4px;
    }
}

/* ============================================================================
   Reduced Motion Support
   ============================================================================ */

@media (prefers-reduced-motion: reduce) {
    .drag-handle,
    .timeline-highlight,
    .handle-tooltip {
        transition: none;
    }

    .time-window-picker {
        animation: none;
    }
}
