/* ==================== VARIABLES ==================== */
:root {
  --color-primary: #2c5f2d;
  --color-primary-dark: #1D3557;
  --color-accent: #FFD447;
  --color-gray-light: #f8f9fa;
  --color-gray-medium: #e0e0e0;
  --color-gray-dark: #666;
  --color-white: #fff;
  --color-error: #fc8181;
  --color-error-bg: #fff5f5;
  --color-error-text: #c53030;
  --color-warning: #FFD447;
  --color-warning-bg: #fff9e6;
  --color-warning-text: #856404;

  --shadow-sm: 0 2px 8px rgba(0,0,0,0.1);
  --shadow-md: 0 2px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.15);
  --shadow-selected: 0 4px 16px rgba(44, 95, 45, 0.3);

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --radius-xl: 12px;

  --transition-base: all 0.3s;

  --z-flatpickr: 9999;
}

/* ==================== FLATPICKR ==================== */
.flatpickr-calendar {
  font-family: 'Lato', 'Open Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  border-radius: var(--radius-lg);
  border: 2px solid var(--color-primary);
}
.flatpickr-calendar.open { z-index: var(--z-flatpickr) !important; }

@media (max-width: 768px) {
  .flatpickr-calendar {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    z-index: var(--z-flatpickr) !important;
    max-width: 90vw;
    font-size: 16px;
  }
  .flatpickr-calendar.open::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: -1;
    animation: fadeIn 0.2s ease-out;
    pointer-events: auto;
    cursor: pointer;
  }
  @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
  .flatpickr-calendar.open > * { position: relative; z-index: 1; }
  .flatpickr-day { height: 42px; line-height: 42px; max-width: 42px; min-width: 42px; }
  .flatpickr-months { padding: 8px; }
  .flatpickr-current-month { font-size: 1.125rem; padding: 8px 0; }
  .flatpickr-day.selected { background-color: var(--color-primary) !important; border-color: var(--color-primary) !important; }
  .flatpickr-day.today { border-color: var(--color-accent) !important; }
  .flatpickr-calendar input { font-size: 16px !important; }
}

/* ==================== BASE ==================== */
* { box-sizing: border-box; }

.suite-search-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 16px;
  font-family: 'Lato', 'Open Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ==================== SEARCH FORM ==================== */
.search-form-container {
  background: var(--color-white);
  padding: 24px 16px;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  margin-bottom: 24px;
}
.search-form-container h2 { margin: 0 0 8px; color: var(--color-primary-dark); font-size: 24px; line-height: 1.3; }
.search-form-container p  { margin: 0 0 20px; color: var(--color-gray-dark); font-size: 15px; }
.suite-form { width: 100%; }
.form-row   { display: flex; flex-direction: column; gap: 16px; }
.form-group { display: flex; flex-direction: column; }
.form-group label { margin-bottom: 8px; font-weight: 600; color: #333; font-size: 14px; }
.form-group input,
.form-group select {
  padding: 14px 16px;
  border: 2px solid var(--color-gray-medium);
  border-radius: var(--radius-lg);
  font-size: 16px;
  transition: var(--transition-base);
  background: var(--color-white);
  -webkit-appearance: none;
  appearance: none;
  min-height: 48px;
  touch-action: manipulation;
}
.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(44,95,45,0.1);
}
.form-group select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 40px;
}

/* ==================== BUTTONS ==================== */
.btn-search {
  background: var(--color-primary);
  color: var(--color-white);
  border: none;
  padding: 14px 24px;
  border-radius: var(--radius-lg);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-base);
  width: 100%;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  min-height: 48px;
}
.btn-search:active   { transform: scale(0.98); }
.btn-search:disabled { opacity: 0.5; cursor: not-allowed; }

/* ==================== SUITE RESULTS ==================== */
.suite-results   { margin-top: 24px; }
.suite-results h3 { margin-bottom: 20px; color: var(--color-primary-dark); font-size: 22px; }
#suites-list     { display: flex; flex-direction: column; gap: 20px; }

/* ==================== SUITE CARDS ==================== */
.suite-card {
  background: var(--color-white);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-base);
  border: 3px solid transparent;
}

/* ── Suite image wrap — clicable para galería ── */
.suite-img-wrap {
  position: relative;
  width: 100%;
  overflow: hidden;
  cursor: zoom-in;
  background: #e8e5df;
  line-height: 0;
}

.suite-img-wrap img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
  transition: transform 0.45s ease;
}

.suite-card:hover .suite-img-wrap img {
  transform: scale(1.04);
}

/* ── Hint overlay "View photos" ── */
.suite-img-hint {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.55));
  color: white;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.3px;
  padding: 24px 12px 10px;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

/* Desktop: show on hover */
.suite-card:hover .suite-img-hint { opacity: 1; }

/* Mobile: always visible */
@media (max-width: 767px) {
  .suite-img-hint { opacity: 1; }
}

/* ── Card body ── */
.suite-card-content { padding: 20px 16px; }
.suite-card h4 { margin: 0 0 8px; color: var(--color-primary-dark); font-size: 20px; line-height: 1.3; }
.suite-capacity { background: #f0f0f0; padding: 8px 12px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; color: var(--color-gray-dark); display: inline-block; margin: 8px 0; }
.suite-card p { color: var(--color-gray-dark); font-size: 14px; line-height: 1.5; margin: 8px 0; }
.suite-price { display: flex; justify-content: space-between; align-items: center; margin: 16px 0; padding-top: 16px; border-top: 1px solid var(--color-gray-medium); }
.price-label  { font-size: 14px; color: var(--color-gray-dark); }
.price-amount { font-size: 24px; font-weight: 700; color: var(--color-primary); }

/* ==================== SUITE ACTIONS ==================== */
.btn-book-suite,
.btn-toggle-suite {
  width: 100%;
  padding: 14px;
  border-radius: var(--radius-md);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-base);
  border: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  min-height: 48px;
}
.btn-book-suite    { background: var(--color-primary); color: var(--color-white); }
.btn-book-suite:active { transform: scale(0.98); }
.btn-book-suite:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-toggle-suite  { background: var(--color-white); color: var(--color-primary); border: 2px solid var(--color-primary); }
.btn-toggle-suite:active { transform: scale(0.98); }

/* ==================== SELECTED STATE ==================== */
.suite-card.selected { border: 3px solid var(--color-primary); box-shadow: var(--shadow-selected); transform: scale(1.02); }
.suite-card.selected .btn-toggle-suite { background: var(--color-primary); color: var(--color-white); }

/* ==================== SELECTION NOTICE ==================== */
.selection-notice { background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%); color: var(--color-white); padding: 20px 16px; border-radius: var(--radius-xl); margin-bottom: 20px; text-align: center; }
.selection-notice strong { font-size: 18px; display: block; margin-bottom: 8px; }
.selection-notice p { margin: 0; opacity: 0.9; font-size: 14px; line-height: 1.5; }

/* ==================== BOOKING SUMMARY ==================== */
.booking-summary { background: var(--color-gray-light); border-radius: var(--radius-xl); padding: 20px 16px; margin-top: 20px; }
.summary-content h4 { margin: 0 0 12px; color: var(--color-primary-dark); font-size: 18px; }
.summary-content p  { font-size: 15px; font-weight: 600; margin: 8px 0; }
#selection-help { background: var(--color-warning-bg); padding: 12px; border-radius: var(--radius-md); margin: 12px 0; font-size: 14px; color: var(--color-warning-text); border: 1px solid var(--color-warning); }
.btn-book-multiple { background: var(--color-primary); color: var(--color-white); border: none; padding: 16px; border-radius: var(--radius-lg); width: 100%; font-size: 17px; font-weight: 700; cursor: pointer; transition: var(--transition-base); margin-top: 16px; -webkit-tap-highlight-color: transparent; touch-action: manipulation; min-height: 52px; }
.btn-book-multiple:active   { transform: scale(0.98); }
.btn-book-multiple:disabled { opacity: 0.5; cursor: not-allowed; }

/* ==================== LOADING STATE ==================== */
.loading-state { text-align: center; padding: 40px 20px; }
.loading-state p { color: var(--color-gray-dark); font-size: 15px; margin: 0; }
.spinner { width: 50px; height: 50px; border: 4px solid #f3f3f3; border-top: 4px solid var(--color-primary); border-radius: 50%; animation: ss-spin 1s linear infinite; margin: 0 auto 16px; }
@keyframes ss-spin { to { transform: rotate(360deg); } }

/* ==================== ERROR STATE ==================== */
.error-state { background: var(--color-error-bg); border: 2px solid var(--color-error); padding: 20px 16px; border-radius: var(--radius-xl); color: var(--color-error-text); margin-top: 20px; }
.error-message { margin: 0; font-size: 15px; line-height: 1.5; }

/* ==================== MIN NIGHTS WARNING ==================== */
.min-nights-warning { background: var(--color-warning-bg); border: 2px solid var(--color-warning); border-left: 4px solid var(--color-warning); padding: 12px 16px; border-radius: var(--radius-md); color: var(--color-warning-text); font-size: 14px; margin-top: 12px; display: none; }
.min-nights-warning.show { display: block; }

/* ==================== GALLERY LIGHTBOX ==================== */
.ss-gallery-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.95);
  z-index: 100000;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

body.ss-gallery-open { overflow: hidden; }

.ss-gallery-close {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 44px;
  height: 44px;
  background: rgba(255,255,255,0.12);
  border: 2px solid rgba(255,255,255,0.28);
  border-radius: 50%;
  color: white;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  z-index: 11;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.2s;
}
.ss-gallery-close:hover { background: rgba(255,255,255,0.28); transform: rotate(90deg); }

.ss-gallery-title {
  position: absolute;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.88);
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 17px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 60%;
  pointer-events: none;
}

.ss-gallery-main {
  position: relative;
  flex: 1;
  width: 100%;
  max-width: 920px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 52px 8px;
  min-height: 0;
}

.ss-gallery-img {
  max-width: 100%;
  max-height: calc(100vh - 200px);
  object-fit: contain;
  border-radius: 8px;
  user-select: none;
  display: block;
}

.ss-gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  background: rgba(255,255,255,0.16);
  border: 1.5px solid rgba(255,255,255,0.32);
  border-radius: 50%;
  color: white;
  font-size: 28px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  z-index: 5;
  user-select: none;
}
.ss-gallery-nav:hover { background: rgba(255,255,255,0.32); }
.ss-gallery-prev      { left: 4px; }
.ss-gallery-next      { right: 4px; }

.ss-gallery-counter {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.55);
  font-size: 12px;
  letter-spacing: 1px;
  pointer-events: none;
}

.ss-gallery-thumbs {
  display: flex;
  gap: 8px;
  padding: 10px 16px 20px;
  overflow-x: auto;
  max-width: 920px;
  width: 100%;
  flex-shrink: 0;
  scrollbar-width: none;
}
.ss-gallery-thumbs::-webkit-scrollbar { display: none; }

.ss-gallery-thumb {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
  opacity: 0.45;
  border: 2px solid transparent;
  transition: all 0.2s;
}
.ss-gallery-thumb:hover { opacity: 0.78; }
.ss-gallery-thumb.active { opacity: 1; border-color: #FFD447; }

@media (max-width: 767px) {
  .ss-gallery-main { padding: 56px 44px 8px; }
  .ss-gallery-img  { max-height: calc(100vh - 220px); }
  .ss-gallery-nav  { width: 38px; height: 38px; font-size: 22px; }
  .ss-gallery-prev { left: 3px; }
  .ss-gallery-next { right: 3px; }
  .ss-gallery-thumb { width: 56px; height: 56px; }
}

/* ==================== TABLET (600px+) ==================== */
@media (min-width: 600px) {
  .suite-search-container { padding: 24px 20px; }
  .search-form-container  { padding: 30px 24px; }
  .search-form-container h2 { font-size: 28px; }
  .form-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
  .form-group:last-child { grid-column: span 2; }
  #suites-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
  .booking-summary { grid-column: 1 / -1; padding: 24px; }
}

/* ==================== DESKTOP (900px+) ==================== */
@media (min-width: 900px) {
  .suite-search-container { padding: 30px 20px; }
  .search-form-container  { padding: 30px; }
  .form-row { grid-template-columns: repeat(4, 1fr); gap: 20px; }
  .form-group:last-child { grid-column: auto; }
  .btn-search:hover:not(:disabled)        { background: #234d23; transform: translateY(-2px); box-shadow: 0 6px 20px rgba(44,95,45,0.4); }
  .suite-results h3 { font-size: 24px; }
  #suites-list { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 24px; }
  .suite-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
  .suite-card.selected:hover { transform: scale(1.02) translateY(-2px); }
  .btn-book-suite:hover:not(:disabled)    { background: #234d23; transform: translateY(-2px); box-shadow: 0 6px 20px rgba(44,95,45,0.4); }
  .btn-toggle-suite:hover                 { background: var(--color-primary); color: var(--color-white); }
  .btn-book-multiple:hover:not(:disabled) { background: #234d23; transform: translateY(-2px); box-shadow: 0 6px 20px rgba(44,95,45,0.4); }
}

/* ==================== LARGE DESKTOP (1200px+) ==================== */
@media (min-width: 1200px) {
  #suites-list { grid-template-columns: repeat(3, 1fr); }
}

/* ==================== ACCESSIBILITY ==================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
.btn-search:focus-visible,
.btn-book-suite:focus-visible,
.btn-toggle-suite:focus-visible,
.btn-book-multiple:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }
.form-group input:focus-visible,
.form-group select:focus-visible  { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(44,95,45,0.2); }