/* ==========================================================================
   Feuille de Style Principale
   ========================================================================== */

/* =================================== */
/* 1. VARIABLES & STYLES GLOBAUX       */
/* =================================== */
:root {
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --danger: #ef4444;
  --danger-dark: #dc2626;
  --success: #16a34a;
  --success-dark: #15803d;
  --bg-gradient-start: #f9fafb;
  --bg-gradient-end: #e0f2fe;
  --text-primary: #0f172a;
  --text-secondary: #1e293b;
  --border-color: #d1d5db;
  --shadow-sm: 0 4px 10px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 8px 18px rgba(0, 0, 0, 0.08);
  --font-family: 'Inter', 'Segoe UI', sans-serif;
  --category-plaisir: #22c55e;
  --category-obligatoire: #ef4444;
  --category-occasionnel: #eab308;
}

body {
    overflow-x: hidden;
  font-family: var(--font-family);
  margin: 0;
  background: linear-gradient(135deg, var(--bg-gradient-start), var(--bg-gradient-end));
  color: var(--text-secondary);
  min-height: 100vh;
}

/* Classe utilitaire */
.hidden {
  display: none !important;
}

/* =================================== */
/* 2. MISE EN PAGE & STRUCTURE         */
/* =================================== */
.app {
  max-width: 1200px;
  width: 100%;
  margin: auto;
  padding: 20px;
  box-sizing: border-box;
  min-height: 90vh;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  flex-wrap: wrap;
  gap: 15px;
}

h1 {
  margin: 0;
  font-size: clamp(1.5rem, 4vw, 1.8rem);
  font-weight: 700;
  text-transform: capitalize;
  color: var(--text-primary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 15px;
}

#auth-container {
  text-align: right;
}

/* =================================== */
/* 3. COMPOSANTS                       */
/* =================================== */

/* --- Boutons --- */
.month-nav button,
.auth-button,
.btn {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.month-nav button:hover,
.auth-button:hover,
.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.3);
}

#changeProfileBtn {
  border-radius: 12px;
}

#saveSub {
  background: linear-gradient(135deg, var(--success), var(--success-dark));
  color: white;
}

#saveSub:hover {
  background: linear-gradient(135deg, var(--success-dark), #166534);
}

.btn-secondary {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
  font-weight: 600;
}

.btn-secondary:hover {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

#cancelSub {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
  font-weight: 600;
}

#cancelSub:hover {
  background: var(--primary);
  color: white;
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger), var(--danger-dark));
  color: white;
}

.btn-danger:hover {
  background: linear-gradient(135deg, var(--danger-dark), #991b1b);
}

.delete-btn {
  background: none;
  border: none;
  color: var(--danger);
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.delete-btn:hover {
  transform: scale(1.2);
  color: var(--danger-dark);
}

/* --- Navigation & Menu --- */
.month-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

#monthYear {
  width: 300px;
  text-align: center;
}

.menu-container {
  position: relative;
  display: inline-block;
}

.menu-btn {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border: none;
  padding: 10px 14px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 20px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.menu-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.3);
}

.dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background-color: white;
  min-width: 240px;
  box-shadow: var(--shadow-md);
  border-radius: 12px;
  z-index: 1001;
  overflow: hidden;
  animation: fadeIn 0.2s ease-out;
  border: 1px solid var(--border-color);
  padding: 5px;
}

.dropdown-menu.show {
  display: block;
}

.dropdown-menu a {
  color: var(--text-secondary);
  padding: 12px 16px;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
  border-radius: 8px;
  transition: all 0.2s ease-in-out;
}

.dropdown-menu a:hover {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  transform: scale(1.02);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

/* --- Calendrier --- */
#calendar-container {
  display: none;
  /* Caché par défaut */
}

#calendar-container.visible {
  display: grid !important;
  /* Quand il est visible, on force l'affichage en grille */
}

.calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 12px;
}

.day {
  background: white;
  border-radius: 16px;
  padding: 10px;
  height: 180px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  transition: all 0.25s ease;
}

.day:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.day.adjacent {
  background: #f9fafb;
  box-shadow: none;
  opacity: 0.6;
  cursor: default;
}

.day.adjacent:hover {
  transform: none;
  box-shadow: none;
}

.day.adjacent strong {
  color: #64748b;
}

.day strong {
  font-size: 1.1rem;
  color: var(--primary-dark);
}

.day.today {
  border: 3px solid var(--primary);
  padding: 7px;
}

.sub-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
  background: #f8fafc;
  padding: 6px 8px;
  border-radius: 10px;
  transition: background 0.2s ease;
}

.sub-item:hover {
  background: #f1f5f9;
}

.sub-info {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  overflow: hidden;
}

.sub-info span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sub-item img {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid var(--primary-dark);
  cursor: zoom-in;
  object-fit: cover;
}

/* --- Modales --- */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(6px);
  z-index: 1000;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: white;
  padding: 24px;
  border-radius: 16px;
  max-width: 400px;
  width: 90%;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
  animation: fadeIn 0.3s ease;
}

.modal-content h2 {
  margin: 0 0 10px;
  color: var(--text-primary);
  text-align: center;
}

.modal-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.modal-actions button {
  padding: 10px 18px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.25s ease;
  font-size: 15px;
}

#imageModal {
  cursor: zoom-out;
}

#imageModalContent {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

/* --- Formulaires --- */
input,
select {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  outline: none;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

input:focus,
select:focus {
  border-color: var(--primary-dark);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  text-align: left;
}

.form-label {
  font-weight: 500;
  font-size: 14px;
  color: var(--text-secondary);
  margin-left: 4px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-start;
  width: fit-content;
  white-space: nowrap;
}

#newProfileName {
  margin-bottom: 26px
}

;


.image-input-options label {
  padding: 10px 14px;
  font-size: 14px;
}

.file-name-display {
  text-align: center;
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 5px;
  display: block;
  min-height: 20px;
  word-break: break-all;
}

label[for="subImageCamera"] {
  display: none;
}

.color-picker-wrapper {
  position: relative;
  width: 100%;
  height: 40px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  box-sizing: border-box;
  transition: background-color 0.2s ease;
}

.color-picker-wrapper input[type="color"] {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}


/* --- Totaux & Statistiques --- */
.totals {
  width: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: white;
  padding: 12px 18px;
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}

.totals div {
  font-weight: 500;
  color: var(--text-primary);
}

#remaining-container {
  display: none;
}

#stats-container {
  margin-top: 20px;
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  background: white;
  width: 100%;
  padding: 15px;
  box-sizing: border-box;
}

.progress-bar-container {
  width: 100%;
  background-color: #e9ecef;
  border-radius: 8px;
  height: 14px;
  margin: 6px 0 8px;
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

#budgetProgressBar {
  height: 100%;
  width: 0%;
  background-color: var(--success);
  border-radius: 8px;
  transition: width 0.5s ease-in-out, background-color 0.5s ease;
}

/* --- Graphiques --- */
#chart-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-bottom: 15px;
}

#chart-controls button {
  padding: 8px 12px;
  font-size: 14px;
}

#chart {
  width: 100%;
}

.chart-wrapper {
  position: relative;
  height: 300px;
}

/* --- Listes Détaillées --- */
#dayDetailList {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 300px;
  overflow-y: auto;
  padding: 5px;
}

.day-detail-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8fafc;
  padding: 12px;
  border-radius: 10px;
}

.day-detail-item img {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
  cursor: zoom-in;
}

.day-detail-info {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 12px;
  font-size: 1rem;
  font-weight: 500;
}

.day-detail-actions button,
.btn-list-delete {
  font-size: 12px;
  padding: 6px 8px;
}

.profile-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.profile-list-item .btn {
  flex-grow: 1;
}

.btn-profile-action {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 18px;
  padding: 0;
  border: 2px solid;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  background: transparent;
}

.btn-profile-share {
  color: var(--primary);
  border-color: var(--primary);
}

.btn-profile-share:hover {
  background: var(--primary);
  color: white;
  transform: scale(1.1);
}

.btn-profile-delete {
  color: var(--danger);
  border-color: var(--danger);
}

.btn-profile-delete:hover {
  background: var(--danger);
  color: white;
  transform: scale(1.1);
}

/* --- Catégories --- */
.category-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 8px;
  flex-shrink: 0;
}

.category-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px;
  border-radius: 6px;
  background-color: #f8fafc;
}

.category-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
}


/* =================================== */
/* 4. SECTION DIVERTISSEMENT & CATALOGUE */
/* =================================== */

/* --- Contrôles & Filtres --- */
.entertainment-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 15px;
}

.filter-buttons .btn-filter {
  background: transparent;
  color: var(--text-secondary);
  border: 2px solid var(--border-color);
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s ease;
}

.filter-buttons .btn-filter.active,
.filter-buttons .btn-filter:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* --- Liste des divertissements --- */
.entertainment-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.entertainment-item {
  background: white;
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  gap: 15px;
  padding: 15px;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.entertainment-item:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-md);
}

.entertainment-item.status-watched {
  opacity: 0.7;
}

.entertainment-item.status-watched .item-details h3 {
  text-decoration: line-through;
  color: #64748b;
}

.item-poster {
  width: 100px;
  height: 150px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
}

.item-details {
  display: flex;
  flex-direction: column;
}

.item-details h3 {
  margin: 0 0 5px 0;
  font-size: 1.2rem;
  color: var(--text-primary);
}

.item-details p {
  margin: 2px 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.item-type {
  font-weight: 600;
}

.item-status {
  margin-top: auto;
  font-weight: bold;
  color: var(--primary-dark);
}

/* ========================================================== */
/* --- NOUVEAUX STYLES : MODALE DE DÉTAILS D'UN ÉLÉMENT --- */
/* ========================================================== */

#itemDetailModal .modal-card {
    /* Taille et apparence générale */
    max-width: 550px; /* Légèrement plus large que l'image pour le contenu */
    width: 90%;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    animation: fadeIn 0.3s ease-out; /* Assurez-vous que l'animation fadeIn existe */
    overflow: hidden; /* Important pour les coins arrondis */
}

/* Modifie l'en-tête (pour qu'elle soit plus contrastée si nécessaire, mais on garde la structure) */
#itemDetailModal .modal-header {
    background-color: #f8fafc; /* Fond très clair pour le titre */
    padding: 15px 20px;
    border-bottom: 1px solid #e2e8f0;
}

#itemDetailModal .modal-header h3 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

#itemDetailModal .modal-body {
    padding: 20px;
    background-color: #ffffff;
}

/* Structure de la carte de détails (Affiche + Infos) */
.item-details-grid {
    display: grid;
    grid-template-columns: 180px 1fr; /* Largeur de l'affiche et largeur des infos */
    gap: 20px;
    margin-bottom: 20px;
}

/* Style de l'image (Affiche) */
#itemDetailPoster {
    width: 100%;
    max-height: 270px; /* Limite la hauteur de l'affiche */
    aspect-ratio: 2 / 3;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    flex-shrink: 0; /* Empêche l'image de rétrécir */
    background-color: #e2e8f0; /* Fond pour les placeholders */
}

/* Conteneur des informations */
.item-info-text {
    display: flex;
    flex-direction: column;
    gap: 12px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.item-info-text p {
    margin: 0;
    line-height: 1.3;
}

.item-info-text strong {
    font-weight: 600;
    color: var(--text-primary);
    min-width: 90px; /* Assure un alignement visuel des deux-points */
    display: inline-block;
}

/* Styles pour la description */
.item-description-section {
    padding-top: 15px;
    border-top: 1px solid #e2e8f0;
    margin-top: 15px;
}

.item-description-section h4 {
    margin: 0 0 8px 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

#itemDetailDescription {
    color: #475569;
    font-style: italic;
    line-height: 1.5;
    text-align: justify;
    max-height: 150px;
    overflow-y: auto;
    padding-right: 5px; /* Espace pour la barre de défilement */
}

/* Style pour le bouton Fermer (dans la section actions) */
#itemDetailModal .modal-actions {
    padding: 20px 0 0 0;
    border-top: 1px solid #e2e8f0;
    margin-top: 20px;
    justify-content: flex-end; /* Bouton à droite */
}

/* Responsive pour les petits écrans */
@media (max-width: 500px) {
    #itemDetailModal .modal-card {
        border-radius: 0;
        width: 100%;
        max-width: 100vw;
        min-height: 100vh;
    }
    
    #itemDetailModal .modal-header {
        position: sticky;
        top: 0;
        z-index: 10;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    }

    .item-details-grid {
        grid-template-columns: 1fr; /* Empile l'affiche et les infos */
        gap: 15px;
        margin-bottom: 15px;
    }
    
    #itemDetailPoster {
        max-width: 180px;
        height: auto;
        margin: 0 auto; /* Centrer l'affiche */
    }
}

.item-actions {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 5px;
  background: rgba(255, 255, 255, 0.7);
  padding: 5px;
  border-radius: 8px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.entertainment-item:hover .item-actions {
  opacity: 1;
}

.item-actions button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 4px;
}

.item-actions .btn-delete {
  color: var(--danger);
}

.item-actions .btn-edit {
  color: var(--primary);
}

.empty-list-message {
  text-align: center;
  grid-column: 1 / -1;
  font-size: 1.1rem;
  color: #475569;
  padding: 40px 0;
}

#seriesInfo {
  display: flex;
  gap: 10px;
}

/* --- Catalogue Netflix --- */
#catalog-container {
    /* On retire la grille du conteneur principal */
    display: block;
}

.catalog-row {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.row-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  text-transform: capitalize;
}

.row-content {
  display: flex;
  gap: 15px;
  overflow-x: auto;
  /* Permet le défilement horizontal */
  padding-bottom: 20px;
  /* Espace pour la barre de défilement */
  scrollbar-width: thin;
  scrollbar-color: var(--primary) #e0f2fe;
}

.row-content::-webkit-scrollbar {
  height: 8px;
}

.row-content::-webkit-scrollbar-track {
  background: #e0f2fe;
  border-radius: 4px;
}

.row-content::-webkit-scrollbar-thumb {
  background-color: var(--primary);
  border-radius: 4px;
}



.card-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: center;
}

/* =================================== */
/* NOUVEAU STYLE DES CARTES DE FILMS   */
/* =================================== */

/* Le conteneur global (date + carte) */
.entertainment-card-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

/* Le style de la date au-dessus */
.card-release-date {
  font-weight: 500;
  font-size: 0.85rem;
  color: var(--text-secondary);
  background-color: rgba(255, 255, 255, 0.7);
  padding: 5px 12px;
  border-radius: 20px; /* Style "pilule" */
  backdrop-filter: blur(4px);
  border: 1px solid #e2e8f0;
}

/* La carte principale (image + titre) */
.poster-card {
  width: 160px;
  background-color: white;
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  overflow: hidden; /* Pour que l'image respecte les coins arrondis */
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  display: flex;
  flex-direction: column; /* Aligne l'image et le titre verticalement */
  cursor: pointer;
}

/* Effet au survol de la carte */
.poster-card:hover {
  transform: translateY(-6px) scale(1.03);
  box-shadow: var(--shadow-md);
}

/* L'image de l'affiche */
.poster-card img {
  width: 100%;
  aspect-ratio: 2 / 3; /* Format d'affiche standard */
  object-fit: cover;
  display: block; /* Retire l'espace sous l'image */
}

/* La zone de texte sous l'image */
.poster-card-caption {
  padding: 12px;
  text-align: center;
  /* Assure que la zone a une hauteur même si le titre est vide */
  min-height: 50px; 
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

/* Le titre du film, toujours visible */
.poster-card-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  /* Empêche les titres trop longs de déborder */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}



.month-header {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 40px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
    text-transform: capitalize;
}

.month-grid {
    display: grid;
    /* On utilise la même largeur de carte qu'avant */
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 25px 20px; /* Espace vertical et horizontal */
}


/* =================================== */
/* 5. LOADERS & ANIMATIONS             */
/* =================================== */

/* --- Animations Keyframes --- */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes fadeInCenter {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Note: Cette animation est définie deux fois dans le fichier original. */
@keyframes bounce {
  0%,
  80%,
  100% {
    transform: scale(0);
  }
  40% {
    transform: scale(1.0);
  }
}

/* --- Composants Loader --- */
.loader-container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 60px 20px;
  text-align: center;
  color: var(--text-secondary);
}

.spinner {
  border: 5px solid #e0f2fe;
  border-top: 5px solid var(--primary);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  animation: spin 1s linear infinite;
  margin-bottom: 20px;
}

.bouncing-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 15px;
}

.bouncing-dots div {
  width: 15px;
  height: 15px;
  margin: 0 5px;
  background-color: var(--primary);
  border-radius: 50%;
  animation: bounce 1.4s infinite ease-in-out both;
}

.bouncing-dots div:nth-child(1) {
  animation-delay: -0.32s;
}

.bouncing-dots div:nth-child(2) {
  animation-delay: -0.16s;
}

/* =================================== */
/* 6. RESPONSIVE DESIGN (Mobile)       */
/* =================================== */
@media (max-width: 768px) {
  .app {
    padding: 10px;
  }



 #existing-images-container {
    display: flex !important;
    flex-wrap: wrap !important;
    visibility: visible !important;
    min-height: 100px;
    width: 100%;
    background-color: #ffe4e6; /* Fond rose clair pour le repérer */
    border: 1px dashed red;
    padding: 10px;
    box-sizing: border-box;
  }
  
  
.image-input-options {
  /* Fait passer les boutons en colonne pour éviter la superposition */
  flex-direction: column;
  gap: 8px;
}

/* Ici, on cible spécifiquement les labels DANS .image-input-options.
  Ces règles vont s'appliquer EN PLUS de .btn et .btn-secondary, 
  et vont écraser les styles existants (comme la taille) pour mobile.
*/
.image-input-options .btn {
  /* On réduit la taille (padding et police) pour un meilleur affichage */
  padding: 8px 12px;
  font-size: 13px;

  /* On s'assure que l'icône et le texte sont parfaitement centrés */
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.image-input-options label {
  /* On réduit la taille pour un meilleur affichage sur petit écran */
  padding: 8px 12px;
  font-size: 13px;

  /* On s'assure que l'icône et le texte sont parfaitement centrés */
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

  header {
    flex-direction: column;
    align-items: center;
    gap: 20px;
  }

  .header-actions {
    order: -1;
    width: 100%;
    justify-content: center;
  }

  #monthYear {
    width: auto;
  }

  .totals {
    width: 100%;
    max-width: 280px;
    box-sizing: border-box;
  }

  h1 {
    font-size: 1.4rem;
  }

  .calendar {
  /* On force 7 colonnes pour les 7 jours de la semaine */
  grid-template-columns: repeat(5, 1fr);
  gap: 5px; /* On réduit un peu l'espacement pour que ça rentre mieux */
}

   .day {
    height: 120px;
    padding: 8px;
    border-radius: 12px;
    -ms-overflow-style: none;
    /* IE and Edge */
    scrollbar-width: none;
    /* Firefox */

    /* On passe en Grid pour aligner les images des abonnements */
    display: grid;
    grid-template-columns: repeat(auto-fill, 32px);
    grid-auto-rows: 32px;
    gap: 4px;
    align-content: start;
    /* Ajout pour centrer horizontalement la grille des logos */
    justify-content: center;
  }

  .day strong {
    font-size: 0.9rem;
    /* Le numéro du jour prend toute la première ligne */
    grid-column: 1 / -1;
    height: min-content;
  }

  .day.today {
    padding: 5px;
  }

  .day::-webkit-scrollbar {
    display: none;
    /* Chrome, Safari and Opera */
  }



 /* --- BLOC CORRIGÉ --- */
  /* Sur mobile, on ne conserve que l'image de l'abonnement */
  .sub-item {
    padding: 0;
    border-radius: 0;
    width: 30px;
    height: 30px;
    background: transparent !important;
    margin: 0;
    display: block;
  }

  /* On cache les détails textuels comme le nom ou le prix */
  .sub-item .sub-info span,
  .sub-item-details {
      display: none;
  }

  /* On s'assure que l'image est bien visible et correctement dimensionnée */
  .sub-item img {
    display: block !important;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    border: none;
  }

  /* --- FIN DU BLOC CORRIGÉ --- */



 label[for="subImageCamera"] {
    display: flex;
  }

  /* Règle temporaire pour forcer l'affichage de la galerie sur mobile */
  /* C'EST LE CODE QUE VOUS DEVIEZ AJOUTER */
  #existing-images-container {
    display: flex !important;
    flex-wrap: wrap !important;
    visibility: visible !important;
    min-height: 100px;
    width: 100%;
    background-color: #ffe4e6; /* Fond rose clair pour le repérer */
    border: 1px dashed red;
    padding: 10px;
    box-sizing: border-box;
  }

} 

  /* Règle temporaire pour forcer l'affichage de la galerie sur mobile */
  
  #existing-images-container {
    display: flex !important;
    flex-wrap: wrap !important;
    visibility: visible !important;
    min-height: 100px;
    width: 100%;
    background-color: #ffe4e6; /* Fond rose clair pour le repérer */
    border: 1px dashed red;
    padding: 10px;
    box-sizing: border-box;
  }
