@import url('https://fonts.googleapis.com/css2?family=Cinzel+Decorative:wght@400;700;900&family=Cinzel:wght@400;600;700&family=Lora:ital,wght@0,400;0,600;1,400&display=swap');

/* ============================================
   VARIABLES CSS - Modifiées par les thèmes
   ============================================ */
:root {
  /* Couleurs de base */
  --bg-primary: #0f0a07;
  --bg-secondary: #1a0f0a;
  --bg-tertiary: #2d1810;
  
  /* Couleurs des cartes */
  --card-bg-start: rgba(77, 40, 24, 0.9);
  --card-bg-end: rgba(58, 30, 18, 0.95);
  
  /* Accents */
  --accent-primary: #d4af37;
  --accent-primary-light: #f4d03f;
  --accent-primary-dark: #b8860b;
  --accent-secondary: #b87333;
  
  /* Couleurs de texte */
  --text-primary: #f4e8d0;
  --text-secondary: #d4c5a0;
  --text-muted: rgba(244, 232, 208, 0.7);
  
  /* Couleurs de statut */
  --color-success: #4caf50;
  --color-success-light: #66bb6a;
  --color-danger: #d62828;
  --color-danger-light: #ff6b35;
  
  /* Typographie */
  --font-display: 'Cinzel Decorative', serif;
  --font-heading: 'Cinzel', serif;
  --font-body: 'Lora', serif;
  
  /* Espacements */
  --spacing-card: 1.2rem;
  --spacing-section: 1.5rem;
  --border-radius-card: 12px;
  --border-radius-btn: 6px;
  
  /* Effets */
  --shadow-card: 0 10px 40px rgba(0, 0, 0, 0.6);
  --shadow-card-hover: 0 15px 50px rgba(0, 0, 0, 0.8);
  --shadow-btn: 0 4px 15px rgba(0, 0, 0, 0.4);
  --transition-speed: 0.3s;
  
  /* Opacités */
  --opacity-modal-bg: 0.85;
  --opacity-card-border: 0.1;
}

/* Ancienne compatibilité (peut être supprimé après migration complète) */
:root {
  --wood-dark: var(--bg-primary);
  --wood-medium: var(--bg-tertiary);
  --gold: var(--accent-primary);
  --gold-light: var(--accent-primary-light);
  --gold-dark: var(--accent-primary-dark);
  --copper: var(--accent-secondary);
  --parchment: var(--text-primary);
  --parchment-dark: var(--text-secondary);
  --fire-red: var(--color-danger);
  --fire-orange: var(--color-danger-light);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-body);
  background: linear-gradient(135deg, var(--wood-dark) 0%, var(--wood-medium) 50%, #120a06 100%);
  background-attachment: fixed;
  color: var(--parchment);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* Effet texture bois en arrière-plan */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 2px,
      rgba(0, 0, 0, 0.03) 2px,
      rgba(0, 0, 0, 0.03) 4px
    ),
    url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 0h100v100H0z' fill='%23000000' fill-opacity='0.02'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 1;
}

/* Effet de lumière de chandelle animée */
body::after {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(
    ellipse at 50% 50%,
    rgba(212, 175, 55, 0.03) 0%,
    transparent 50%
  );
  animation: candlelight 8s ease-in-out infinite;
  pointer-events: none;
  z-index: 1;
}

@keyframes candlelight {
  0%, 100% { opacity: 0.4; transform: scale(1) rotate(0deg); }
  25% { opacity: 0.6; transform: scale(1.1) rotate(2deg); }
  50% { opacity: 0.5; transform: scale(0.95) rotate(-1deg); }
  75% { opacity: 0.7; transform: scale(1.05) rotate(1deg); }
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1rem 0.8rem;
  position: relative;
  z-index: 2;
}

/* Titres avec style médiéval luxueux */
h1, h2, h3 {
  font-family: var(--font-display);
  color: var(--parchment);
  text-shadow: 
    0 0 10px rgba(212, 175, 55, 0.3),
    0 0 20px rgba(212, 175, 55, 0.15),
    2px 2px 4px rgba(0, 0, 0, 0.8);
  letter-spacing: 3px;
}

h1 {
  font-size: 1.6rem;
  text-align: center;
  margin-bottom: 1.5rem;
  position: relative;
  padding-bottom: 0.8rem;
}

h1::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  box-shadow: 0 0 10px var(--gold);
}

/* Logo container */
.logo-container {
  text-align: center;
  margin-bottom: 2rem;
  animation: float 3s ease-in-out infinite;
}

.logo-main {
  filter: drop-shadow(0 0 20px rgba(212, 175, 55, 0.5));
  max-width: 150px !important;
  width: 150px !important;
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
}

/* Header avec navigation */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 0.8rem;
}

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

/* Cartes avec effet parchemin luxueux */
.evenement-card, .admin-section, .item-card {
  background: linear-gradient(145deg, rgba(77, 40, 24, 0.9), rgba(58, 30, 18, 0.95));
  border: 3px solid var(--gold-dark);
  border-radius: 12px;
  padding: 1.2rem;
  margin-bottom: 1.5rem;
  position: relative;
  box-shadow: 
    0 10px 40px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(212, 175, 55, 0.1),
    0 0 0 1px rgba(212, 175, 55, 0.05);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.evenement-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 2px,
      rgba(212, 175, 55, 0.02) 2px,
      rgba(212, 175, 55, 0.02) 4px
    );
  border-radius: 15px;
  pointer-events: none;
}

.evenement-card:hover {
  transform: translateY(-8px) scale(1.02);
  border-color: var(--gold);
  box-shadow: 
    0 15px 50px rgba(0, 0, 0, 0.8),
    0 0 30px rgba(212, 175, 55, 0.3),
    inset 0 1px 0 rgba(212, 175, 55, 0.2);
}

/* Badge "Complet" avec style médaille */
.badge-complet {
  position: absolute;
  top: -15px;
  right: 20px;
  background: linear-gradient(135deg, #4caf50, #66bb6a) !important;
  color: white !important;
  padding: 8px 20px;
  border-radius: 25px;
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 2px;
  box-shadow: 
    0 4px 15px rgba(76, 175, 80, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  border: 2px solid rgba(255, 255, 255, 0.2);
  z-index: 10;
  animation: pulse 2s ease-in-out infinite;
}

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

/* Titres de carte avec décoration */
.card-title {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  color: var(--parchment);
  margin-bottom: 0.6rem;
  text-shadow: 
    0 0 10px rgba(212, 175, 55, 0.2),
    2px 2px 4px rgba(0, 0, 0, 0.8);
  position: relative;
  padding-bottom: 0.4rem;
}

.card-title::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 60px;
  height: 2px;
  background: var(--gold);
  box-shadow: 0 0 5px var(--gold);
}

/* Info organisateur avec style élégant */
.organisateur {
  font-size: 0.95rem;
  color: var(--copper);
  margin-bottom: 1.5rem;
  font-style: italic;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(184, 115, 51, 0.3);
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.organisateur::before {
  content: '🎭 ';
  margin-right: 5px;
}

/* Items d'information */
.info-item {
  margin: 0.8rem 0;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1rem;
  color: var(--parchment);
}

.info-item span {
  font-size: 1.2rem;
  filter: drop-shadow(0 0 3px rgba(212, 175, 55, 0.5));
}

/* Description avec fond parchemin */
.description-text {
  margin-top: 1.5rem;
  padding: 1.2rem;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  border-left: 4px solid var(--gold-dark);
  font-style: italic;
  line-height: 1.7;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* Lien vocal avec style bouton taverne */
.vocal-link {
  display: inline-block;
  margin-top: 1.5rem;
  padding: 10px 20px;
  background: linear-gradient(135deg, rgba(184, 115, 51, 0.2), rgba(212, 175, 55, 0.1));
  border: 2px solid var(--copper);
  border-radius: 8px;
  color: var(--gold-light);
  text-decoration: none;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  transition: all 0.3s ease;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.vocal-link:hover {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.3), rgba(184, 115, 51, 0.2));
  border-color: var(--gold);
  transform: translateY(-2px);
  box-shadow: 
    0 6px 15px rgba(0, 0, 0, 0.4),
    0 0 20px rgba(212, 175, 55, 0.2);
}

/* Box participants */
.participants-box {
  margin-top: 1.5rem;
  padding: 1.2rem;
  padding-top: 1.5rem;
  border-top: 2px solid rgba(212, 175, 55, 0.2);
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
}

.participants-box strong {
  color: var(--gold);
  font-family: var(--font-heading);
  font-size: 1.05rem;
}

/* Footer de carte */
.card-footer {
  margin-top: auto;
  padding-top: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.places-count {
  font-family: var(--font-heading);
  color: var(--parchment-dark);
  font-size: 0.95rem;
  text-shadow: 0 0 5px rgba(212, 175, 55, 0.2);
}

/* Boutons avec style taverne luxueux */
.btn {
  padding: 8px 16px;
  border: 2px solid var(--gold-dark);
  border-radius: 6px;
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.1), rgba(184, 134, 11, 0.15));
  color: var(--parchment-dark);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
  position: relative;
}

.btn:hover {
  transform: translateY(-3px);
  border-color: var(--gold);
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.25), rgba(184, 134, 11, 0.3));
  box-shadow: 
    0 8px 25px rgba(0, 0, 0, 0.5),
    0 0 30px rgba(212, 175, 55, 0.3);
  color: white;
}

.btn:active {
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.2), rgba(244, 208, 63, 0.15));
  border-color: var(--gold);
}

.btn-success {
  background: linear-gradient(135deg, rgba(76, 175, 80, 0.2), rgba(56, 142, 60, 0.15));
  border-color: #66bb6a;
  color: #a5d6a7;
}

.btn-success:hover {
  border-color: #81c784;
  color: white;
}

.btn-danger {
  background: linear-gradient(135deg, rgba(214, 40, 40, 0.2), rgba(255, 107, 53, 0.15));
  border-color: var(--fire-red);
  color: #ff8a80;
}

.btn-danger:hover {
  border-color: var(--fire-orange);
  color: white;
}

.btn-secondary {
  background: linear-gradient(135deg, rgba(120, 120, 120, 0.2), rgba(80, 80, 80, 0.15));
  border-color: #757575;
  color: #bdbdbd;
}

.btn-secondary:hover {
  border-color: #9e9e9e;
  color: white;
}

/* Formulaires avec style parchemin */
input, textarea, select {
  width: 100%;
  padding: 10px 14px;
  background: linear-gradient(135deg, rgba(77, 40, 24, 0.6), rgba(45, 24, 16, 0.7));
  border: 2px solid rgba(212, 175, 55, 0.3);
  border-radius: 6px;
  color: var(--parchment);
  font-family: var(--font-body);
  font-size: 0.95rem;
  margin-bottom: 1rem;
  transition: all 0.3s ease;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.4);
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--gold);
  background: linear-gradient(135deg, rgba(77, 40, 24, 0.8), rgba(45, 24, 16, 0.9));
  box-shadow: 
    inset 0 2px 8px rgba(0, 0, 0, 0.5),
    0 0 15px rgba(212, 175, 55, 0.3);
}

input::placeholder, textarea::placeholder {
  color: rgba(244, 232, 208, 0.5);
  font-style: italic;
}

label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--parchment-dark);
  font-family: var(--font-heading);
  font-size: 0.9rem;
  text-shadow: 0 0 3px rgba(212, 175, 55, 0.15);
}

/* Options du select avec texte noir pour lisibilité */
select option {
  color: #000000;
  background: #ffffff;
  font-weight: normal;
}

select option:checked {
  background: var(--gold);
  color: #000000;
}


/* Filtres */
.filters {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  margin-bottom: 3rem;
  flex-wrap: wrap;
}

.filters input, .filters select, .filters button {
  max-width: 280px;
  margin-bottom: 0;
}

/* Grilles */
.evenements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 2.5rem;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 2rem;
}

/* Tables planning */
.table-wrapper {
  overflow-x: auto;
  margin-top: 2rem;
  border-radius: 15px;
  border: 3px solid var(--gold-dark);
  background: rgba(26, 15, 10, 0.8);
  box-shadow: 
    0 10px 40px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(212, 175, 55, 0.1);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1100px;
}

th, td {
  border: 1px solid rgba(212, 175, 55, 0.2);
  padding: 12px;
  text-align: center;
}

th {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.15), rgba(184, 134, 11, 0.1));
  color: var(--parchment);
  font-family: var(--font-heading);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-bottom: 2px solid var(--gold-dark);
  text-shadow: 0 0 8px rgba(212, 175, 55, 0.2);
}

.slot {
  cursor: pointer;
  height: 110px;
  vertical-align: top;
  background: rgba(45, 24, 16, 0.4);
  transition: all 0.3s ease;
  position: relative;
}

.slot:hover {
  background: rgba(212, 175, 55, 0.15);
  box-shadow: inset 0 0 20px rgba(212, 175, 55, 0.1);
}

.periode-col {
  font-weight: bold;
  background: linear-gradient(135deg, rgba(184, 115, 51, 0.2), rgba(212, 175, 55, 0.1));
  color: var(--parchment);
  font-family: var(--font-heading);
  width: 100px;
  border-right: 2px solid var(--gold-dark);
}

.name-tag {
  display: inline-block;
  padding: 3px 8px;
  margin: 2px;
  border-radius: 12px;
  font-size: 0.65rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--wood-dark);
  box-shadow: 
    0 2px 6px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  border: 1px solid rgba(0, 0, 0, 0.2);
  font-family: var(--font-heading);
  transition: all 0.2s ease;
}

.name-tag:hover {
  transform: scale(1.05);
  box-shadow: 
    0 3px 10px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

/* Modal avec effet vitrail */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
}

.modal-content {
  position: relative;
  margin: 5vh auto;
  padding: 2rem;
  width: 90%;
  max-width: 650px;
  background: linear-gradient(145deg, rgba(77, 40, 24, 0.95), rgba(58, 30, 18, 0.98));
  border: 4px solid var(--gold);
  border-radius: 15px;
  box-shadow: 
    0 20px 60px rgba(0, 0, 0, 0.8),
    inset 0 1px 0 rgba(212, 175, 55, 0.2),
    0 0 40px rgba(212, 175, 55, 0.2);
}

.close-btn {
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: 2rem;
  color: var(--gold);
  cursor: pointer;
  transition: all 0.3s ease;
  text-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
  line-height: 1;
}

.close-btn:hover {
  color: var(--gold-light);
  transform: rotate(90deg) scale(1.2);
  text-shadow: 0 0 20px rgba(244, 208, 63, 0.8);
}

/* Admin sections */
.admin-section {
  background: linear-gradient(145deg, rgba(77, 40, 24, 0.8), rgba(58, 30, 18, 0.85));
  border: 2px solid var(--gold-dark);
  padding: 2rem;
  margin-bottom: 2.5rem;
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

.admin-section h3 {
  font-size: 1.2rem;
  margin-bottom: 1rem;
  color: var(--parchment);
}

.item-card {
  background: rgba(0, 0, 0, 0.4);
  border: 2px solid rgba(212, 175, 55, 0.3);
  padding: 1.5rem;
  border-radius: 10px;
  transition: all 0.3s ease;
}

.item-card:hover {
  border-color: var(--gold);
  background: rgba(0, 0, 0, 0.5);
  box-shadow: 0 5px 20px rgba(212, 175, 55, 0.2);
}

.item-card h4 {
  color: var(--parchment);
  margin-bottom: 0.8rem;
  font-family: var(--font-heading);
  font-size: 1.1rem;
}

.btn-group {
  display: flex;
  gap: 10px;
  margin-top: 1rem;
  flex-wrap: wrap;
}

/* Éditeur modal */
.edit-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(10px);
  z-index: 2000;
  overflow-y: auto;
  padding: 2rem 0;
}

.edit-content {
  background: linear-gradient(145deg, rgba(77, 40, 24, 0.98), rgba(58, 30, 18, 0.98));
  border: 4px solid var(--gold);
  max-width: 650px;
  margin: 30px auto;
  padding: 2rem;
  border-radius: 15px;
  box-shadow: 
    0 20px 60px rgba(0, 0, 0, 0.9),
    0 0 40px rgba(212, 175, 55, 0.3);
}

.edit-content h3 {
  color: var(--parchment);
  margin-bottom: 1.5rem;
  font-size: 1.4rem;
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    padding: 1.5rem 1rem;
  }
  
  h1 {
    font-size: 2rem;
    letter-spacing: 2px;
  }
  
  .header {
    flex-direction: column;
    text-align: center;
  }
  
  .evenements-grid, .admin-grid {
    grid-template-columns: 1fr;
  }
  
  .filters {
    flex-direction: column;
  }
  
  .filters input, .filters select, .filters button {
    max-width: 100%;
  }
  
  .btn {
    padding: 12px 24px;
    font-size: 0.85rem;
  }
  
  .table-wrapper {
    border-radius: 10px;
  }
  
  th, td {
    padding: 8px;
    font-size: 0.85rem;
  }
  
  .modal-content, .edit-content {
    width: 95%;
    padding: 2rem 1.5rem;
    margin: 2rem auto;
  }
}

/* Scrollbar personnalisée */
::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: rgba(26, 15, 10, 0.8);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, var(--gold-dark), var(--copper));
  border-radius: 10px;
  border: 2px solid rgba(26, 15, 10, 0.8);
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
}

/* Animations d'entrée */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Animations d'entrée - désactivées pour éviter le saut lors du rafraîchissement */
/* .evenement-card, .admin-section, .item-card {
  animation: fadeInUp 0.6s ease-out;
} */

/* Effet de lueur sur les éléments interactifs */
.btn, .vocal-link, input:focus, select:focus, textarea:focus {
  position: relative;
}

/* Sélection de texte personnalisée */
::selection {
  background: rgba(212, 175, 55, 0.3);
  color: var(--parchment);
}

::-moz-selection {
  background: rgba(212, 175, 55, 0.3);
  color: var(--parchment);
}
