/*
========================================
RESPONSIVE CSS ISOLÉ - LA PAGE GOURMANDE
========================================
Utilise le préfixe .pg- (Page Gourmande) pour éviter les conflits
*/

/* ==========================================
   VARIABLES CSS GLOBALES (Scoped)
========================================== */
.pg-app {
  /* Breakpoints */
  --pg-mobile-small: 320px;
  --pg-mobile: 480px;
  --pg-tablet-small: 576px;
  --pg-tablet: 768px;
  --pg-desktop-small: 992px;
  --pg-desktop: 1200px;
  --pg-desktop-large: 1440px;
  --pg-desktop-xl: 1920px;

  /* Espacements responsive */
  --pg-spacing-xs: 0.5rem;
  --pg-spacing-sm: 1rem;
  --pg-spacing-md: 1.5rem;
  --pg-spacing-lg: 2rem;
  --pg-spacing-xl: 3rem;
  --pg-spacing-xxl: 4rem;

  /* Tailles de police responsive */
  --pg-font-xs: 0.75rem;
  --pg-font-sm: 0.875rem;
  --pg-font-base: 1rem;
  --pg-font-lg: 1.125rem;
  --pg-font-xl: 1.25rem;
  --pg-font-2xl: 1.5rem;
  --pg-font-3xl: 1.875rem;
  --pg-font-4xl: 2.25rem;
  --pg-font-5xl: 3rem;

  /* Container widths */
  --pg-container-sm: 100%;
  --pg-container-md: 720px;
  --pg-container-lg: 960px;
  --pg-container-xl: 1140px;
  --pg-container-xxl: 1320px;
}

/* ==========================================
   RESET ET BASE RESPONSIVE (Scoped)
========================================== */
.pg-app * {
  box-sizing: border-box;
}

.pg-app {
  font-family: 'Poppins', Arial, sans-serif;
  line-height: 1.6;
  overflow-x: hidden;
  font-size: 14px; /* Base mobile */
}

.pg-app img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ==========================================
   SYSTÈME DE GRILLE RESPONSIVE
========================================== */
.pg-container {
  width: 100%;
  padding-left: var(--pg-spacing-sm);
  padding-right: var(--pg-spacing-sm);
  margin-left: auto;
  margin-right: auto;
}

.pg-row {
  display: flex;
  flex-wrap: wrap;
  margin-left: calc(var(--pg-spacing-sm) * -1);
  margin-right: calc(var(--pg-spacing-sm) * -1);
}

.pg-col {
  flex: 1;
  padding-left: var(--pg-spacing-sm);
  padding-right: var(--pg-spacing-sm);
}

/* Colonnes responsive */
.pg-col-12 { width: 100%; }
.pg-col-11 { width: 91.666667%; }
.pg-col-10 { width: 83.333333%; }
.pg-col-9 { width: 75%; }
.pg-col-8 { width: 66.666667%; }
.pg-col-7 { width: 58.333333%; }
.pg-col-6 { width: 50%; }
.pg-col-5 { width: 41.666667%; }
.pg-col-4 { width: 33.333333%; }
.pg-col-3 { width: 25%; }
.pg-col-2 { width: 16.666667%; }
.pg-col-1 { width: 8.333333%; }

/* ==========================================
   HEADER / NAVIGATION RESPONSIVE
========================================== */
.pg-header {
  padding: var(--pg-spacing-sm);
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
}

.pg-nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  max-width: var(--pg-container-sm);
  margin: 0 auto;
}

.pg-logo {
  height: 40px;
  width: auto;
}

.pg-main-nav {
  display: none; /* Caché sur mobile */
  flex-direction: column;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  border-radius: 0 0 1rem 1rem;
}

.pg-main-nav.pg-active {
  display: flex;
}

.pg-main-nav a {
  padding: var(--pg-spacing-md);
  text-decoration: none;
  color: #333;
  border-bottom: 1px solid #eee;
  font-size: var(--pg-font-base);
  transition: all 0.3s ease;
  position: relative;
  font-weight: 500;
  display: inline-block;
}

.pg-main-nav a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 5px;
  width: 0;
  height: 2px;
  background: rgba(126, 11, 58, 0.9);
  transition: width 0.3s ease;
  border-radius: 1px;
}

.pg-main-nav a:hover::after,
.pg-main-nav a.pg-active::after {
  width: 100%;
}

.pg-main-nav a:hover,
.pg-main-nav a.pg-active {
  border-radius: 9999px;
  color: rgba(126, 11, 58, 0.9);
  font-weight: 700;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  font-size: 1.05em;
}

.pg-main-nav a:active {
  transform: scale(0.97);
  background: rgba(126, 11, 58, 0.9);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.pg-menu-icon {
  display: block;
  font-size: var(--pg-font-2xl);
  color: #7e0b3a;
  cursor: pointer;
  z-index: 1001;
}

.pg-navigation {
  display: none;
}

/* ==========================================
   SECTIONS PRINCIPALES RESPONSIVE
========================================== */
.pg-section {
  padding: var(--pg-spacing-xl) var(--pg-spacing-sm);
}

.pg-section-title {
  font-size: var(--pg-font-3xl);
  text-align: center;
  margin-bottom: var(--pg-spacing-xl);
  color: #7e0b3a;
}

/* ==========================================
   HERO SECTION RESPONSIVE
========================================== */
.pg-hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--pg-spacing-xxl) var(--pg-spacing-sm);
  background-size: cover;
  background-position: center;
  position: relative;
}

.pg-hero-content h1 {
  font-size: var(--pg-font-4xl);
  margin-bottom: var(--pg-spacing-lg);
  line-height: 1.2;
}

.pg-hero-content p {
  font-size: var(--pg-font-lg);
  margin-bottom: var(--pg-spacing-xl);
  max-width: 90%;
  margin-left: auto;
  margin-right: auto;
}

.pg-hero-buttons {
  display: flex;
  flex-direction: column;
  gap: var(--pg-spacing-md);
  align-items: center;
}

/* ==========================================
   BOUTONS RESPONSIVE
========================================== */
.pg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--pg-spacing-md) var(--pg-spacing-lg);
  border: none;
  border-radius: 0.5rem;
  font-size: var(--pg-font-base);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.3s ease;
  min-height: 48px;
  width: 100%;
  max-width: 280px;
}

.pg-btn-primary {
  background: #7e0b3a;
  color: white;
}

.pg-btn-primary:hover {
  background: #a01449;
  transform: translateY(-2px);
}

.pg-btn-secondary {
  background: transparent;
  color: #7e0b3a;
  border: 2px solid #7e0b3a;
}

.pg-btn-secondary:hover {
  background: #7e0b3a;
  color: white;
}

/* ==========================================
   MENU / PLATS RESPONSIVE
========================================== */
.pg-menu-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--pg-spacing-lg);
  max-width: 100%;
}

.pg-menu-item,
.pg-plat-card {
  background: white;
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  transition: transform 0.3s ease;
}

.pg-menu-item:hover,
.pg-plat-card:hover {
  transform: translateY(-5px);
}

.pg-menu-content,
.pg-plat-info {
  padding: var(--pg-spacing-lg);
}

.pg-menu-header {
  display: flex;
  flex-direction: column;
  gap: var(--pg-spacing-md);
  margin-bottom: var(--pg-spacing-md);
}

.pg-plat-nom,
.pg-menu-content h3 {
  font-size: var(--pg-font-xl);
  color: #7e0b3a;
  margin-bottom: var(--pg-spacing-sm);
}

.pg-plat-prix-container,
.pg-menu-prices {
  display: flex;
  flex-direction: column;
  gap: var(--pg-spacing-sm);
}

.pg-plat-prix,
.pg-menu-price {
  padding: var(--pg-spacing-sm) var(--pg-spacing-md);
  border-radius: 1rem;
  font-size: var(--pg-font-sm);
  font-weight: 600;
  text-align: center;
  background: linear-gradient(135deg, #7e0b3a, #a01449);
  color: white;
}

.pg-plat-prix-emporter,
.pg-menu-price-emporter {
  background: linear-gradient(135deg, #2c5530, #3e7b3e);
  font-size: var(--pg-font-xs);
}

/* ==========================================
   PANIER RESPONSIVE
========================================== */
.pg-panier-section {
  position: sticky;
  top: 80px;
  background: white;
  border-radius: 1rem;
  padding: var(--pg-spacing-lg);
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  margin-top: var(--pg-spacing-lg);
}

.pg-panier-item {
  padding: var(--pg-spacing-md);
  border-bottom: 1px solid #eee;
  margin-bottom: var(--pg-spacing-md);
}

.pg-panier-item-header {
  display: flex;
  flex-direction: column;
  gap: var(--pg-spacing-sm);
  margin-bottom: var(--pg-spacing-sm);
}

.pg-quantite-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--pg-spacing-sm);
  margin: var(--pg-spacing-sm) 0;
}

.pg-quantite-control button {
  width: 40px;
  height: 40px;
  border: 2px solid #7e0b3a;
  background: white;
  color: #7e0b3a;
  border-radius: 50%;
  font-size: var(--pg-font-lg);
  font-weight: bold;
  cursor: pointer;
}

/* ==========================================
   COMMANDE RESPONSIVE
========================================== */
.pg-commande-container {
  display: flex;
  flex-direction: column;
  gap: var(--pg-spacing-xl);
  padding: var(--pg-spacing-lg) var(--pg-spacing-sm);
  margin-top: 80px;
}

.pg-menu-section {
  order: 1;
}

.pg-panier-section {
  order: 2;
  position: static;
}

.pg-form-row {
  display: flex;
  flex-direction: column;
  gap: var(--pg-spacing-md);
  margin-bottom: var(--pg-spacing-md);
}

.pg-form-group {
  display: flex;
  flex-direction: column;
  gap: var(--pg-spacing-sm);
}

.pg-form-group label {
  font-weight: 600;
  color: #333;
  font-size: var(--pg-font-sm);
}

.pg-form-group input,
.pg-form-group select,
.pg-form-group textarea {
  padding: var(--pg-spacing-md);
  border: 2px solid #ddd;
  border-radius: 0.5rem;
  font-size: var(--pg-font-base);
  transition: border-color 0.3s ease;
  min-height: 48px;
}

.pg-form-group input:focus,
.pg-form-group select:focus,
.pg-form-group textarea:focus {
  border-color: #7e0b3a;
  outline: none;
}

/* ==========================================
   MODAL RESPONSIVE
========================================== */
.pg-modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.5);
  padding: var(--pg-spacing-sm);
}

.pg-modal-content {
  background-color: white;
  margin: auto;
  padding: var(--pg-spacing-xl);
  border-radius: 1rem;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  top: 50%;
  transform: translateY(-50%);
}

.pg-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--pg-spacing-lg);
  flex-wrap: wrap;
}

.pg-modal-header h3 {
  color: #7e0b3a;
  font-size: var(--pg-font-xl);
  margin: 0;
}

.pg-close {
  font-size: var(--pg-font-3xl);
  font-weight: bold;
  cursor: pointer;
  color: #999;
  min-height: 44px;
  min-width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pg-prix-selector {
  display: flex;
  flex-direction: column;
  gap: var(--pg-spacing-md);
}

.pg-prix-option {
  position: relative;
}

.pg-prix-option label {
  display: block;
  padding: var(--pg-spacing-md);
  border: 2px solid #ddd;
  border-radius: 0.5rem;
  cursor: pointer;
  text-align: center;
  transition: all 0.3s ease;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ==========================================
   DASHBOARD RESPONSIVE
========================================== */
.pg-dashboard-header {
  display: flex;
  flex-direction: column;
  gap: var(--pg-spacing-md);
  padding: var(--pg-spacing-lg) var(--pg-spacing-sm);
  background: #c36b90;
  color: white;
}

.pg-dashboard-header h1 {
  font-size: var(--pg-font-2xl);
  text-align: center;
}

.pg-header-actions {
  display: flex;
  flex-direction: column;
  gap: var(--pg-spacing-sm);
}

.pg-header-actions a {
  padding: var(--pg-spacing-sm) var(--pg-spacing-md);
  background: rgba(255,255,255,0.1);
  color: white;
  text-decoration: none;
  border-radius: 0.5rem;
  text-align: center;
  font-size: var(--pg-font-sm);
}

.pg-stats-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: var(--pg-spacing-sm);
  margin-bottom: var(--pg-spacing-lg);
}

.pg-stat-card {
  background: white;
  padding: var(--pg-spacing-md);
  border-radius: 0.5rem;
  text-align: center;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.pg-menu-editor {
  background: white;
  border-radius: 1rem;
  padding: var(--pg-spacing-lg);
  margin-bottom: var(--pg-spacing-lg);
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

/* ==========================================
   FOOTER RESPONSIVE
========================================== */
.pg-footer {
  background: #333;
  color: white;
  padding: var(--pg-spacing-xl) var(--pg-spacing-sm);
  text-align: center;
}

.pg-social-media {
  margin-bottom: var(--pg-spacing-lg);
}

.pg-social-media h2 {
  font-size: var(--pg-font-xl);
  margin-bottom: var(--pg-spacing-md);
}

.pg-social-media a {
  display: inline-block;
  margin: 0 var(--pg-spacing-sm);
  font-size: var(--pg-font-2xl);
  color: white;
  text-decoration: none;
  transition: color 0.3s ease;
}

.pg-footer-text {
  display: flex;
  flex-direction: column;
  gap: var(--pg-spacing-sm);
  font-size: var(--pg-font-sm);
}

/* ==========================================
   UTILITAIRES RESPONSIVE
========================================== */
.pg-text-center { text-align: center; }
.pg-text-left { text-align: left; }
.pg-text-right { text-align: right; }

.pg-d-block { display: block; }
.pg-d-inline { display: inline; }
.pg-d-inline-block { display: inline-block; }
.pg-d-flex { display: flex; }
.pg-d-none { display: none; }

.pg-justify-center { justify-content: center; }
.pg-justify-between { justify-content: space-between; }
.pg-justify-around { justify-content: space-around; }

.pg-align-center { align-items: center; }
.pg-align-start { align-items: flex-start; }
.pg-align-end { align-items: flex-end; }

.pg-flex-column { flex-direction: column; }
.pg-flex-wrap { flex-wrap: wrap; }

.pg-w-100 { width: 100%; }
.pg-h-100 { height: 100%; }

.pg-m-0 { margin: 0; }
.pg-p-0 { padding: 0; }
.pg-mb-1 { margin-bottom: var(--pg-spacing-sm); }
.pg-mb-2 { margin-bottom: var(--pg-spacing-md); }
.pg-mb-3 { margin-bottom: var(--pg-spacing-lg); }

/* ==========================================
   ANIMATIONS RESPONSIVE
========================================== */
@keyframes pg-fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.pg-fade-in-up {
  animation: pg-fadeInUp 0.6s ease-out;
}

/* ==========================================
   BREAKPOINTS RESPONSIVE
========================================== */

/* Mobile Small (320px+) */
@media (min-width: 320px) {
  .pg-container {
    max-width: var(--pg-container-sm);
  }
  
  .pg-app {
    font-size: 14px;
  }
  
  .pg-hero-content h1 {
    font-size: 2rem;
  }
}

/* Mobile (480px+) */
@media (min-width: 480px) {
  .pg-app {
    font-size: 15px;
  }
  
  .pg-container {
    padding-left: var(--pg-spacing-md);
    padding-right: var(--pg-spacing-md);
  }
  
  .pg-hero-buttons {
    flex-direction: row;
    justify-content: center;
    flex-wrap: wrap;
  }
  
  .pg-btn {
    width: auto;
    min-width: 160px;
  }
  
  .pg-form-row {
    flex-direction: row;
  }
  
  .pg-form-group {
    flex: 1;
  }
  
  .pg-prix-selector {
    flex-direction: row;
  }
}

/* Tablet Small (576px+) */
@media (min-width: 576px) {
  .pg-container {
    max-width: var(--pg-container-md);
  }
  
  .pg-menu-list {
    grid-template-columns: 1fr;
    gap: var(--pg-spacing-xl);
  }
  
  .pg-menu-item {
    display: flex;
    min-height: 200px;
  }
  
  .pg-menu-item:nth-child(even) {
    flex-direction: row-reverse;
  }
  
  .pg-menu-item img {
    width: 35%;
    height: 200px;
    object-fit: cover;
  }
  
  .pg-menu-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }
  
  .pg-menu-header {
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
  }
  
  .pg-plat-prix-container,
  .pg-menu-prices {
    align-items: flex-end;
  }
}

/* Tablet (768px+) */
@media (min-width: 768px) {
  .pg-app {
    font-size: 16px;
  }
  
  .pg-container {
    max-width: var(--pg-container-lg);
  }
  
  /* Navigation Desktop */
  .pg-menu-icon {
    display: none;
  }
  
  .pg-main-nav {
    display: flex !important;
    position: static;
    flex-direction: row;
    background: transparent;
    box-shadow: none;
    border-radius: 0;
  }
  
  .pg-main-nav a {
    border-bottom: none;
    padding: var(--pg-spacing-sm) var(--pg-spacing-md);
  }
  
  .pg-navigation {
    display: flex;
    gap: var(--pg-spacing-md);
  }
  
  .pg-logo {
    height: 50px;
  }
  
  /* Layout à deux colonnes pour commande */
  .pg-commande-container {
    flex-direction: row;
    align-items: flex-start;
  }
  
  .pg-menu-section {
    flex: 2;
    order: 1;
  }
  
  .pg-panier-section {
    flex: 1;
    order: 2;
    position: sticky;
    top: 100px;
    margin-left: var(--pg-spacing-xl);
  }
  
  .pg-dashboard-header {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
  
  .pg-header-actions {
    flex-direction: row;
  }
  
  .pg-stats-bar {
    grid-template-columns: repeat(5, 1fr);
  }
  
  .pg-footer-text {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
}

/* Desktop Small (992px+) */
@media (min-width: 992px) {
  .pg-container {
    max-width: var(--pg-container-xl);
  }
  
  .pg-hero-content h1 {
    font-size: var(--pg-font-5xl);
  }
  
  .pg-modal-content {
    max-width: 600px;
  }
  
  .pg-panier-item-header {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
  
  .pg-quantite-control {
    justify-content: center;
    gap: var(--pg-spacing-md);
  }
}

/* Desktop (1200px+) */
@media (min-width: 1200px) {
  .pg-container {
    max-width: var(--pg-container-xxl);
  }
  
  .pg-menu-list {
    gap: var(--pg-spacing-xxl);
  }
  
  .pg-section {
    padding: var(--pg-spacing-xxl) var(--pg-spacing-sm);
  }
  
  .pg-commande-container {
    gap: var(--pg-spacing-xxl);
  }
}

/* Desktop Large (1440px+) */
@media (min-width: 1440px) {
  .pg-app {
    font-size: 18px;
  }
  
  .pg-container {
    padding-left: var(--pg-spacing-xl);
    padding-right: var(--pg-spacing-xl);
  }
  
  .pg-logo {
    height: 60px;
  }
}

/* Desktop XL (1920px+) */
@media (min-width: 1920px) {
  .pg-app {
    font-size: 20px;
  }
  
  .pg-container {
    max-width: 1600px;
  }
}

/* ==========================================
   RESPONSIVE POUR IMPRESSION
========================================== */
@media print {
  .pg-header,
  .pg-footer,
  .pg-btn,
  .pg-modal,
  .pg-menu-icon,
  .pg-action-buttons {
    display: none !important;
  }
  
  .pg-container {
    max-width: 100%;
    padding: 0;
  }
  
  .pg-confirmation-container {
    margin: 0;
  }
  
  .pg-app {
    font-size: 12pt;
  }
  
  .pg-confirmation-card {
    box-shadow: none;
    border: 1px solid #ddd;
  }
}

/* ==========================================
   RESPONSIVE POUR ACCESSIBILITÉ
========================================== */
@media (prefers-reduced-motion: reduce) {
  .pg-app * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (prefers-color-scheme: dark) {
  .pg-modal-content {
    background-color: #2d2d2d;
    color: white;
  }
  
  .pg-form-group input,
  .pg-form-group select,
  .pg-form-group textarea {
    background-color: #3d3d3d;
    color: white;
    border-color: #555;
  }
}