/**
 * ═══════════════════════════════════════════════════════════════════════════════
 * MODALS COMPONENT — proprietate.html
 * ═══════════════════════════════════════════════════════════════════════════════
 *
 * Modale pentru:
 * - Share (distribuire rețele sociale)
 * - Contact gazdă
 * - Amenities complete
 *
 * ═══════════════════════════════════════════════════════════════════════════════
 */

/* ─────────────────────────────────────────────────────────
   Modal Base
   ───────────────────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal, 9999);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
}

.modal:not([hidden]),
.modal.active {
  opacity: 1;
  visibility: visible;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.95);
}

.modal-content {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-2xl);
  box-shadow: 0 25px 80px rgba(var(--color-bg-rgb), 0.8);
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Modal header */
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--color-border);
}

.modal-header h2 {
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  color: var(--color-text);
  margin: 0;
}

.modal-header .btn-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-full);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all var(--transition-base);
}

.modal-header .btn-icon:hover {
  background: var(--color-border);
  color: var(--color-text);
}

.modal-header .btn-icon .icon {
  width: 20px;
  height: 20px;
}

/* Modal body */
.modal-body {
  padding: var(--space-6);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   SHARE MODAL
   ═══════════════════════════════════════════════════════════════════════════════ */

.share-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
}

.share-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-5);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  color: var(--color-text);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  cursor: pointer;
  transition: all var(--transition-base);
}

.share-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.share-btn .icon {
  width: 28px;
  height: 28px;
}

/* Social colors on hover */
.share-btn[data-share="facebook"]:hover {
  border-color: #1877f2;
  color: #1877f2;
}

.share-btn[data-share="whatsapp"]:hover {
  border-color: #25d366;
  color: #25d366;
}

.share-btn[data-share="email"]:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.share-btn[data-share="copy"]:hover {
  border-color: var(--color-success);
  color: var(--color-success);
}

/* Copy success state */
.share-btn[data-share="copy"].copied {
  background: rgba(34, 197, 94, 0.1);
  border-color: #22c55e;
  color: #22c55e;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   CONTACT MODAL
   ═══════════════════════════════════════════════════════════════════════════════ */

#contactHostForm {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

#contactHostForm .form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

#contactHostForm label {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--color-text);
}

#contactHostForm textarea {
  width: 100%;
  min-height: 120px;
  padding: var(--space-4);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  color: var(--color-text);
  font-family: inherit;
  font-size: var(--text-base);
  line-height: 1.6;
  resize: vertical;
  transition: border-color var(--transition-base);
}

#contactHostForm textarea:focus {
  outline: none;
  border-color: var(--color-primary);
}

#contactHostForm textarea::placeholder {
  color: var(--color-text-muted);
}

#contactHostForm .btn-primary {
  width: 100%;
  padding: var(--space-4);
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  border: none;
  border-radius: var(--radius-lg);
  color: white;
  font-size: var(--text-base);
  font-weight: var(--font-bold);
  cursor: pointer;
  transition: all var(--transition-base);
}

#contactHostForm .btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(var(--color-primary-rgb), 0.4);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   GALLERY MODAL (All Photos)
   ═══════════════════════════════════════════════════════════════════════════════ */

.gallery-modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal, 9999);
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
}

.gallery-modal:not([hidden]) {
  opacity: 1;
  visibility: visible;
}

.gallery-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-4) var(--space-6);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

.gallery-counter {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--color-text);
}

.btn-icon-white {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  color: var(--color-text);
  cursor: pointer;
  transition: all var(--transition-base);
}

.btn-icon-white:hover {
  background: var(--color-border);
}

.gallery-modal-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.gallery-modal-image {
  max-width: 90%;
  max-height: 75vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-modal-image img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: var(--radius-lg);
}

.gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  color: var(--color-text);
  cursor: pointer;
  transition: all var(--transition-base);
}

.gallery-nav:hover {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: white;
}

.gallery-nav .icon {
  width: 24px;
  height: 24px;
}

.gallery-prev {
  left: var(--space-6);
}

.gallery-next {
  right: var(--space-6);
}

.gallery-modal-thumbs {
  display: flex;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-6);
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  overflow-x: auto;
}

.gallery-thumb {
  width: 80px;
  height: 60px;
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  opacity: 0.5;
  transition: all var(--transition-base);
  flex-shrink: 0;
  border: 2px solid transparent;
}

.gallery-thumb:hover,
.gallery-thumb.active {
  opacity: 1;
}

.gallery-thumb.active {
  border-color: var(--color-primary);
}

.gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   BOOKING MODAL
   ═══════════════════════════════════════════════════════════════════════════════ */

.modal-booking-content {
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-2xl);
  box-shadow: 0 25px 80px rgba(var(--color-bg-rgb), 0.9);
}

.booking-modal-header {
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  color: white;
  padding: var(--space-5) var(--space-6);
}

.booking-modal-title-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.booking-modal-header .modal-title {
  color: white;
  font-size: var(--text-xl);
  margin: 0;
}

.booking-modal-subtitle {
  font-size: var(--text-sm);
  color: rgba(255, 255, 255, 0.8);
  margin: 0;
}

.booking-modal-header .modal-close {
  color: white;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition-base);
}

.booking-modal-header .modal-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.booking-modal-body {
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

/* Property Preview */
.booking-property-preview {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-4);
  background: var(--color-bg);
  border-radius: var(--radius-xl);
  border: 1px solid var(--color-border);
}

.booking-preview-img {
  width: 80px;
  height: 60px;
  border-radius: var(--radius-lg);
  object-fit: cover;
}

.booking-preview-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--space-1);
}

.booking-preview-type {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--color-text);
}

.booking-preview-rating {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.booking-preview-rating svg {
  color: #fbbf24;
}

/* Section titles */
.booking-section-title {
  font-size: var(--text-sm);
  font-weight: var(--font-bold);
  color: var(--color-text);
  margin: 0 0 var(--space-3) 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Details section */
.booking-details-section {
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--color-border);
}

.booking-detail-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.booking-detail-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex: 1;
  padding: var(--space-3);
  background: var(--color-bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
}

.booking-detail-item.full-width {
  flex: none;
  width: 100%;
}

.booking-detail-item svg {
  color: var(--color-primary);
  flex-shrink: 0;
}

.booking-detail-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.booking-detail-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.booking-detail-value {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--color-text);
}

.booking-detail-arrow {
  flex-shrink: 0;
  color: var(--color-text-muted);
}

/* Price section */
.booking-price-section {
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--color-border);
}

.booking-price-rows {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.booking-price-row {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

/* Randurile optionale chiar trebuie sa dispara cand sunt marcate `hidden`.
   Atributul `hidden` vine cu `display: none` din foaia browserului, dar aceea
   are specificitate mai mica decat regula de clasa de mai sus — deci pierdea.
   Rezultat vizibil: "Taxa curatenie 0 RON" si "Reducere 7+ nopti -0 RON"
   ramaneau in bonul de plata desi JS le setase `hidden = true`. */
.booking-price-row[hidden] {
  display: none;
}

.booking-price-row.discount {
  color: #22c55e;
}

.booking-price-row.discount svg {
  vertical-align: middle;
  margin-right: var(--space-1);
}

.discount-value {
  font-weight: var(--font-semibold);
}

.booking-price-total {
  display: flex;
  justify-content: space-between;
  padding-top: var(--space-3);
  margin-top: var(--space-3);
  border-top: 2px solid var(--color-border);
  font-size: var(--text-lg);
  font-weight: var(--font-bold);
  color: var(--color-text);
}

/* Payment section */
.booking-payment-section {
  padding-bottom: var(--space-4);
}

.payment-options {
  display: flex;
  gap: var(--space-3);
}

.payment-option {
  flex: 1;
  cursor: pointer;
}

.payment-option input {
  display: none;
}

.payment-option-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4);
  background: var(--color-bg);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-xl);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--color-text-muted);
  transition: all var(--transition-base);
}

.payment-option input:checked + .payment-option-content {
  border-color: var(--color-primary);
  background: rgba(var(--color-primary-rgb), 0.05);
  color: var(--color-primary);
}

.payment-option:hover .payment-option-content {
  border-color: var(--color-primary);
}

/* Terms */
.booking-terms {
  padding: var(--space-3);
  background: var(--color-bg);
  border-radius: var(--radius-lg);
}

.terms-checkbox {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  cursor: pointer;
}

.terms-checkbox input {
  display: none;
}

.terms-checkbox .checkmark {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm);
  transition: all var(--transition-base);
}

.terms-checkbox .checkmark svg {
  opacity: 0;
  color: white;
  transition: opacity var(--transition-fast);
}

.terms-checkbox input:checked + .checkmark {
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.terms-checkbox input:checked + .checkmark svg {
  opacity: 1;
}

.terms-text {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.5;
}

.terms-text a {
  color: var(--color-primary);
  text-decoration: underline;
}

.terms-text a:hover {
  color: var(--color-secondary);
}

/* Modal Footer */
.booking-modal-footer {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
}

.booking-modal-footer .btn {
  flex: 1;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  font-weight: var(--font-semibold);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  cursor: pointer;
  transition: all var(--transition-base);
}

.booking-modal-footer .btn-outline {
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text);
}

.booking-modal-footer .btn-outline:hover {
  background: var(--color-bg);
  border-color: var(--color-text);
}

.booking-modal-footer .btn-primary {
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  border: none;
  color: white;
}

.booking-modal-footer .btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(var(--color-primary-rgb), 0.4);
}

.btn-confirm-booking svg {
  width: 18px;
  height: 18px;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  .modal-content {
    margin: var(--space-4);
    max-width: none;
    max-height: calc(100vh - var(--space-8));
  }

  .share-options {
    grid-template-columns: 1fr;
  }

  .gallery-nav {
    width: 44px;
    height: 44px;
  }

  .gallery-prev {
    left: var(--space-2);
  }

  .gallery-next {
    right: var(--space-2);
  }

  .gallery-modal-thumbs {
    display: none; /* More space for image on mobile */
  }

  .modal-booking-content {
    max-height: 95vh;
    margin: var(--space-2);
  }

  .booking-modal-body {
    padding: var(--space-4);
  }

  .payment-options {
    flex-direction: column;
  }

  .booking-detail-row {
    flex-wrap: wrap;
  }

  .booking-detail-arrow {
    display: none;
  }

  .booking-detail-item {
    min-width: calc(50% - var(--space-2));
  }
}

