.apartment-detail {
  padding: 2rem 0;
}

.detail-header {
  text-align: center;
  margin-bottom: 2rem;
}

.detail-title {
  font-size: 3rem;
  font-weight: bold;
  margin-bottom: 1rem;
}

.detail-location {
  font-size: 1.25rem;
  color: #666;
  margin-bottom: 1rem;
}

.detail-badges {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.detail-badge {
  background: #f1f5f9;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.9rem;
}

.gallery-container {
  margin-bottom: 3rem;
}

.main-photo {
  position: relative;
  width: 100%;
  aspect-ratio:6/3;
  border-radius: 12px;
  overflow: hidden;
  contain: layout paint size;
  cursor: pointer;
}
#mainPhoto picture.layer{
  position:absolute;
  inset:0;
  display: block;
  width:100%;
  height:100%;
  opacity:0;
  transition: opacity .45s ease;
  z-index: 0;
  pointer-events: none;
}
#mainPhoto picture.layer.current { opacity: 1; z-index: 2; }
#mainPhoto picture.layer.exiting { opacity: 1; z-index: 1; }
/* blur se jen rozmaže, bez animace filtru/transformu */
.main-photo picture.layer.blur img {
  filter: blur(14px);
  transform: scale(1.02);
}

/* tahle třída vypne přechod (preview se objeví hned a drží) */
.main-photo picture.layer.pin,
.main-photo picture.layer.pin img {
  transition: none !important;
}

#mainPhoto img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
#mainPhoto picture.layer.blur img {
  filter: blur(14px);
  transform: scale(1.02);
}

#mainPhoto .preview-overlay {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: blur(8px);
  transform: scale(1.02);
  opacity: 0;
  pointer-events: none;
  transition:
          filter 0.4s ease,
          opacity 0.4s ease;
}
#mainPhoto .preview-overlay.show {
  opacity: 1;
  filter: blur(8px); /* při zobrazení začíná rozmazané */
}
#mainPhoto .preview-overlay.fade-out {
  opacity: 0;
  filter: blur(0px); /* plynule mizí a zároveň se ostří */
}

.main-photo img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.main-photo:hover img {
  transform: scale(1.05);
}

.main-photo .photo-counter {
  position: absolute;
  bottom: 1rem;
  right: 1rem;
  background: rgba(0,0,0,0.7);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.9rem;
  z-index: 5;
}

.thumbnail-row {
  display: flex;
  gap: 10px;
  flex-wrap: nowrap;
  overflow-x: auto;       /* scroll jen vodorovně */
  overflow-y: hidden;     /* skryje svislé přetečení při hoveru */
  padding: 0.5rem 0;      /* trochu místa kolem, aby se scale neusekl */
}

.thumbnail {
  flex: 0 0 160px;       /* NEzmenšuj, základ 150 px */
  width: 150px;
  height: 100px;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.3s ease;
}

.thumbnail.active {
  border-color: #2563eb;
}

.thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.thumbnail:hover {
  transform: scale(1.05);
}

.view-all-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 150px;
  height: 100px;
  background: rgba(37, 99, 235, 0.1);
  border: 2px dashed #2563eb;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.view-all-btn:hover {
  background: rgba(37, 99, 235, 0.2);
  transform: scale(1.05);
}

.view-all-btn span {
  color: #2563eb;
  font-size: 0.9rem;
  text-align: center;
  padding: 0.5rem;
}

/* Modal thumbnails updated */
.modal-thumb {
  width: 80px;
  height: 60px;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.modal-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/* All photos grid updated */
.all-photos-item img {
  width: 100%;
  height: 250px;
  object-fit: cover;
  object-position: center;
}

@media (max-width: 768px) {
  .main-photo {
    height: 300px;
  }

  .thumbnail {
    width: 120px;
    height: 80px;
  }

  .view-all-btn {
    width: 120px;
    height: 80px;
  }

  .modal-thumb {
    width: 60px;
    height: 45px;
  }

  .all-photos-item img {
    height: 200px;
  }
}

.content-grid {
  margin-bottom: 3rem;
}

.detail-card {
  background: white;
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  margin-bottom: 2rem;
}

.detail-card h2 {
  font-size: 1.5rem;
  font-weight: bold;
  margin-bottom: 1rem;
}

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

.feature-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.booking-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
}

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

.form-group input,
.form-group select,
.form-group textarea {
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 1rem;
  font-family: inherit;
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: #666;
  text-decoration: none;
  margin-bottom: 2rem;
  transition: color 0.3s ease;
}

.back-link:hover {
  color: #2563eb;
}

/* Modal styles */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.7);
}

.modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  position: relative;
  width: 90vw;
  height: 85vh;
  max-width: 1200px;
  display: flex;
  flex-direction: column;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0,0,0,0.3);
}

.modal-image-container {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  background: #f8f9fa;
}

.modal-content img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
}

.modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  color: #666;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  z-index: 20;
  background: white;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  border: 1px solid #eee;
}

.modal-close:hover {
  color: #333;
  background: #f8f9fa;
}

.modal-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,0.6);
  color: white;
  border: none;
  font-size: 24px;
  padding: 10px 15px;
  cursor: pointer;
  border-radius: 5px;
}

.modal-nav:hover {
  background: rgba(0,0,0,0.8);
}

.modal-nav.prev {
  left: 20px;
}

.modal-nav.next {
  right: 20px;
}

/* Modal thumbnails */
.modal-thumbnails {
  flex-shrink: 0;
  padding: 15px 0;
  border-top: 1px solid #eee;
  background: white;
}

.modal-thumbnail-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 0;
  margin: 0 15px 10px 15px;
  justify-content: flex-start;
}

.modal-thumbnail-strip::-webkit-scrollbar {
  height: 6px;
}

.modal-thumbnail-strip::-webkit-scrollbar-track {
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
}

.modal-thumbnail-strip::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.3);
  border-radius: 3px;
}

.modal-thumb {
  width: 150px;
  height: 100px;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.modal-thumb.active {
  border-color: #2563eb;
}

.modal-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.modal-thumb:hover {
  transform: scale(1.05);
}

/* All Photos Grid Modal */
.all-photos-content {
  background: white;
  border-radius: 12px;
  width: 95vw;
  height: 90vh;
  max-width: 1400px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}

.all-photos-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2rem;
  border-bottom: 1px solid #eee;
}

.all-photos-header h2 {
  margin: 0;
  font-size: 1.5rem;
  color: #333;
}

.all-photos-header .modal-close {
  position: static;
  color: #666;
  font-size: 24px;
  background: none;
  width: auto;
  height: auto;
  border-radius: 0;
}

.all-photos-header .modal-close:hover {
  color: #333;
  background: none;
}

.all-photos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
  padding: 2rem;
  overflow-y: auto;
}

.all-photos-item {
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.3s ease;
  height: 250px;
}

.all-photos-item:hover {
  transform: scale(1.02);
}

.all-photos-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

@media (max-width: 768px) {
  .modal-thumbnails {
    max-width: 95%;
  }

  .modal-thumb {
    width: 50px;
    height: 50px;
  }

  .all-photos-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    padding: 1rem;
  }

  .all-photos-item img {
    height: 200px;
  }
}

/* Gallery Header */
.gallery-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding: 1.5rem 0;
  border-bottom: 1px solid #eee;
}

.gallery-title h2 {
  margin: 0;
  font-size: 1.8rem;
  font-weight: bold;
  color: #333;
}

.gallery-title p {
  margin: 0.5rem 0 0 0;
  color: #666;
  font-size: 1rem;
}

.gallery-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.gallery-contact-link {
  color: #2563eb;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s ease;
}

.gallery-contact-link:hover {
  color: #1d4ed8;
  text-decoration: underline;
}

@media (max-width: 768px) {
  .gallery-header {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

  .gallery-actions {
    flex-direction: column;
    width: 100%;
  }
}

/* Modal Header */
.modal-header {
  padding: 1.5rem 4rem 1.5rem 2rem;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  background: white;
}

.modal-title h3 {
  margin: 0;
  color: #333;
  font-size: 1.5rem;
  font-weight: bold;
}

.modal-title p {
  margin: 0.5rem 0 0 0;
  color: #666;
  font-size: 0.9rem;
}

.modal-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.modal-contact-link {
  color: #2563eb;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s ease;
}

.modal-contact-link:hover {
  color: #1d4ed8;
  text-decoration: underline;
}

@media (max-width: 768px) {
  .modal-header {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
    padding: 1rem;
  }

  .modal-actions {
    flex-direction: column;
    width: 100%;
  }
}


.video-wrap {
  aspect-ratio: 4/3;
  position: relative;
  width: 168px;
  max-width: 800px;
  overflow: hidden;
}
.video-wrap > video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 15%;
  display:block;
}

.video-thumb {
  width: 100%;
  cursor: pointer;
  border-radius: 8px;
  display: block;
  background:#000;
}

.video-wrap .play-overlay {
  position: absolute;
  top: 45%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 50%;         /* velikost šipky */
  max-width: 120px;
  cursor: pointer;
  pointer-events: none; /* jen vizuální, klik chytá video-wrap */
}

.video-wrap .video-title {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: .6rem 1rem;
  background: linear-gradient(to top, rgba(0,0,0,0.7), rgba(0,0,0,0));
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0,0,0,0.7);
  box-sizing: border-box;
  text-align: center;
  border-radius: 8px;
}

/* ---------- modal ---------- */
#videoModal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,.85);
  justify-content: center;
  align-items: center;
  padding: 2rem;
}
#videoModal.open { display: flex; }
#videoModal .dialog {
  position: relative;
  width: min(1200px, 95vw);
  max-height: 90vh;
}
#videoModal video {
  width: 100%;
  max-height: 90vh;
  display: block;
  background:#000;
  border-radius: 12px;
  box-shadow: 0 0 20px #000;
}
#videoModal .close {
  position: absolute; inset: -12px -12px auto auto;
  width: 44px; height: 44px; line-height: 44px;
  text-align: center;
  font-size: 28px; color: #fff; cursor: pointer;
  background: rgba(0,0,0,.5);
  border-radius: 50%;
  user-select: none;
}


.flex-row {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  align-items: flex-start;
  align-content: flex-start;

}

.flex-row .flex-main {
  flex: 1;
}

.flex-row .flex-side {
  flex: 0 0 auto;
}

@media (max-width: 768px) {
  .flex-row {
    flex-direction: column;
  }

  .flex-row .flex-side {
    flex: none;
    width: 100%; /* zabere celou šířku */
  }
}
