/* Settings Page - Material Design 3.0 Style with Fixed Tabs */

.settings-page {
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
}

/* Styles pour la nouvelle interface horaires */
.day-setting {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 16px;
    padding: 20px;
    transition: all 0.2s ease;
}

.day-setting:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.day-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.day-title {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.2em;
    font-weight: 600;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-color);
    transition: .3s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input:checked + .slider {
    background-color: var(--primary);
}

input:checked + .slider:before {
    transform: translateX(20px);
}

/* Day content */
.day-content {
    transition: opacity 0.3s ease;
}

.day-content.disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* Service mode selector */
.service-mode-selector {
    display: flex;
    gap: 24px;
    margin-bottom: 20px;
    padding: 16px;
    background: var(--bg-hover);
    border-radius: 8px;
}

.service-mode-selector label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    font-weight: 500;
    transition: color 0.2s ease;
}

.service-mode-selector label:hover {
    color: var(--text-primary);
}

.service-mode-selector input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

/* Time slots */
.time-slots {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.time-slot {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
}

.time-slot h4 {
    margin: 0 0 12px 0;
    color: var(--primary);
    font-size: 1em;
    font-weight: 600;
}

/* Service header */
.service-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
}

.service-title {
    font-size: 1.1em;
    font-weight: 600;
    margin: 0;
}

.service-title.midi {
    color: #ff6b35;
}

.service-title.soir {
    color: #667eea;
}

/* Closed checkbox */
.closed-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
}

.closed-checkbox input {
    margin: 0;
    transform: scale(1.2);
}

.closed-checkbox label {
    color: var(--text-secondary);
    font-size: 0.9em;
    cursor: pointer;
    margin: 0;
}

/* Time inputs */
.time-inputs {
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: opacity 0.3s ease;
}

.time-inputs.disabled {
    opacity: 0.4;
    pointer-events: none;
}

.time-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.time-group label {
    min-width: 80px;
    font-size: 0.9em;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Time select dropdowns */
.time-select {
    flex: 1;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.9em;
    cursor: pointer;
    transition: all 0.2s ease;
}

.time-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.2);
}

.time-select:disabled {
    background: var(--bg-primary);
    color: var(--text-secondary);
    cursor: not-allowed;
}

/* Continuous service styling */
.continuous-service {
    grid-column: 1 / -1;
}

/* Schedule actions */
.schedule-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

/* Hidden state */
.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 768px) {
    .service-mode-selector {
        flex-direction: column;
        gap: 12px;
    }
    
    .time-slots {
        grid-template-columns: 1fr;
    }
    
    .schedule-actions {
        flex-direction: column;
    }
}

/* Tabs Header - Fixe en haut */
.settings-tabs-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: relative;
    flex-shrink: 0;
    z-index: 100;
}

.tabs-container {
    display: flex;
    align-items: center;
    position: relative;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 0 24px;
}

.tabs-container::-webkit-scrollbar {
    display: none;
}

.tab-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 16px 20px 20px 20px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    min-width: 110px;
    flex-shrink: 0;
    border-radius: 8px 8px 0 0;
}

.tab-button:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.tab-button.active {
    color: var(--primary);
    background: var(--bg-card);
}

.tab-icon {
    font-size: 20px;
    margin-bottom: 4px;
}

.tab-label {
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1;
}

.tab-indicator {
    position: absolute;
    bottom: 0;
    height: 2px;
    background: var(--primary);
    border-radius: 1px 1px 0 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    left: 24px;
    width: 0;
}

/* Tab Content */
.tab-content {
    flex: 1;
    overflow: auto;
    background: var(--bg-primary);
    min-height: 600px; /* Assure une hauteur minimale */
    position: relative;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
    animation: fadeIn 0.2s ease-in-out;
}

.panel-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 32px 24px;
}

.section-header {
    margin-bottom: 32px;
}

.section-title {
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 8px 0;
}

.section-description {
    font-size: 16px;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.4;
}

.section-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin: 0;
}

.form-input {
    padding: 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
    background: var(--bg-card);
    color: var(--text-primary);
    transition: all 0.2s ease;
    outline: none;
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(103, 80, 164, 0.1);
}

.form-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

.form-input:disabled {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: not-allowed;
}

textarea.form-input {
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
}

.placeholder-text {
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
    padding: 60px 20px;
    background: var(--bg-card);
    border-radius: 12px;
    margin: 20px 0;
    border: 1px dashed var(--border-color);
}

.settings-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 24px;
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    margin-top: auto;
    flex-shrink: 0;
}

.btn-primary, .btn-secondary {
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    outline: none;
    min-width: 120px;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.btn-primary:disabled {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: not-allowed;
}

.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .settings-container {
        margin: 16px;
        padding: 16px;
    }
    
    .settings-title {
        font-size: 28px;
    }
    
    .section-title {
        font-size: 20px;
    }
    
    .settings-actions {
        flex-direction: column;
    }
    
    .btn-primary, .btn-secondary {
        width: 100%;
    }
}

/* Masquer le FAB sur la page paramètres */
body.settings-page .fab,
.app-container.settings-active .fab {
    display: none !important;
}

/* ===== SECTION HORAIRES - DESIGN UNIQUE ===== */

/* Contrôles de template */
.schedule-controls {
    display: flex;
    gap: 12px;
    margin-bottom: 32px;
    padding: 16px;
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.schedule-controls .btn-secondary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 13px;
}

.schedule-controls .md-icon {
    font-size: 16px;
}

/* Cartes par jour */
.schedule-days {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.schedule-day-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    transition: all 0.2s ease;
}

.schedule-day-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* En-tête du jour */
.day-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.day-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.day-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
}

.toggle-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    min-width: 50px;
}

/* Switch Material Design 3.0 */
.switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    border-radius: 12px;
}

.switch-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background: white;
    transition: all 0.3s ease;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.switch input:checked + .switch-slider {
    background: var(--primary);
    border-color: var(--primary);
}

.switch input:checked + .switch-slider:before {
    transform: translateX(24px);
}

/* Contenu du jour */
.day-content {
    transition: all 0.3s ease;
}

.day-content.hidden {
    display: none;
}

/* Sélecteur de mode avec chips */
.mode-selector {
    margin-bottom: 20px;
}

.mode-chips {
    display: flex;
    gap: 8px;
    padding: 4px;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.mode-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 13px;
    font-weight: 500;
    flex: 1;
    justify-content: center;
}

.mode-chip:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.mode-chip.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.mode-chip .md-icon {
    font-size: 16px;
}

/* Configuration des horaires */
.time-config {
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
}

/* Mode continu */
.continuous-config .time-range {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.time-input-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.time-input-group label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.time-input {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    min-width: 100px;
}

.time-input:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 2px rgba(103, 80, 164, 0.1);
}

.time-separator {
    color: var(--text-secondary);
    font-weight: 500;
    margin-top: 20px;
}

.continuous-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: var(--primary);
    color: white;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
}

.continuous-indicator .md-icon {
    font-size: 16px;
}

/* Mode créneaux */
.slots-config .slots-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.slot-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.slot-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.slot-content .time-range {
    display: flex;
    align-items: center;
    gap: 8px;
}

.slot-name {
    display: flex;
}

.slot-name-input {
    flex: 1;
    padding: 6px 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 13px;
}

.slot-name-input:focus {
    border-color: var(--primary);
    outline: none;
}

.slot-remove-btn {
    padding: 6px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.slot-remove-btn:hover {
    background: #ff4757;
    color: white;
    border-color: #ff4757;
}

.slot-remove-btn .md-icon {
    font-size: 16px;
}

.add-slot-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background: transparent;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 13px;
    font-weight: 500;
}

.add-slot-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(103, 80, 164, 0.05);
}

.add-slot-btn .md-icon {
    font-size: 16px;
}

/* Settings groups for General section */
.settings-group {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    transition: all 0.2s ease;
}

.settings-group:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.group-title {
    margin: 0 0 20px 0;
    font-size: 1.3em;
    font-weight: 600;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.group-title::before {
    content: '';
    width: 4px;
    height: 20px;
    background: var(--primary);
    border-radius: 2px;
}

/* Toggle container for better alignment */
.toggle-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.toggle-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin: 0;
    flex: 1;
}

.toggle-group {
    margin-bottom: 16px;
}

.toggle-group:last-child {
    margin-bottom: 0;
}

/* Button group for action buttons */
.button-group {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.button-group .btn-secondary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    font-size: 13px;
}

.button-group .md-icon {
    font-size: 16px;
}

/* Special styling for destructive actions */
#clearDataBtn {
    color: #ff4757;
    border-color: #ff4757;
}

#clearDataBtn:hover {
    background: #ff4757;
    color: white;
}

#exportDataBtn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Responsive adjustments for general settings */
@media (max-width: 768px) {
    .settings-group {
        padding: 16px;
        margin-bottom: 16px;
    }
    
    .toggle-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .toggle-label {
        margin-bottom: 0;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .button-group .btn-secondary {
        width: 100%;
        justify-content: center;
    }
}

/* Focus states for accessibility */
.btn-primary:focus-visible,
.btn-secondary:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.form-input:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}