/**
 * Copyright since 2026 Nicolas Lebret
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License version 3.0
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * https://opensource.org/licenses/AFL-3.0
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to contact@nicolaslebret.fr so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade this module to newer
 * versions in the future. If you wish to customize this module for your
 * needs please refer to https://nicolaslebret.fr for more information.
 *
 * @author    Nicolas Lebret
 * @copyright Since 2026 Nicolas Lebret
 * @license   https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
 */
/* Contrôle des ruptures au panier — styles de la fenêtre modale.
   Préfixe .cpsc- pour éviter toute collision avec le thème. */

.cpsc-open {
  overflow: hidden;
}

.cpsc-overlay {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 10050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.55);
}

.cpsc-dialog {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  background: #fff;
  color: #232323;
  border-radius: 6px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

.cpsc-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 20px 0;
}

.cpsc-dialog .cpsc-title {
  margin: 0;
  font-size: 1.25rem;
  line-height: 1.3;
  font-weight: 700;
  text-transform: none;
  letter-spacing: normal;
  color: #000;
}

.cpsc-close {
  flex: none;
  width: 32px;
  height: 32px;
  margin: -6px -6px 0 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #777;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}

.cpsc-close:hover,
.cpsc-close:focus {
  color: #232323;
}

.cpsc-intro {
  margin: 10px 20px 0;
  padding: 10px 12px;
  background: #fde8e9;
  color: #a3161e;
  border: 1px solid #d9232d;
  border-radius: 4px;
  font-size: 0.95rem;
}

.cpsc-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0 20px;
  overflow-y: auto;
  flex: 1 1 auto;
}

.cpsc-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #e5e5e5;
}

.cpsc-item:last-child {
  border-bottom: 0;
}

.cpsc-thumb {
  flex: none;
  width: 64px;
  height: 64px;
  background: #f4f4f4;
  border-radius: 4px;
  overflow: hidden;
}

.cpsc-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.cpsc-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  font-size: 0.9rem;
}

.cpsc-name {
  font-weight: 600;
}

.cpsc-attributes {
  color: #666;
}

.cpsc-qty {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin-top: 2px;
}

.cpsc-available {
  color: #2d7a2d;
}

.cpsc-unavailable {
  color: #c0392b;
  font-weight: 600;
}

.cpsc-error {
  margin: 10px 20px 0;
  padding: 8px 12px;
  background: #f8d7da;
  color: #721c24;
  border-radius: 4px;
  font-size: 0.9rem;
}

.cpsc-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 20px 20px;
  border-top: 1px solid #e5e5e5;
}

.cpsc-btn {
  width: 100%;
  white-space: normal;
}

.cpsc-dialog .cpsc-btn-remove,
.cpsc-dialog .cpsc-btn-remove:focus {
  background: #000;
  border-color: #000;
  color: #fff;
}

.cpsc-dialog .cpsc-btn-remove:hover {
  background: #333;
  border-color: #333;
  color: #fff;
}

.cpsc-dialog .cpsc-btn-adjust,
.cpsc-dialog .cpsc-btn-adjust:focus {
  background: #fff;
  border: 1px solid #000;
  color: #000;
}

.cpsc-dialog .cpsc-btn-adjust:hover {
  background: #000;
  color: #fff;
}

.cpsc-dialog .cpsc-btn:disabled {
  opacity: 0.6;
}

.cpsc-link {
  align-self: center;
  margin-top: 4px;
  padding: 4px 8px;
  border: 0;
  background: transparent;
  color: #666;
  text-decoration: underline;
  cursor: pointer;
}

.cpsc-working .cpsc-dialog {
  opacity: 0.7;
  pointer-events: none;
}

@media (min-width: 576px) {
  .cpsc-actions {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }

  .cpsc-btn {
    width: auto;
    flex: 1 1 auto;
  }

  .cpsc-link {
    margin-top: 0;
    margin-left: auto;
  }
}
