/**
 * Time Picker Styles for 4Unit Order System
 * 
 * @author Firma: 4Unit Systems Integration GmbH
 *         Adresse: Jahnstraße 36, 34582 Borken (Hessen)
 *         Telefon: 05682 73 48 26
 *         E-Mail: info@4unit.com
 *         Website: https://4unit.com
 */

/* Time Section Styles */
.time-section {
    margin-bottom: 1.5rem;
}

.time-selection-container {
    padding: 1rem;
    background: #f8fafc;
    border-radius: 0.5rem;
    border: 1px solid #e2e8f0;
}

/* Time Options */
.time-option {
    margin-bottom: 1rem;
    padding: 0.75rem;
    border-radius: 0.375rem;
    border: 1px solid #d1d5db;
    background: white;
    transition: all 0.2s ease;
}

.time-option:hover {
    border-color: #3b82f6;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.time-radio {
    display: none;
}

.time-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: 500;
    color: #374151;
}

.time-label i {
    color: #6b7280;
    margin-right: 0.5rem;
}

.time-radio:checked + .time-label {
    color: #3b82f6;
}

.time-radio:checked + .time-label i {
    color: #3b82f6;
}

.estimated-time {
    margin-left: auto;
    font-size: 0.75rem;
    color: #6b7280;
    font-weight: normal;
}

/* Time Picker Button */
.time-picker-button-container {
    margin-top: 1rem;
}

.time-picker-button {
    width: 100%;
    padding: 0.75rem 1rem;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 0.375rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.time-picker-button:hover {
    background: #2563eb;
    transform: scale(1.02);
}

.time-picker-button:active {
    background: #1d4ed8;
    transform: scale(0.98);
}

.time-picker-button {
    width: 100%;
    padding: 0.75rem 1rem;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 0.375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
}

/* Date Selection */
.date-selection-container {
    margin-top: 1rem;
    padding: 1rem;
    background: #f0f9ff;
    border-radius: 0.5rem;
    border: 1px solid #bae6fd;
}

.date-options {
    display: flex;
    gap: 1rem;
}

.date-option {
    flex: 1;
    padding: 0.75rem;
    border-radius: 0.375rem;
    border: 1px solid #d1d5db;
    background: white;
    transition: all 0.2s ease;
}

.date-option:hover {
    border-color: #3b82f6;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.date-radio {
    display: none;
}

.date-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: 500;
    color: #374151;
}

.date-label i {
    color: #6b7280;
    margin-right: 0.5rem;
}

.date-radio:checked + .date-label {
    color: #3b82f6;
}

.date-radio:checked + .date-label i {
    color: #3b82f6;
}

/* Available Times Grid */
.available-times-grid {
    margin-top: 1rem;
}

.available-times-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.75rem;
}

.time-slots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 0.5rem;
}

.time-slot {
    padding: 0.5rem;
    text-align: center;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    font-weight: 500;
}

.time-slot:hover {
    border-color: #3b82f6;
    background: #f0f9ff;
    transform: scale(1.02);
    transition: all 0.15s ease;
}

.time-slot.selected {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.time-slot {
    padding: 0.5rem;
    text-align: center;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 0.875rem;
    font-weight: 500;
    user-select: none;
}

.time-slot.disabled {
    background: #f3f4f6;
    color: #9ca3af;
    cursor: not-allowed;
    border-color: #e5e7eb;
}

/* Time Picker Modal */
.time-picker-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    box-sizing: border-box;
}

.time-picker-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.time-picker-content {
    position: relative;
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow: hidden;
    transition: all 0.2s ease;
    /* Perfect centering */
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.time-picker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
}

.time-picker-header h3 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: #111827;
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: #6b7280;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 0.25rem;
    transition: color 0.2s ease;
}

.close-modal:hover {
    color: #374151;
}

.time-picker-body {
    padding: 1.5rem;
}

/* Modal Date Selection */
.modal-date-selection {
    margin-bottom: 2rem;
}

.modal-date-selection h4 {
    font-size: 1rem;
    font-weight: 600;
    color: #111827;
    margin-bottom: 1rem;
}

.date-buttons {
    display: flex;
    gap: 1rem;
}

.date-btn {
    flex: 1;
    padding: 0.75rem 1rem;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    color: #374151;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.date-btn:hover {
    border-color: #3b82f6;
    color: #3b82f6;
}

.date-btn.active {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

.date-btn:hover {
    border-color: #3b82f6;
    color: #3b82f6;
    transform: scale(1.02);
}

.date-btn:active {
    transform: scale(0.98);
}

.date-btn {
    flex: 1;
    padding: 0.75rem 1rem;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    color: #374151;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
}

/* Modal Time Selection */
.modal-time-selection h4 {
    font-size: 1rem;
    font-weight: 600;
    color: #111827;
    margin-bottom: 1rem;
}

/* Date Navigation */
.date-navigation {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding: 0.75rem;
    background: #f8fafc;
    border-radius: 0.5rem;
}

.nav-btn {
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    padding: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #374151;
}

.nav-btn:hover {
    border-color: #3b82f6;
    color: #3b82f6;
}

.current-date {
    font-weight: 600;
    color: #111827;
    font-size: 0.875rem;
}

/* Time Grid in Modal */
.time-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 0.5rem;
    max-height: 300px;
    overflow-y: auto;
}

.time-grid .time-slot {
    padding: 0.75rem 0.5rem;
    font-size: 0.875rem;
}

/* Time Picker Footer */
.time-picker-footer {
    display: flex;
    gap: 0.75rem;
    padding: 1.5rem;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
}

.btn-secondary {
    padding: 0.75rem 1.5rem;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    color: #374151;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1;
}

.btn-secondary:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

.btn-primary {
    padding: 0.75rem 1.5rem;
    background: #3b82f6;
    border: 1px solid #3b82f6;
    border-radius: 0.375rem;
    color: white;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1;
}

.btn-primary:hover {
    background: #2563eb;
    border-color: #2563eb;
}

.btn-primary:disabled {
    background: #9ca3af;
    border-color: #9ca3af;
    cursor: not-allowed;
}

/* Responsive Design */
@media (max-width: 640px) {
    .time-picker-modal {
        padding: 0.5rem;
    }
    
    .time-picker-content {
        width: calc(100% - 1rem);
        max-height: 90vh;
        max-width: 400px;
    }
    
    .time-slots-grid {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    }
    
    .time-grid {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    }
    
    .time-picker-footer {
        flex-direction: column;
    }
    
    .btn-secondary,
    .btn-primary {
        flex: none;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .time-selection-container {
        background: #1f2937;
        border-color: #374151;
    }
    
    .time-option {
        background: #374151;
        border-color: #4b5563;
    }
    
    .time-label {
        color: #d1d5db;
    }
    
    .time-picker-content {
        background: #1f2937;
        color: #d1d5db;
    }
    
    .time-picker-header {
        background: #111827;
        border-color: #374151;
    }
    
    .time-picker-header h3 {
        color: #d1d5db;
    }
    
    .date-navigation {
        background: #111827;
    }
    
    .time-picker-footer {
        background: #111827;
        border-color: #374151;
    }
    
    .btn-secondary {
        background: #374151;
        border-color: #4b5563;
        color: #d1d5db;
    }
    
    .btn-secondary:hover {
        background: #4b5563;
    }
}

/* Accessibility */
.time-slot:focus,
.time-picker-button:focus,
.nav-btn:focus,
.close-modal:focus,
.btn-secondary:focus,
.btn-primary:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Loading States */
.time-slot.loading {
    opacity: 0.6;
    pointer-events: none;
}

.time-picker-button.loading {
    opacity: 0.7;
    pointer-events: none;
}

.time-picker-button.loading::after {
    content: '';
    width: 1rem;
    height: 1rem;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 0.5rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
} 