/**
 * Reservation system UI and the Carta de Intencion modal.
 *
 * Part of the WooCommerce stylesheet set - enqueued in order by
 * sync_rc_woocommerce_styles() in inc/shop/shop-setup.php. Order matters.
 */

/* ============================================
   RESERVATION SYSTEM
   ============================================ */

/* Reserve Button */
.sync-reserve-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  justify-content: center;
  padding: 14px 28px;
  font-size: var(--text-base);
  font-weight: 700;
  font-family: var(--font-heading);
  color: var(--color-white);
  background: var(--color-primary);
  border: 2px solid var(--color-primary);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.2s ease;
}

.sync-reserve-btn:hover {
  background: var(--color-primary-dark, #3730a3);
  border-color: var(--color-primary-dark, #3730a3);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.sync-reserve-btn:active {
  transform: translateY(0);
}

.sync-reserve-btn--loading {
  opacity: 0.8;
  cursor: wait;
}

.sync-reserve-btn--reserved {
  background: #059669;
  border-color: #059669;
  cursor: default;
}

.sync-reserve-btn--reserved:hover {
  background: #059669;
  border-color: #059669;
  transform: none;
  box-shadow: none;
}

.sync-reserve-btn--sold {
  background: var(--color-gray-400, #9ca3af);
  border-color: var(--color-gray-400, #9ca3af);
  cursor: default;
  opacity: 0.8;
}

.sync-reserve-btn--sold:hover {
  background: var(--color-gray-400, #9ca3af);
  border-color: var(--color-gray-400, #9ca3af);
  transform: none;
  box-shadow: none;
}

@keyframes sync-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.sync-spin {
  animation: sync-spin 1s linear infinite;
}

/* Reserve Note */
.sync-reserve-note {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-top: 10px;
  padding: 10px 12px;
  font-size: var(--text-sm);
  color: var(--color-gray-500);
  background: var(--color-gray-50, #f9fafb);
  border-radius: var(--radius-md);
  line-height: 1.4;
}

.sync-reserve-note i {
  margin-top: 1px;
  flex-shrink: 0;
}

.sync-reserve-note--success {
  color: #065f46;
  background: #ecfdf5;
}

.sync-reserve-note--error {
  color: #991b1b;
  background: #fef2f2;
}

.sync-reserve-note--warning {
  color: #92400e;
  background: #fffbeb;
}

/* Header Orders Link */
.header-orders-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--color-gray-700);
  font-size: var(--text-sm);
  font-weight: 500;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  transition: all 0.15s ease;
}

.header-orders-link:hover {
  color: var(--color-primary);
  background: var(--color-gray-50, #f9fafb);
}

.header-orders-link i {
  font-size: 18px;
}

@media (max-width: 768px) {
  .header-orders-label {
    display: none;
  }
}

/* My Account - Order Status Badges */
.woocommerce-orders-table .order-status-requested {
  display: inline-block;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 12px;
  background: #fef3c7;
  color: #92400e;
}

.woocommerce-orders-table .order-status-confirmed {
  display: inline-block;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 12px;
  background: #d1fae5;
  color: #065f46;
}

.woocommerce-orders-table .order-status-rejected {
  display: inline-block;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 12px;
  background: #fee2e2;
  color: #991b1b;
}

/* Shop loop - View Product button */
.sync-view-product-btn {
  text-align: center;
}

/* Shop loop - Reserved badge */
.sync-reserved-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  line-height: 1;
}

.sync-reserved-pending {
  background: rgba(234, 179, 8, 0.9);
  color: #1a1a1a;
}

.sync-reserved-confirmed {
  background: rgba(34, 197, 94, 0.9);
  color: #fff;
}

.sync-reserved-waitlist {
  background: rgba(217, 119, 6, 0.9);
  color: #fff;
}

.sync-reserved-other {
  background: rgba(100, 116, 139, 0.9);
  color: #fff;
}

/* Single product - Waitlist button */
.sync-reserve-btn--waitlist {
  background: #f59e0b !important;
  border-color: #f59e0b !important;
  color: #fff !important;
  cursor: not-allowed;
}

/* Shop loop - Pay Now button */
.sync-pay-now-btn {
  background: #16a34a !important;
  color: #fff !important;
  border-color: #16a34a !important;
  text-align: center;
  font-weight: 600 !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.sync-pay-now-btn:hover {
  background: #15803d !important;
  border-color: #15803d !important;
  color: #fff !important;
}

/* Single product - Pay Now button */
.sync-reserve-btn--pay {
  background: #16a34a !important;
  border-color: #16a34a !important;
  color: #fff !important;
  text-decoration: none;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.sync-reserve-btn--pay:hover {
  background: #15803d !important;
  border-color: #15803d !important;
  color: #fff !important;
}


/* ============================================================
   Carta de Intención — Reservation Confirmation Modal
   ============================================================ */

body.src-modal-open { overflow: hidden; }

.src-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}

.src-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  backdrop-filter: blur(2px);
}

.src-modal__box {
  position: relative;
  background: #fff;
  border-radius: 10px;
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
  overflow: hidden;
}

/* Header */
.src-modal__header {
  background: #015E7C;
  color: #fff;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.src-modal__logo {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.src-modal__doc-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .1em;
  opacity: .75;
  text-align: right;
}

/* Scrollable body */
.src-modal__body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.src-modal__intro {
  font-size: 13px;
  color: #4b5563;
  margin: 0 0 20px;
  line-height: 1.6;
}

/* Product card */
.src-modal__product-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-left: 4px solid #015E7C;
  border-radius: 6px;
  padding: 16px;
  margin-bottom: 20px;
}
.src-modal__product-row {
  display: flex;
  gap: 12px;
  padding: 5px 0;
  border-bottom: 1px solid #e9ecef;
  font-size: 13px;
}
.src-modal__product-row:last-child { border-bottom: none; }
.src-modal__product-label {
  flex: 0 0 200px;
  color: #64748b;
  font-weight: 500;
}
.src-modal__product-value { color: #1e293b; font-weight: 500; }
.src-modal__product-value--price { color: #015E7C; font-weight: 700; }
.src-modal__product-value--deposit { color: #b45309; font-weight: 700; }

/* Conditions */
.src-modal__conditions { margin-bottom: 20px; }
.src-modal__conditions-title,
.src-modal__bank-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: #015E7C;
  margin: 0 0 10px;
  padding-bottom: 6px;
  border-bottom: 2px solid #015E7C;
}
.src-modal__conditions-list {
  padding-left: 18px;
  margin: 0;
}
.src-modal__conditions-list li {
  font-size: 12.5px;
  color: #374151;
  line-height: 1.6;
  margin-bottom: 8px;
}

/* Bank info */
.src-modal__bank { margin-bottom: 20px; }
.src-modal__bank-note { font-size: 12.5px; color: #374151; margin: 0 0 10px; }
.src-modal__bank-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-bottom: 10px;
}
.src-modal__bank-table th {
  background: #015E7C;
  color: #fff;
  padding: 7px 10px;
  text-align: left;
  font-weight: 600;
}
.src-modal__bank-table td {
  padding: 7px 10px;
  border-bottom: 1px solid #e5e7eb;
  color: #1e293b;
}
.src-modal__bank-table tr:last-child td { border-bottom: none; }
.src-modal__bank-contact {
  font-size: 11.5px;
  color: #6b7280;
  margin: 0;
  font-style: italic;
}

/* Accept checkbox */
.src-modal__accept {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: 6px;
  padding: 14px;
  cursor: pointer;
  font-size: 12.5px;
  color: #374151;
  line-height: 1.5;
}
.src-modal__accept input[type="checkbox"] {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  margin-top: 2px;
  accent-color: #015E7C;
  cursor: pointer;
}

/* Footer */
.src-modal__footer {
  padding: 16px 24px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  flex-shrink: 0;
  background: #f9fafb;
}
.src-modal__cancel {
  padding: 9px 20px;
  font-size: 13px;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  cursor: pointer;
  color: #374151;
  font-weight: 500;
}
.src-modal__cancel:hover { background: #f3f4f6; }
.src-modal__confirm {
  padding: 9px 22px;
  font-size: 13px;
  font-weight: 600;
  background: #015E7C;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: background .15s;
}
.src-modal__confirm:hover:not(:disabled) { background: #014555; }
.src-modal__confirm:disabled {
  opacity: .4;
  cursor: not-allowed;
}

@media (max-width: 640px) {
  .src-modal__box { max-height: 95vh; }
  .src-modal__product-label { flex: 0 0 130px; }
  .src-modal__footer { flex-direction: column-reverse; }
  .src-modal__cancel, .src-modal__confirm { width: 100%; justify-content: center; }
}
