/* CSS complet pour l'application de gestion de programmes d'entraînement */

/* Classes utilitaires */
.hidden { display: none !important; }
.error-message { color: red; margin-top: 10px; font-size: 14px; }

/* Section d'authentification */
.auth-section {
    padding: 40px;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    color: white;
    text-align: center;
    border-radius: 20px;
    margin: 20px;
}

.auth-form {
    background: rgba(255,255,255,0.1);
    padding: 20px;
    border-radius: 15px;
    margin: 20px 0;
    display: inline-block;
    min-width: 300px;
}

.auth-input {
    width: 100%;
    padding: 12px;
    margin: 8px 0;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    background: #333;
    color: white;
}

.auth-btn {
    background: #22c55e;
    color: #000;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
    margin: 10px;
}

.auth-btn:hover {
    background: #16a34a;
    transform: translateY(-2px);
}

/* Styles généraux */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #000;
    min-height: 100vh;
    padding: 20px;
    color: #fff;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: #1a1a1a;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    overflow: hidden;
}

/* Header */
.header {
    background: linear-gradient(135deg, #1a1a1a 0%, #333 100%);
    color: white;
    padding: 30px;
    text-align: center;
    position: relative;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 300;
}

.header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Boutons du header */
.header-buttons {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
}

.header-btn {
    background: rgba(255,255,255,0.1);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.header-btn:hover {
    background: rgba(255,255,255,0.2);
}

.metabolisme-info {
    background: rgba(0, 0, 0, 0.3);
    padding: 15px;
    border-radius: 10px;
    margin: 15px 0;
    border-left: 4px solid #22c55e;
}

.metabolisme-info h3 {
    margin-bottom: 10px;
}

.metabolisme-info p {
    margin-bottom: 0;
}

.tips-section {
    margin-top: 10px;
}

.tips-section h4 {
    color: #ccc;
    font-size: 1rem;
    margin-bottom: 10px;
}

.tips-section p {
    font-size: 0.9rem;
    color: #888;
    margin-bottom: 8px;
}

.tips-section ul {
    list-style-type: none;
    padding-left: 0;
}

.tips-section li {
    margin-bottom: 8px;
    padding-left: 20px;
    position: relative;
}

.tips-section li:before {
    content: "•";
    color: #22c55e;
    position: absolute;
    left: 0;
}


/* Section de configuration */
.config-section {
    padding: 30px;
    border-bottom: 2px solid #333;
    background: #1a1a1a;
}

.config-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

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

.form-group label {
    font-weight: 600;
    margin-bottom: 8px;
    color: #fff;
}

.form-group input, .form-group select {
    padding: 12px;
    border: 2px solid #333;
    border-radius: 10px;
    font-size: 16px;
    background: #2d2d2d;
    color: #fff;
    transition: all 0.3s ease;
}

.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}

/* Réduire la marge entre "Configuration des séances" et les jours */
.form-group:has(#durationInputs) label {
    margin-top: 15px;
    margin-bottom: 5px;
}

/* Assurer que les jours restent sur une seule ligne */
.days-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.day-container {
    flex: 1 0 auto;
}

/* Désactiver clairement les jours non sélectionnables */
.day-checkbox:disabled + .day-label {
    opacity: 0.3;
    cursor: not-allowed;
}

.form-group:has(.days-grid) label {
    margin-bottom: 20px;
}

/* Section des programmes */
.program-section {
    padding: 30px;
    display: none;
    background: #1a1a1a;
}

.session-card {
    background: #2d2d2d;
    border-radius: 15px;
    margin-bottom: 30px;
    overflow: hidden;
    border: 1px solid #333;
}

.session-header {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: #000;
    padding: 20px;
    font-size: 1.3rem;
    font-weight: 600;
    text-transform: uppercase;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.warmup-section {
    background: #333;
    padding: 15px 20px;
    border-bottom: 1px solid #444;
    color: #22c55e;
    font-size: 0.9rem;
}

.exercise-list {
    padding: 20px;
}

.exercise-row {
    display: flex;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #333;
    background: #2d2d2d;
}

.exercise-row:last-child {
    border-bottom: none;
}

.exercise-number {
    background: #4a4a4a;
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-right: 15px;
    font-size: 14px;
}

.exercise-content {
    flex: 1;
}

.exercise-name {
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 5px;
}

.exercise-details {
    font-size: 0.85rem;
    color: #aaa;
}

.exercise-select {
    width: 100%;
    padding: 8px;
    border: 1px solid #444;
    border-radius: 5px;
    background: #333;
    color: #fff;
    margin-bottom: 5px;
}

.muscle-group {
    display: inline-block;
    background: #00ff41;
    color: #000;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 10px;
}

/* Section d'export */
.export-section {
    padding: 30px;
    background: #1a1a1a;
    text-align: center;
    border-top: 1px solid #333;
}

.export-btn {
    background: #00ff41;
    color: #000;
    border: none;
    padding: 15px 30px;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 0 10px;
}

.export-btn:hover {
    background: #00cc33;
    transform: translateY(-2px);
}

/* Inputs de durée */
.duration-inputs {
    display: flex;
    gap: 15px;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 10px;
}

.duration-input {
    flex: 1;
    min-width: 150px;
}

.session-type-inputs {
    display: none;
    gap: 15px;
    flex-wrap: wrap;
    margin-top: 15px;
}

/* Section d'information */
.info-section {
    padding: 20px 30px;
    background: #2d2d2d;
    border-left: 4px solid #22c55e;
    margin: 20px 30px;
    border-radius: 5px;
}

.info-section h3 {
    color: #22c55e;
    margin-bottom: 10px;
}

.info-section h4 {
    font-size: 1rem;
    color: #ccc;
    margin-bottom: 10px;
}

.info-section p {
    font-size: 0.9rem;
    color: #888;
    margin-bottom: 8px;
}

/* Bouton de déconnexion */
.logout-btn {
    margin-left: 10px;
    background: rgba(255,255,255,0.1);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
}

/* Section de récapitulatif */
.recap-section {
    margin: 20px auto;
    max-width: 800px;
}

.recap-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin: 0 auto;
}

.muscle-recap-card {
    background: #333;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
}

.muscle-recap-card h4 {
    color: #22c55e;
    margin-bottom: 10px;
}

.muscle-recap-card .stats {
    color: #ccc;
    font-size: 0.9rem;
}

.stats {
    font-size: 0.9rem;
    line-height: 1.6;
    color: #ccc;
}

/* Grille des jours */
.day-checkbox {
    display: none;
}

.day-label {
    background: #333;
    color: #fff;
    padding: 10px;
    text-align: center;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    border: 2px solid transparent;
    min-width: 40px;
}

.day-checkbox:checked + .day-label {
    background: #22c55e;
    color: #000;
    border-color: #22c55e;
}

/* Section d'administration */
.admin-section {
    padding: 30px;
    background: #1a1a1a;
}

.admin-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.admin-card {
    background: #2d2d2d;
    padding: 20px;
    border-radius: 15px;
    border: 1px solid #333;
}

.admin-card h3 {
    color: #22c55e;
    margin-bottom: 15px;
    text-align: center;
}

.admin-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.admin-form input, .admin-form select {
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #444;
    background: #333;
    color: #fff;
}

.admin-form button {
    background: #22c55e;
    color: #000;
    border: none;
    padding: 10px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
}

.admin-form button:hover {
    background: #16a34a;
}

.exercise-list-admin {
    max-height: 200px;
    overflow-y: auto;
    margin-top: 10px;
}

.exercise-list-admin div {
    padding: 8px;
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.exercise-list-admin div:last-child {
    border-bottom: none;
}

/* Drag and drop styles */
.drag-handle {
    cursor: grab;
    color: #666;
    margin-right: 10px;
    user-select: none;
}

.drag-handle:active {
    cursor: grabbing;
}

.dragging {
    opacity: 0.5;
}

/* Section de personnalisation */
.personalization-section {
    padding: 30px;
    background: #1a1a1a;
}

.personalization-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.personalization-card {
    background: #2d2d2d;
    padding: 20px;
    border-radius: 15px;
    border: 1px solid #333;
}

.personalization-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.personalization-btn {
    background: #22c55e;
    color: #000;
    border: none;
    padding: 10px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    margin-top: 10px;
}

.generate-btn {
    background: #22c55e;
    color: #000;
    border: none;
    padding: 15px 40px;
    border-radius: 50px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 20px auto;
    display: block;
}

.generate-btn:hover {
    background: #16a34a;
    transform: translateY(-3px);
}

#savedProgramsList h3 {
    color: #22c55e;
    margin-bottom: 15px;
}

/* Styles pour les programmes sauvegardés */
#savedProgramsContainer {
    margin: 20px auto;
    max-width: 800px;
    text-align: center;
    display: none; /* Masqué par défaut */
}

#savedProgramsContainer h3 {
    color: #22c55e;
    margin-bottom: 15px;
}

#savedProgramsList {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 800px;
    margin: 0 auto;
}

.saved-program {
    padding: 10px;
    background: #333;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}

.saved-program:hover {
    background: #22c55e;
    color: #000;
}

.program-name {
    text-align: center;
    margin-bottom: 20px;
    color: #22c55e;
    font-size: 1.5rem;
}

.delete-program-btn {
    background: #ff4444;
    color: #000;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    margin: 10px auto;
    font-weight: bold;
    display: block;
}

.delete-program-btn:hover {
    background: #ff0000;
}

/* AJOUTEZ ce CSS à la fin de votre fichier style.css */

.exercise-actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
    align-items: center;
}

.action-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.3s ease;
}

.replace-btn {
    background: #3b82f6;
    color: white;
}

.replace-btn:hover {
    background: #2563eb;
    transform: scale(1.1);
}

.delete-btn {
    background: #ef4444;
    color: white;
}

.delete-btn:hover {
    background: #dc2626;
    transform: scale(1.1);
}

.delete-btn:disabled {
    background: #666;
    cursor: not-allowed;
    opacity: 0.5;
}

.delete-btn:disabled:hover {
    transform: none;
}

/* Modal de sélection d'exercices */
.exercise-modal {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;  /* bloque scroll page */
}

.modal-content {
  background: #2d2d2d;
  border-radius: 15px;
  padding: 30px;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto; /* seul scroll sur contenu interne */
  position: relative;
  border: 2px solid #22c55e;
  box-sizing: border-box;
}

.modal-header {
    color: #22c55e;
    font-size: 1.5rem;
    margin-bottom: 20px;
    text-align: center;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    color: #999;
    font-size: 24px;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.exercise-option {
    background: #333;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.exercise-option:hover {
    background: #444;
    border-color: #22c55e;
}

.exercise-option-name {
    font-weight: 600;
    color: #fff;
    margin-bottom: 5px;
}

.exercise-option-reps {
    color: #aaa;
    font-size: 0.9rem;
}

/* Responsive pour mobile */
@media (max-width: 768px) {
    .exercise-actions {
        flex-direction: column;
        gap: 5px;
    }
    
    .action-btn {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
    
    .modal-content {
        width: 95%;
        padding: 20px;
    }
}

/* AJOUTEZ ce CSS à votre style.css */

.delete-modal-content {
    max-width: 400px;
    text-align: center;
}

.delete-modal-header {
    color: #ef4444;
    font-size: 1.3rem;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.delete-modal-body {
    margin-bottom: 25px;
}

.delete-modal-body p {
    margin-bottom: 15px;
    color: #ccc;
}

.exercise-to-delete {
    font-weight: bold;
    color: #fff;
    background: #333;
    padding: 10px;
    border-radius: 8px;
}

.warmup-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.warmup-text {
    flex: 1;
}

.add-exercise-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.add-exercise-btn {
    background: #22c55e;
    color: white;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.3s ease;
}

.add-exercise-btn:hover {
    background: #16a34a;
    transform: scale(1.1);
}

.exercise-count {
    font-size: 0.85rem;
    color: #aaa;
    font-weight: 600;
}

.exercise-count.max-reached {
    color: #fbbf24;
}

/* Étapes du modal d'ajout */
.add-exercise-step {
    margin-bottom: 20px;
}

.add-exercise-step h4 {
    color: #22c55e;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.back-btn {
    background: #6b7280;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
    margin-bottom: 15px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.back-btn:hover {
    background: #4b5563;
}

.muscle-group-option {
    background: #333;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    text-align: center;
}

.muscle-group-option:hover {
    background: #444;
    border-color: #22c55e;
}

.muscle-group-name {
    font-weight: 600;
    color: #fff;
    text-transform: capitalize;
}

/* Responsive pour mobile */
@media (max-width: 768px) {
    .warmup-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .add-exercise-container {
        align-self: flex-end;
    }
    
    .add-exercise-btn {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }
}

.delete-warning {
    font-size: 0.9rem;
    color: #fbbf24;
    font-style: italic;
}

.delete-modal-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.delete-confirm-btn {
    background: #ef4444;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.delete-confirm-btn:hover {
    background: #dc2626;
    transform: translateY(-2px);
}

.delete-cancel-btn {
    background: #6b7280;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.delete-cancel-btn:hover {
    background: #4b5563;
    transform: translateY(-2px);
}

.modal {
  position: fixed;
  z-index: 10000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow:auto;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
}

.hidden {
  display: none !important;
}

.modal-content {
  background-color: #222;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 0 20px #222;
  min-width: 300px;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  color: white;
  position: relative;
}

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

.modal-close {
  font-size: 25px;
  font-weight: bold;
  background: none;
  border: none;
  color: #bbb;
  cursor: pointer;
  transition: color 0.3s ease;
}

.modal-close:hover {
  color: white;
}

.replacement-list {
  max-height: 60vh;
  overflow-y: auto;
}

.exercise-option {
  padding: 12px;
  margin-bottom: 10px;
  border-radius: 8px;
  background: #333;
  cursor: pointer;
  transition: background-color 0.25s;
}

.exercise-option:hover {
  background-color: #555;
}

/* Media queries pour responsive */
@media (max-width: 768px) {
    .header h1 {
        font-size: 2rem;
    }

    .config-grid {
        grid-template-columns: 1fr;
    }

    .duration-inputs {
        flex-direction: column;
    }

    .days-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .exercise-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .admin-panel {
        grid-template-columns: 1fr;
    }
}
