/**
 * Styles pour l'édition des horaires - Planning de Travail PWA
 * Fichier: assets/css/edit.css
 */

/* ========================================
   CONTRÔLES D'ÉDITION
   ======================================== */

.edit-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 15px;
}

.edit-btn {
    background: var(--accent-blue);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 500;
    white-space: nowrap;
}

.edit-btn:hover {
    background: #42a5f5;
    transform: translateY(-1px);
}

.edit-btn.cancel {
    background: var(--accent-red);
}

.edit-btn.cancel:hover {
    background: #e57373;
}

.edit-btn.save {
    background: var(--accent-green);
}

.edit-btn.save:hover {
    background: #66bb6a;
}

.edit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ========================================
   ZONE D'ÉDITION
   ======================================== */

.schedule-edit {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 15px;
    margin-bottom: 15px;
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
}

.dark-theme .schedule-edit {
    background: #374151;
    border-color: var(--border-color);
}

.edit-section-title {
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

/* ========================================
   INPUTS HORAIRES
   ======================================== */

.schedule-input-group {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 10px;
    transition: all 0.3s ease;
}

.dark-theme .schedule-input-group {
    background: rgba(0, 0, 0, 0.2);
}

.schedule-input-group:hover {
    background: rgba(100, 181, 246, 0.1);
}

.schedule-input {
    flex: 1;
    padding: 10px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 0.9rem;
    background: var(--card-bg);
    color: var(--text-primary);
    outline: none;
    transition: all 0.3s ease;
    min-width: 80px;
}

.schedule-input:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(100, 181, 246, 0.1);
}

.schedule-input.invalid {
    border-color: var(--accent-red);
    background-color: #ffebee;
    animation: shake 0.3s ease;
}

.dark-theme .schedule-input.invalid {
    background-color: #3d2a2a;
}

.schedule-separator {
    margin: 0 8px;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 1.1rem;
}

/* ========================================
   BOUTONS D'AJOUT/SUPPRESSION
   ======================================== */

.add-slot-btn {
    background: var(--accent-green);
    color: white;
    border: none;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(129, 199, 132, 0.3);
}

.add-slot-btn:hover {
    background: #66bb6a;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(129, 199, 132, 0.4);
}

.remove-slot-btn {
    background: var(--accent-red);
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.remove-slot-btn:hover {
    background: #e57373;
    transform: scale(1.1);
}

.add-slot-container {
    text-align: center;
    margin: 15px 0;
    padding: 10px;
    border: 2px dashed var(--border-color);
    border-radius: 10px;
    transition: all 0.3s ease;
}

.add-slot-container:hover {
    border-color: var(--accent-green);
    background: rgba(129, 199, 132, 0.05);
}

.add-slot-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 5px;
}

/* ========================================
   TOGGLE REPOS
   ======================================== */

.rest-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
    padding: 12px;
    background: linear-gradient(135deg, rgba(255, 183, 77, 0.1), rgba(255, 183, 77, 0.05));
    border-radius: 12px;
    border: 1px solid rgba(255, 183, 77, 0.2);
    transition: all 0.3s ease;
}

.dark-theme .rest-toggle {
    background: linear-gradient(135deg, rgba(255, 183, 77, 0.2), rgba(255, 183, 77, 0.1));
    border-color: rgba(255, 183, 77, 0.3);
}

.rest-toggle:hover {
    background: linear-gradient(135deg, rgba(255, 183, 77, 0.15), rgba(255, 183, 77, 0.08));
}

.rest-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--accent-orange);
    transform: scale(1.2);
}

.rest-label {
    cursor: pointer;
    font-weight: 500;
    color: var(--text-primary);
    user-select: none;
    flex: 1;
}

/* ========================================
   INPUTS D'INFORMATION
   ======================================== */

.info-input {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 0.9rem;
    background: var(--card-bg);
    color: var(--text-primary);
    margin-bottom: 12px;
    outline: none;
    transition: all 0.3s ease;
}

.info-input:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(100, 181, 246, 0.1);
}

.info-input::placeholder {
    color: var(--text-muted);
    font-style: italic;
}

.info-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.info-section {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

/* ========================================
   MESSAGES DE VALIDATION
   ======================================== */

.validation-message {
    color: var(--accent-red);
    font-size: 0.8rem;
    margin-top: 5px;
    display: none;
    padding: 5px 10px;
    background: rgba(255, 138, 128, 0.1);
    border-radius: 5px;
    border-left: 3px solid var(--accent-red);
}

.validation-message.show {
    display: block;
    animation: slideInError 0.3s ease;
}

/* ========================================
   ÉTATS D'ÉDITION
   ======================================== */

.day-card.editing {
    border: 2px solid var(--accent-blue);
    box-shadow: 0 6px 25px var(--shadow);
    transform: translateY(-2px);
}

.day-card.editing .day-header {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.schedules-container {
    transition: all 0.3s ease;
    overflow: hidden;
}

.schedules-container.hidden {
    max-height: 0;
    opacity: 0;
    margin: 0;
    padding: 0;
}

/* ========================================
   ANIMATIONS
   ======================================== */

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-2px); }
    75% { transform: translateX(2px); }
}

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

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.edit-btn.saving {
    animation: pulse 1s infinite;
    pointer-events: none;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 480px) {
    .edit-controls {
        flex-wrap: wrap;
        gap: 8px;
        margin-bottom: 12px;
    }
    
    .edit-btn {
        flex: 1;
        min-width: 100px;
        justify-content: center;
        padding: 10px 12px;
    }
    
    .schedule-input-group {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        padding: 10px;
    }
    
    .schedule-input {
        margin-bottom: 0;
        min-width: unset;
    }
    
    .schedule-separator {
        align-self: center;
        margin: 5px 0;
        transform: rotate(90deg);
    }
    
    .schedule-edit {
        padding: 12px;
    }
    
    .remove-slot-btn {
        align-self: center;
        margin-top: 5px;
    }
    
    .rest-toggle {
        padding: 10px;
        gap: 10px;
    }
    
    .info-input {
        padding: 10px;
    }
    
    .add-slot-container {
        margin: 10px 0;
        padding: 8px;
    }
}

/* Mobile très petit */
@media (max-width: 360px) {
    .edit-btn {
        font-size: 0.8rem;
        padding: 8px 10px;
        gap: 3px;
    }
    
    .schedule-edit {
        padding: 10px;
        margin-bottom: 12px;
    }
    
    .schedule-input {
        padding: 8px;
        font-size: 0.85rem;
    }
    
    .add-slot-btn {
        width: 32px;
        height: 32px;
        font-size: 1.1rem;
    }
    
    .remove-slot-btn {
        width: 28px;
        height: 28px;
        font-size: 0.9rem;
    }
}

/* Mode paysage mobile */
@media (orientation: landscape) and (max-height: 500px) {
    .schedule-edit {
        padding: 10px;
        margin-bottom: 10px;
    }
    
    .edit-controls {
        margin-bottom: 10px;
    }
    
    .rest-toggle {
        padding: 8px;
        margin-bottom: 10px;
    }
    
    .info-section {
        margin-top: 15px;
        padding-top: 10px;
    }
}

/* ========================================
   AMÉLIORATIONS ACCESSIBILITÉ
   ======================================== */

/* Focus visible pour navigation clavier */
.edit-btn:focus-visible,
.schedule-input:focus-visible,
.info-input:focus-visible,
.rest-checkbox:focus-visible {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
}

/* Amélioration du contraste */
@media (prefers-contrast: high) {
    .schedule-edit {
        border-width: 3px;
    }
    
    .edit-btn {
        border: 2px solid currentColor;
    }
    
    .schedule-input {
        border-width: 3px;
    }
}

/* Réduction des mouvements */
@media (prefers-reduced-motion: reduce) {
    .edit-btn,
    .schedule-input,
    .add-slot-btn,
    .remove-slot-btn,
    .schedule-edit,
    .day-card.editing {
        transition: none;
        animation: none;
        transform: none;
    }
    
    .edit-btn:hover,
    .add-slot-btn:hover,
    .remove-slot-btn:hover {
        transform: none;
    }
}

/* ========================================
   CLASSES UTILITAIRES
   ======================================== */

.edit-transition {
    transition: all 0.3s ease;
}

.edit-hidden {
    display: none !important;
}

.edit-disabled {
    opacity: 0.5;
    pointer-events: none;
}

.edit-highlight {
    background: rgba(100, 181, 246, 0.1);
    border-color: var(--accent-blue);
}

.edit-error {
    border-color: var(--accent-red) !important;
    background: rgba(255, 138, 128, 0.1);
}

/* Bouton supprimer - style spécifique */
.edit-btn.delete {
    background: var(--accent-red);
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

.edit-btn.delete:hover {
    background: #e57373;
    border-color: var(--accent-red);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 138, 128, 0.3);
}

.edit-btn.delete:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(255, 138, 128, 0.2);
}

/* Animation de confirmation pour le bouton supprimer */
.edit-btn.delete.confirming {
    animation: deleteConfirm 0.6s ease-in-out;
    background: #ff5722;
}

@keyframes deleteConfirm {
    0%, 100% { transform: scale(1); }
    25% { transform: scale(1.05); background: #ff3d00; }
    50% { transform: scale(0.95); }
    75% { transform: scale(1.02); }
}

/* État désactivé pour le bouton supprimer */
.edit-btn.delete:disabled {
    background: var(--border-color);
    color: var(--text-muted);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Responsive pour les contrôles d'édition avec 3 boutons */
@media (max-width: 480px) {
    .edit-controls {
        flex-direction: column;
        gap: 8px;
        margin-bottom: 15px;
    }
    
    .edit-btn {
        flex: 1;
        min-width: unset;
        width: 100%;
        justify-content: center;
        padding: 12px 16px;
        font-size: 0.9rem;
    }
    
    /* Ordre des boutons sur mobile */
    .edit-btn.save { order: 1; }
    .edit-btn.cancel { order: 2; }
    .edit-btn.delete { order: 3; }
}

/* Mobile très petit - boutons plus compacts */
@media (max-width: 360px) {
    .edit-btn {
        padding: 10px 14px;
        font-size: 0.85rem;
        gap: 4px;
    }
}

/* Mode paysage mobile - garder les boutons en ligne */
@media (orientation: landscape) and (max-height: 500px) {
    .edit-controls {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 6px;
        margin-bottom: 10px;
    }
    
    .edit-btn {
        flex: 1;
        min-width: 80px;
        padding: 8px 12px;
        font-size: 0.8rem;
    }
}

/* Amélioration de l'accessibilité */
.edit-btn.delete:focus-visible {
    outline: 2px solid var(--accent-red);
    outline-offset: 2px;
}

/* Indicateur de danger */
.edit-btn.delete::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.edit-btn.delete:hover::before {
    left: 100%;
}

/* Amélioration du contraste en mode sombre */
.dark-theme .edit-btn.delete {
    background: #d32f2f;
    color: white;
}

.dark-theme .edit-btn.delete:hover {
    background: #b71c1c;
    border-color: #d32f2f;
}

/* Réduction des mouvements pour l'accessibilité */
@media (prefers-reduced-motion: reduce) {
    .edit-btn.delete,
    .edit-btn.delete:hover,
    .edit-btn.delete::before {
        transition: none;
        animation: none;
        transform: none;
    }
    
    .edit-btn.delete.confirming {
        animation: none;
    }
}