/* lecart.css - Styles de base pour LeCart */

/* Variables CSS globales - Thème clair (défaut) */
:root {
    --lecart-primary-color: #4a4a4a;
    --lecart-secondary-color: #ffffff;
    --lecart-accent-color: #1651cf;
    --lecart-text-color: #0d0c22;
    --lecart-border-color: #f2f2f2;
    --lecart-success-color: #4CAF50;
    --lecart-error-color: #F44336;
    --lecart-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  }
  
  /* Variables du thème sombre */
  .lecart-theme-dark {
    --lecart-primary-color: #2d2d2d;
    --lecart-secondary-color: #3a3a3a;
    --lecart-accent-color: #4dabf7;
    --lecart-text-color: #f5f5f5;
    --lecart-border-color: #4d4d4d;
    --lecart-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  }
  
  /* Conteneur principal */
  .lecart-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  }
  
  /* Fond semi-transparent */
  .lecart-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
  }
  
  /* Panneau du panier */
  .lecart-panel {
    position: fixed;
    top: 0;
    width: 350px;
    max-width: 90vw;
    height: 100vh;
    background-color: var(--lecart-secondary-color);
    color: var(--lecart-text-color);
    z-index: 9999;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.2);
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
    display: flex;
    flex-direction: column;
  }
  
  /* Positionnement */
  .lecart-position-right .lecart-panel {
    right: 0;
    transform: translateX(100%);
  }
  
  .lecart-position-left .lecart-panel {
    left: 0;
    transform: translateX(-100%);
  }
  
  /* État ouvert */
  .lecart-open .lecart-backdrop {
    opacity: 1;
    visibility: visible;
  }
  
  .lecart-open .lecart-panel {
    transform: translateX(0);
  }
  
  /* En-tête du panier */
  .lecart-header {
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--lecart-border-color);
  }
  
  .lecart-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
  }
  
  .lecart-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--lecart-text-color);
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
  }
  
  .lecart-close:hover {
    background-color: rgba(0, 0, 0, 0.05);
  }
  
  /* Conteneur des articles */
  .lecart-items {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
  }
  
  .lecart-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #888;
    font-style: italic;
    text-align: center;
    padding: 20px;
  }
  
  /* Article individuel */
  .lecart-item {
    display: flex;
    padding: 10px 0;
    border-bottom: 1px solid var(--lecart-border-color);
    position: relative;
  }
  
  .lecart-item-image {
    width: 60px;
    height: 60px;
    margin-right: 15px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #f2f2f2;
  }
  
  .lecart-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
  
  .lecart-item-details {
    flex: 1;
  }
  
  .lecart-item-name {
    font-weight: 500;
    margin-bottom: 4px;
  }

  .lecart-item-variant {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 4px;
  }

  .lecart-theme-dark .lecart-item-variant {
    color: #aaa;
  }

  .lecart-item-price {
    color: var(--lecart-accent-color);
    font-weight: 600;
    margin-bottom: 8px;
  }
  
  .lecart-item-quantity {
    display: flex;
    align-items: center;
    row-gap: 0;
    box-shadow: 0 1px 2px -1px rgba(0, 0, 0, 0.10196);
    flex-direction: row;
    flex-wrap: nowrap;
    width: fit-content;
    border-radius: 8px;
  }

  .lecart-quantity-dec,
  .lecart-quantity-inc {
    width: 28px;
    height: 28px;
    background-color: #ffffff;
    border: 1px solid var(--lecart-border-color);
    cursor: pointer;
    font-size: 16px;
    color: var(--lecart-primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0 8px 8px 0;
  }

  .lecart-quantity-dec {
    border-radius: 8px 0 0 8px;
  }

  .lecart-quantity-dec:hover,
  .lecart-quantity-inc:hover {
    background-color: var(--lecart-border-color);
  }

  .lecart-theme-dark .lecart-quantity-dec,
  .lecart-theme-dark .lecart-quantity-inc {
    background-color: #2d2d2d;
    border-color: #555;
    color: #f5f5f5;
  }

  .lecart-theme-dark .lecart-quantity-dec:hover,
  .lecart-theme-dark .lecart-quantity-inc:hover {
    background-color: #3a3a3a;
  }

  .lecart-quantity-input {
    width: 38px;
    height: 28px;
    box-sizing: border-box;
    text-align: center;
    border: 1px solid var(--lecart-border-color);
    border-left: 0;
    border-right: 0;
    border-radius: 0;
    margin: 0;
    padding: 4px;
    font-size: 16px;
    -moz-appearance: textfield;
  }

  /* Enlever les flèches du input number */
  .lecart-quantity-input::-webkit-inner-spin-button,
  .lecart-quantity-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
  }
  
  .lecart-item-remove {
    position: absolute;
    top: 10px;
    right: 0;
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #999;
    transition: color 0.2s;
  }
  
  .lecart-item-remove:hover {
    color: #ff5252;
  }
  
  /* Pied de page */
  .lecart-footer {
    padding: 15px;
    border-top: 1px solid var(--lecart-border-color);
  }
  
  .lecart-subtotal {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    font-weight: 500;
  }
  
  .lecart-checkout-btn {
    display: block;
    width: 100%;
    padding: 12px;
    background-color: var(--lecart-accent-color);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
  }
  
  .lecart-checkout-btn:hover {
    background-color: #2779bd;
  }
  
  /* Overlay de chargement */
  .lecart-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.8);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }
  
  .lecart-theme-dark .lecart-loading-overlay {
    background-color: rgba(0, 0, 0, 0.8);
  }
  
  .lecart-loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: var(--lecart-accent-color);
    animation: lecart-spin 1s linear infinite;
  }
  
  .lecart-loading-text {
    margin-top: 20px;
    font-weight: 500;
  }
  
  /* Notifications */
  .lecart-notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 4px;
    box-shadow: var(--lecart-shadow);
    display: flex;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
  }
  
  .lecart-notification-success {
    background-color: var(--lecart-success-color);
    color: white;
  }
  
  .lecart-notification-error {
    background-color: var(--lecart-error-color);
    color: white;
  }
  
  .lecart-notification-icon {
    margin-right: 10px;
    font-size: 20px;
    font-weight: bold;
  }
  
  .lecart-notification-close {
    margin-left: 10px;
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 0 5px;
  }
  
  /* Animations */
  @keyframes lecart-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
  }

  /* Badge de quantité sur les boutons d'ouverture du panier */
  .lecart-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    min-width: 20px;
    height: 20px;
    background-color: var(--lecart-accent-color);
    color: white;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    line-height: 1;
    z-index: 1;
  }

  /* Assurer que le bouton parent a position: relative pour le badge */
  [data-lecart-open] {
    position: relative;
  }

  /* Responsive */
  @media (max-width: 480px) {
    .lecart-panel {
      width: 100%;
      max-width: 100%;
    }
  }