:root {
  --primary: #003366;
  --secondary: #c5a059;
  --primary2: #27a7b2;
  --secondary2: #c5a059;
  --light: #f4f4f4;
  --dark: #333;
  --dark2: #003366;
  --white: #ffffff;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: 'Montserrat', sans-serif;
  line-height: 1.6;
  color: var(--dark);
  background: var(--white);
  overflow-x: hidden;
  -webkit-tap-highlight-color: rgba(39, 167, 178, 0.15);
}

@media (max-width: 900px) {
  body.nav-open {
    overflow: hidden;
    touch-action: none;
  }
}

/* Cabecera + logo: /img/logo.png */
.site-header {
  background: var(--white);
  padding: 0.65rem max(4%, env(safe-area-inset-right)) 0.65rem max(4%, env(safe-area-inset-left));
  padding-top: max(0.65rem, env(safe-area-inset-top));
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.site-header .logo {
  text-decoration: none;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  min-height: 44px;
}

.site-header .logo img {
  height: 44px;
  width: auto;
  max-width: min(220px, 58vw);
  display: block;
  object-fit: contain;
  object-position: left center;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 8px;
  flex-shrink: 0;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2.5px;
  background: var(--primary);
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}

.site-header.is-nav-open .nav-toggle span:nth-child(1) {
  transform: translateY(7.5px) rotate(45deg);
}

.site-header.is-nav-open .nav-toggle span:nth-child(2) {
  opacity: 0;
}

.site-header.is-nav-open .nav-toggle span:nth-child(3) {
  transform: translateY(-7.5px) rotate(-45deg);
}

.site-nav {
  flex: 1;
  min-width: 0;
}

.site-nav ul {
  display: flex;
  list-style: none;
  flex-wrap: wrap;
  gap: 0.15rem 1.1rem;
  justify-content: flex-end;
  align-items: center;
  margin: 0;
  padding: 0;
}

.site-nav ul li a {
  text-decoration: none;
  color: var(--primary2);
  font-weight: 500;
  font-size: 0.92rem;
  transition: color 0.2s;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0.35rem 0.15rem;
}

.site-nav ul li a:hover,
.site-nav ul li a:active {
  color: var(--secondary2);
}

@media (max-width: 900px) {
  .nav-toggle {
    display: flex;
  }

  .site-nav {
    flex-basis: 100%;
    width: 100%;
    order: 3;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;
  }

  .site-header.is-nav-open .site-nav {
    max-height: min(70vh, 520px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .site-nav ul {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0;
    padding: 0.25rem 0 0.75rem;
  }

  .site-nav ul li a {
    border-bottom: 1px solid #eee;
    padding: 0.9rem 0.25rem;
    min-height: 48px;
  }
}

.hero {
  background: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)),
    url('https://images.unsplash.com/photo-1520250497591-112f2f40a3f4?w=1920&q=80');
  background-size: cover;
  background-position: center;
  min-height: min(80vh, 900px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: var(--white);
  text-align: center;
  padding: 1.5rem max(16px, env(safe-area-inset-left)) 2rem max(16px, env(safe-area-inset-right));
  padding-bottom: max(2rem, env(safe-area-inset-bottom));
}

.hero h1 {
  font-size: clamp(1.75rem, 4vw, 3rem);
  margin-bottom: 1rem;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.hero p {
  font-size: clamp(1rem, 2.8vw, 1.2rem);
  margin-bottom: 1.5rem;
  max-width: 640px;
}

.booking-bar {
  background: var(--white);
  padding: 16px;
  border-radius: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  width: 100%;
  max-width: 1000px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  color: var(--dark2);
}

.booking-bar div {
  display: flex;
  flex-direction: column;
}

.booking-bar label {
  font-size: 0.8rem;
  font-weight: bold;
  margin-bottom: 5px;
  color: var(--primary);
}

.booking-bar input,
.booking-bar select {
  padding: 12px 10px;
  min-height: 48px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-family: inherit;
  font-size: 1rem;
  width: 100%;
}

.btn-search {
  background: var(--secondary);
  color: white;
  border: none;
  cursor: pointer;
  font-weight: bold;
  transition: 0.3s;
  padding: 14px 16px;
  min-height: 48px;
  border-radius: 6px;
  font-family: inherit;
  align-self: stretch;
  width: 100%;
  touch-action: manipulation;
}

.btn-search:hover {
  background: #b08d48;
}

@media (min-width: 641px) {
  .btn-search {
    width: auto;
    align-self: end;
  }
}

.btn-search:disabled {
  opacity: 0.6;
  cursor: wait;
}

@media (max-width: 540px) {
  .booking-bar {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .booking-bar input,
  .booking-bar select {
    font-size: 16px;
  }
}

.section-title {
  text-align: center;
  margin: 2.5rem 0 1.25rem;
  padding: 0 max(4%, env(safe-area-inset-left)) 0 max(4%, env(safe-area-inset-right));
}

.section-title h2 {
  color: var(--primary);
  font-size: clamp(1.35rem, 4vw, 2rem);
}

.categories {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 16px;
  padding: 0 max(4%, env(safe-area-inset-left)) 0 max(4%, env(safe-area-inset-right));
  margin-bottom: 3rem;
}

.card {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  min-height: 220px;
  height: clamp(220px, 42vw, 300px);
  cursor: pointer;
  display: block;
  text-decoration: none;
  color: inherit;
  touch-action: manipulation;
}

.card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: 0.5s;
}

.card:hover img {
  transform: scale(1.1);
}

.card-info {
  position: absolute;
  bottom: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
  width: 100%;
  padding: 20px;
  color: white;
}

.search-results {
  padding: 0 max(4%, env(safe-area-inset-left)) 3rem max(4%, env(safe-area-inset-right));
  max-width: 1200px;
  margin: 0 auto;
}

.search-results h2 {
  color: var(--primary);
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  gap: 1.25rem;
}

.result-card {
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  background: var(--white);
  transition: transform 0.2s, box-shadow 0.2s;
}

.result-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
}

.result-card a {
  text-decoration: none;
  color: inherit;
}

.result-card-img {
  height: 180px;
  background: var(--light) center/cover;
  position: relative;
}

.result-card-body {
  padding: 1rem 1.25rem 1.25rem;
}

.result-card-body h3 {
  color: var(--primary);
  font-size: 1.1rem;
  margin-bottom: 0.35rem;
}

.result-meta {
  font-size: 0.85rem;
  color: #666;
  margin-bottom: 0.5rem;
}

.result-price {
  color: var(--secondary);
  font-weight: 700;
  font-size: 1.05rem;
}

.badge-type {
  position: absolute;
  top: 10px;
  left: 10px;
  background: var(--primary);
  color: white;
  font-size: 0.7rem;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  text-transform: uppercase;
}

.empty-results {
  text-align: center;
  padding: 2rem;
  color: #666;
  background: var(--light);
  border-radius: 8px;
}

.property-detail {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem max(4%, env(safe-area-inset-left)) 3rem max(4%, env(safe-area-inset-right));
  padding-bottom: max(3rem, env(safe-area-inset-bottom));
}

.property-detail h1 {
  color: var(--primary);
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  margin-bottom: 0.5rem;
}

.property-sub {
  color: var(--primary2);
  margin-bottom: 1.5rem;
  font-size: 1rem;
}

.gallery-main {
  width: 100%;
  aspect-ratio: 16/9;
  max-height: 420px;
  object-fit: cover;
  border-radius: 12px;
  background: var(--light);
  cursor: pointer;
}

@media (min-width: 768px) {
  .gallery-main {
    aspect-ratio: 21/9;
  }
}

.gallery-thumbs {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 6px;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
}

.gallery-thumbs button {
  padding: 0;
  border: 3px solid transparent;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  width: 88px;
  height: 66px;
  flex-shrink: 0;
  scroll-snap-align: start;
  touch-action: manipulation;
}

.gallery-thumbs button.active {
  border-color: var(--secondary);
}

.gallery-thumbs img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.property-desc {
  margin: 2rem 0;
  line-height: 1.75;
  color: #444;
}

.amenities {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0 2rem;
}

.amenities span {
  background: var(--light);
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  font-size: 0.85rem;
  color: var(--dark2);
}

.rooms-section h2 {
  color: var(--primary);
  margin-bottom: 1rem;
  font-size: 1.35rem;
}

.room-list {
  display: grid;
  gap: 1rem;
}

.room-item {
  display: grid;
  grid-template-columns: 140px 1fr auto;
  gap: 1rem;
  align-items: center;
  padding: 1rem;
  border: 1px solid #eee;
  border-radius: 10px;
}

.room-item img {
  width: 140px;
  height: 100px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--light);
}

.room-item h4 {
  color: var(--primary);
  margin-bottom: 0.25rem;
}

.room-price {
  font-weight: 700;
  color: var(--secondary);
  white-space: nowrap;
}

.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.lightbox.open {
  display: flex;
}

.lightbox img {
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
}

.lightbox-close {
  position: absolute;
  top: max(1rem, env(safe-area-inset-top));
  right: max(1rem, env(safe-area-inset-right));
  color: white;
  font-size: 1.75rem;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.35);
  border: none;
  line-height: 1;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
}

footer {
  background: var(--primary);
  color: white;
  padding: 2.5rem max(4%, env(safe-area-inset-left)) max(2rem, env(safe-area-inset-bottom)) max(4%, env(safe-area-inset-right));
  text-align: center;
}

.footer-cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 40px;
  margin-bottom: 2rem;
  text-align: left;
}

.footer-cols h4 {
  margin-bottom: 1.5rem;
  color: var(--secondary);
}

.footer-cols p,
.footer-cols a {
  color: #ccc;
  text-decoration: none;
  font-size: 0.9rem;
}

.copy {
  border-top: 1px solid #444;
  padding-top: 2rem;
  font-size: 0.8rem;
}

.page-content {
  padding: 2rem max(5%, env(safe-area-inset-left)) 4rem max(5%, env(safe-area-inset-right));
  max-width: 800px;
  margin: 0 auto;
}

.page-content h1 {
  color: var(--primary);
  margin-bottom: 1rem;
}

.contact-list {
  list-style: none;
  line-height: 1.8;
}

.contact-list li {
  padding: 0.35rem 0;
}

.contact-list a {
  display: inline-block;
  min-height: 44px;
  line-height: 44px;
  padding: 0 0.15rem;
  color: var(--primary2);
  font-weight: 600;
}

.btn-search-inline {
  display: inline-block;
  text-decoration: none;
  padding: 0.75rem 1.5rem;
  margin-top: 0.5rem;
  text-align: center;
}

@media (max-width: 480px) {
  .btn-search-inline {
    display: block;
    width: 100%;
  }
}

.integraciones {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem max(5%, env(safe-area-inset-left)) 4rem max(5%, env(safe-area-inset-right));
}

.integraciones h1 {
  color: var(--primary);
  margin-bottom: 1rem;
}

.integraciones h2 {
  color: var(--dark2);
  margin: 2rem 0 0.75rem;
  font-size: 1.2rem;
}

.integraciones code,
.integraciones pre {
  background: var(--light);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.9rem;
  word-break: break-all;
}

.integraciones pre {
  display: block;
  padding: 1rem;
  overflow-x: auto;
  margin: 0.75rem 0;
}

/* Admin */
.admin-body {
  background: #f0f2f5;
  min-height: 100vh;
}

.admin-header {
  background: var(--primary);
  color: white;
  padding: 0.65rem max(4%, env(safe-area-inset-left)) 0.65rem max(4%, env(safe-area-inset-right));
  padding-top: max(0.65rem, env(safe-area-inset-top));
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
}

.admin-header .admin-logo {
  display: flex;
  align-items: center;
  min-height: 44px;
  background: rgba(255, 255, 255, 0.98);
  padding: 0.3rem 0.65rem;
  border-radius: 8px;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.12);
}

.admin-header .admin-logo img {
  height: 38px;
  width: auto;
  max-width: 220px;
  object-fit: contain;
}

.admin-header a {
  color: var(--secondary);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0;
}

.admin-header .admin-header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
}

.admin-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 5%;
}

.admin-card {
  background: white;
  border-radius: 10px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.admin-card h2 {
  color: var(--primary);
  margin-bottom: 1rem;
  font-size: 1.2rem;
}

.admin-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.admin-form-grid label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--dark2);
}

.admin-form-grid input,
.admin-form-grid select,
.admin-form-grid textarea {
  padding: 0.5rem 0.65rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-family: inherit;
}

.admin-form-grid textarea {
  min-height: 80px;
  grid-column: 1 / -1;
}

.admin-form-grid .full {
  grid-column: 1 / -1;
}

.btn-admin {
  background: var(--secondary);
  color: white;
  border: none;
  padding: 0.65rem 1.25rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-family: inherit;
}

.btn-admin:hover {
  background: #b08d48;
}

.btn-admin.secondary {
  background: var(--primary2);
}

.btn-danger {
  background: #a33;
  color: white;
  border: none;
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.admin-table th,
.admin-table td {
  text-align: left;
  padding: 0.65rem 0.5rem;
  border-bottom: 1px solid #eee;
}

.admin-table th {
  color: var(--primary);
  font-weight: 600;
}

.photo-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.photo-chips span {
  background: var(--light);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.login-box {
  max-width: 400px;
  margin: 4rem auto;
  padding: 2rem;
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.login-box h1 {
  color: var(--primary);
  margin-bottom: 1.5rem;
  text-align: center;
}

.login-box label {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 600;
  font-size: 0.9rem;
}

.login-box input {
  width: 100%;
  padding: 0.75rem 0.65rem;
  min-height: 48px;
  margin-bottom: 1rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 16px;
}

.login-logo {
  display: block;
  margin: 0 auto 1.25rem;
  height: 48px;
  width: auto;
  max-width: 240px;
}

.login-error {
  color: #c00;
  font-size: 0.9rem;
  margin-bottom: 1rem;
  display: none;
}

.btn-login-submit {
  width: 100%;
  min-height: 48px;
  font-size: 1rem;
  touch-action: manipulation;
}

@media (max-width: 768px) {
  .room-item {
    grid-template-columns: 1fr;
  }

  .room-item img {
    width: 100%;
    height: 160px;
  }

  .room-price {
    justify-self: start;
  }

  .result-card:active {
    transform: scale(0.99);
  }

  .admin-wrap {
    padding: 1rem max(4%, env(safe-area-inset-left)) 2rem max(4%, env(safe-area-inset-right));
  }

  .admin-form-grid input,
  .admin-form-grid select,
  .admin-form-grid textarea {
    font-size: 16px;
    min-height: 48px;
  }

  .admin-form-grid textarea {
    min-height: 100px;
  }

  .btn-admin,
  .btn-danger {
    min-height: 44px;
    padding: 0.65rem 1rem;
  }

  .admin-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .login-box {
    margin: 2rem 1rem;
    padding: 1.5rem;
  }
}
