/**
 * AirWidgets - CSS
 *
 * Stili di default per i widget AirMoney e AirContact.
 * Personalizzabile tramite variabili CSS.
 */

/* Variabili CSS personalizzabili */
:root {
  --aw-gap: 1.5rem;
  --aw-card-min: 280px;
  --aw-radius: 8px;
  --aw-border-color: #e5e7eb;
  --aw-card-bg: #fff;
  --aw-image-bg: #f3f4f6;
  --aw-padding: 1rem;
  --aw-muted: #6b7280;
  --aw-btn-bg: #1a1a2e;
  --aw-btn-color: #fff;
  --aw-btn-radius: 6px;
  --aw-price-color: inherit;
}

/* ============== GRIGLIA PRODOTTI ============== */

.aw-product-grid {
  display: grid;
  gap: var(--aw-gap);
  grid-template-columns: repeat(auto-fill, minmax(var(--aw-card-min), 1fr));
}

.aw-product-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--aw-border-color);
  border-radius: var(--aw-radius);
  overflow: hidden;
  background: var(--aw-card-bg);
  transition: box-shadow 0.2s;
}

.aw-product-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.aw-product-image {
  aspect-ratio: 16/9;
  overflow: hidden;
  background: var(--aw-image-bg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.aw-product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.aw-product-image svg {
  width: 60%;
  height: 60%;
}

.aw-product-info {
  padding: var(--aw-padding);
  flex: 1;
}

.aw-product-category {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--aw-muted);
}

.aw-product-name {
  margin: 0.5rem 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.aw-product-desc {
  font-size: 0.9rem;
  color: var(--aw-muted);
  margin: 0.5rem 0;
}

.aw-product-duration {
  font-size: 0.85rem;
  color: var(--aw-muted);
}

.aw-product-footer {
  padding: var(--aw-padding);
  border-top: 1px solid var(--aw-border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.aw-product-price {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--aw-price-color);
}

.aw-product-add {
  padding: 0.5rem 1rem;
  background: var(--aw-btn-bg);
  color: var(--aw-btn-color);
  border: none;
  border-radius: var(--aw-btn-radius);
  cursor: pointer;
  font-weight: 500;
  transition: opacity 0.2s;
}

.aw-product-add:hover {
  opacity: 0.9;
}

.aw-product-add:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ============== CARRELLO SIDEBAR ============== */

.aw-cart-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease;
}

.aw-cart-overlay.open {
  opacity: 1;
  visibility: visible;
}

.aw-cart-sidebar {
  position: fixed;
  top: 0;
  right: -400px;
  width: 400px;
  max-width: 100vw;
  height: 100vh;
  background: #fff;
  box-shadow: -4px 0 20px rgba(0,0,0,0.15);
  z-index: 10000;
  transition: right 0.3s ease;
  display: flex;
  flex-direction: column;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.aw-cart-sidebar.open {
  right: 0;
}

.aw-cart-header {
  padding: 20px;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.aw-cart-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.aw-cart-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #666;
  padding: 0;
  line-height: 1;
}

.aw-cart-close:hover {
  color: #333;
}

.aw-cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.aw-cart-empty {
  text-align: center;
  color: #999;
  padding: 40px 20px;
}

.aw-cart-item {
  display: flex;
  gap: 15px;
  padding: 15px 0;
  border-bottom: 1px solid #eee;
}

.aw-cart-item-icon {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  background: #f9fafb;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.aw-cart-item-icon svg {
  width: 44px;
  height: 44px;
}

.aw-cart-item-info {
  flex: 1;
}

.aw-cart-item-name {
  font-weight: 500;
  margin: 0 0 5px;
  font-size: 14px;
}

.aw-cart-item-price {
  color: #666;
  font-size: 13px;
  margin: 0;
}

.aw-cart-item-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.aw-qty-btn {
  width: 28px;
  height: 28px;
  border: 1px solid #ddd;
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.aw-qty-btn:hover {
  background: #f5f5f5;
}

.aw-qty-value {
  min-width: 30px;
  text-align: center;
  font-weight: 500;
}

.aw-cart-item-remove {
  color: #d32f2f;
  cursor: pointer;
  font-size: 12px;
  margin-left: auto;
}

.aw-cart-item-remove:hover {
  text-decoration: underline;
}

.aw-cart-footer {
  padding: 20px;
  border-top: 1px solid #eee;
  background: #fafafa;
}

.aw-cart-total {
  display: flex;
  justify-content: space-between;
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 15px;
}

/* ============== BOTTONI ============== */

.aw-btn {
  display: block;
  width: 100%;
  padding: 14px 20px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: background 0.2s;
}

.aw-btn-primary {
  background: #1a1a2e;
  color: #fff;
}

.aw-btn-primary:hover {
  background: #2a2a4e;
}

.aw-btn-primary:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.aw-btn-secondary {
  background: #e0e0e0;
  color: #333;
  margin-top: 10px;
}

.aw-btn-secondary:hover {
  background: #d0d0d0;
}

/* ============== BADGE CARRELLO ============== */

.aw-cart-badge {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 60px;
  height: 60px;
  background: #1a1a2e;
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
}

.aw-cart-badge:hover {
  transform: scale(1.1);
}

.aw-cart-badge svg {
  width: 24px;
  height: 24px;
}

.aw-cart-count {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #e53935;
  color: #fff;
  font-size: 12px;
  font-weight: bold;
  min-width: 22px;
  height: 22px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

/* ============== FORM CONTATTO ============== */

.aw-contact-form {
  max-width: 600px;
}

.aw-form-group {
  margin-bottom: 1rem;
}

.aw-form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.aw-form-group input,
.aw-form-group select,
.aw-form-group textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--aw-border-color);
  border-radius: var(--aw-radius);
  font-size: 1rem;
  box-sizing: border-box;
}

.aw-form-group input:focus,
.aw-form-group select:focus,
.aw-form-group textarea:focus {
  outline: none;
  border-color: var(--aw-btn-bg);
}

.aw-form-checkbox label,
.aw-radio-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.aw-form-checkbox input,
.aw-radio-option input {
  width: auto;
}

.aw-radio-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.aw-form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.aw-form-submit {
  margin-top: 1.5rem;
}

.aw-form-submit .aw-btn {
  width: auto;
  display: inline-block;
}

.aw-form-message {
  padding: 1rem;
  border-radius: var(--aw-radius);
  margin-bottom: 1rem;
}

.aw-form-error {
  background: #fee2e2;
  color: #dc2626;
}

.aw-form-success {
  background: #dcfce7;
  color: #16a34a;
}

/* ============== STATI ============== */

.aw-empty {
  text-align: center;
  padding: 2rem;
  color: var(--aw-muted);
}

.aw-error {
  text-align: center;
  padding: 2rem;
  color: #dc2626;
}

.aw-loading {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: aw-spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 8px;
}

@keyframes aw-spin {
  to { transform: rotate(360deg); }
}

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

@media (max-width: 480px) {
  .aw-cart-sidebar {
    width: 100%;
    right: -100%;
  }

  .aw-product-grid {
    grid-template-columns: 1fr;
  }
}
