/* File: /css/components/flyouts.css */
/* b24 Interface Evolution - Système Flyouts Parent/Enfant SIMPLIFIÉ */

/* 🎯 FLYOUT WRAPPER - CONTENEUR PARENT OBLIGATOIRE
   z-index élevé (plus haut que .search-container 1200) pour que le dropdown
   passe par-dessus la search bar quand le header wrap au breakpoint ≤1024px */
.flyout-wrapper {
  position: relative;
  display: inline-block;
  flex-shrink: 0;
  z-index: 1300;
}

.flyout-wrapper .flyout-trigger {
  /* Hérite des styles existants */
}

/* 🎯 FLYOUT TRIGGERS - Éléments déclencheurs */
.flyout-trigger {
  cursor: pointer;
  transition: all 0.2s ease;
}

.flyout-trigger.language-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  border: 1px solid transparent;
  border-radius: 2px;
  flex-shrink: 0;
}

.flyout-trigger.language-selector:hover {
  border-color: var(--text-white);
}

.flyout-trigger.account-section {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  border: 1px solid transparent;
  border-radius: 2px;
  flex-shrink: 0;
}

.flyout-trigger.account-section:hover {
  border-color: var(--text-white);
}

.flyout-trigger.orders-section {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  border: 1px solid transparent;
  border-radius: 2px;
  flex-shrink: 0;
}

.flyout-trigger.orders-section:hover {
  border-color: var(--text-white);
}

.flyout-trigger.delivery-location {
  display: flex;
  align-items: center;
  color: var(--text-light);
  font-size: 12px;
  padding: 4px 6px;
  border: 1px solid transparent;
  border-radius: 2px;
  cursor: pointer;
  transition: border-color 0.2s;
  flex-shrink: 0;
  min-width: 100px;
}

.flyout-trigger.delivery-location:hover {
  border-color: var(--text-white);
}

/* 🎯 Enfants des triggers : icône + texte */
.flyout-trigger-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  line-height: 1;
}

.flyout-trigger-text {
  font-size: 13px;
  font-weight: bold;
  line-height: 1;
}

/* 🎨 Mode original — surcharge de padding/spacing pour le header desktop */
.header-original-mode .header-right {
  display: flex;
  align-items: center;
  gap: 15px;
}

.header-original-mode .flyout-trigger {
  padding: 8px 12px;
  color: white;
  text-decoration: none;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.header-original-mode .flyout-trigger:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.header-original-mode .flyout-trigger-text {
  font-size: 14px;
  white-space: nowrap;
}

/* 📱 Responsive ≤1024px — espacement compact des triggers */
@media (max-width: 1024px) {
  .flyout-trigger.language-selector,
  .flyout-trigger.account-section,
  .flyout-trigger.orders-section {
    min-width: 30px !important;
    padding: 4px !important;
  }
}

/* 🚀 FLYOUT CONTAINERS */
.flyout-container {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--flyout-bg);
  border: 1px solid var(--flyout-border);
  border-radius: 8px;
  box-shadow: 0 8px 24px var(--flyout-shadow);
  min-width: 280px;
  max-width: 350px;
  z-index: 1500;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: opacity 0.15s ease, visibility 0.15s ease, transform 0.15s ease;
  pointer-events: none;
  box-sizing: border-box;
}

.flyout-container.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.flyout-container[data-flyout-id="language"] {
  min-width: 350px;
  max-width: 400px;
}

.flyout-container[data-flyout-id="account"] {
  min-width: 300px;
  max-width: 350px;
}

.flyout-container[data-flyout-id="orders"] {
  min-width: 320px;
  max-width: 380px;
}

.flyout-container[data-flyout-id="delivery"] {
  min-width: 300px;
  max-width: 400px;
  right: auto;
  left: 0;
}

/* 🎨 FLYOUT CONTENT */
.flyout-panel {
  display: block;
}

.flyout-header {
  background: var(--flyout-header-bg);
  padding: 15px 20px;
  border-bottom: 1px solid var(--border-light);
  border-radius: 8px 8px 0 0;
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  padding-right: 50px;
}

.flyout-icon {
  font-size: 16px;
}

.flyout-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.flyout-close {
  position: absolute;
  top: 15px;
  right: 15px;
  background: none;
  border: none;
  font-size: 24px;
  font-weight: bold;
  color: #666;
  cursor: pointer;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.flyout-close:hover {
  background: rgba(0, 0, 0, 0.1);
  color: #333;
  transform: scale(1.1);
}

.flyout-content {
  padding: 10px 0;
  max-height: 400px;
  overflow-y: auto;
}

.flyout-content::-webkit-scrollbar {
  width: 4px;
}

.flyout-content::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 2px;
}

.flyout-content::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 2px;
}

.flyout-content::-webkit-scrollbar-thumb:hover {
  background: #a1a1a1;
}

/* 📋 SECTIONS */
.flyout-section {
  border-bottom: 1px solid var(--border-light);
  padding: 15px 0;
  margin: 10px;
  margin-bottom: 25px;
}

.flyout-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0 20px 10px;
  margin-bottom: 5px;
  border-bottom: 1px solid #eee;
  padding-bottom: 5px;
}

.section-items {
  display: flex;
  flex-direction: column;
}

/* 🎯 OPTIONS */
.flyout-option {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
  text-decoration: none;
  color: var(--text-primary);
}

.flyout-option:hover {
  background: var(--flyout-item-hover);
  color: var(--text-primary);
  text-decoration: none;
}

.flyout-option.active {
  background: var(--flyout-active-bg);
  border-left-color: var(--flyout-active-border);
}

.flyout-option.current-address {
  background: #f0f8f0;
  border-left: 3px solid #28a745;
}

.option-icon {
  font-size: 14px;
  margin-right: 12px;
  width: 16px;
  text-align: center;
  flex-shrink: 0;
}

.option-text {
  flex: 1;
  font-size: 14px;
  font-weight: 400;
}

.address-name {
  font-weight: 600;
  font-size: 15px;
  color: #333;
  margin-bottom: 2px;
}

.address-location {
  font-size: 13px;
  color: #666;
}

/* Grid langues */
.languages-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.language-item {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.2s;
  color: black;
}

.language-item:hover {
  background: #f8f9fa;
  border-color: #007bff;
}

.language-item.active {
  background: #007bff;
  color: white;
  border-color: #007bff;
}

.flag-emoji {
  margin-right: 8px;
  width: 18px;
  height: auto;
}

.language-code {
  font-size: 15px;
  font-weight: 500;
}

/* Devise */
.currency-select {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-size: 15px;
  background: #007bff;
}

.currency-select:focus {
  outline: none;
  border-color: #007bff;
}

/* Continents */
.continents-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.continent-item {
  margin-bottom: 15px;
}

.continent-header {
  font-weight: bold;
  color: #007bff;
  margin-bottom: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
}

.continent-header:hover {
  color: #0056b3;
}

.continent-toggle {
  margin-right: 8px;
  font-size: 12px;
}

.countries-list {
  padding-left: 20px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 5px;
}

.country-link {
  color: #666;
  text-decoration: none;
  padding: 5px 8px;
  border-radius: 3px;
  font-size: 14px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
}

.country-link:hover {
  background: #f8f9fa;
  color: #007bff;
}

.country-link.active {
  background: #007bff;
  color: white;
  font-weight: bold;
}

.flag-small {
  width: 16px;
  height: auto;
  margin-right: 6px;
}

/* 🚀 ACTIONS */
.flyout-actions {
  border-top: 1px solid #eee;
  padding: 15px 20px;
  display: flex;
  gap: 10px;
}

.action-button {
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  border: 1px solid;
  cursor: pointer;
  background: none;
}

.action-button.primary,
.btn-primary {
  background: #007bff;
  color: white;
  border-color: #007bff;
}

.action-button.primary:hover,
.btn-primary:hover {
  background: #0056b3;
  border-color: #0056b3;
  color: white;
  text-decoration: none;
}

.action-button.secondary,
.btn-secondary {
  background: white;
  color: #666;
  border-color: #ddd;
}

.action-button.secondary:hover,
.btn-secondary:hover {
  background: #f8f9fa;
  color: #333;
  text-decoration: none;
}

.flyout-footer {
  border-top: 1px solid var(--border-light);
  padding: 15px 20px;
  background: var(--bg-lightest);
  border-radius: 0 0 8px 8px;
}

/* 📱 RESPONSIVE */
@media (max-width: 768px) {
  .flyout-container {
    min-width: 250px;
    max-width: calc(100vw - 20px);
  }

  .flyout-header {
    padding: 12px 15px;
  }

  .flyout-content {
    max-height: 50vh;
  }

  .flyout-option {
    padding: 14px 15px;
  }

  .flyout-close {
    width: 40px;
    height: 40px;
    top: 8px;
    right: 8px;
  }
}

@media (max-width: 480px) {
  .flyout-container {
    min-width: calc(100vw - 40px);
    max-width: calc(100vw - 40px);
  }
}

.signin-message {
color: #000;
}