@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
  --transition-speed: 0.6s;
  --easing: cubic-bezier(0.25, 1, 0.5, 1);
  --bg-color: #0f172a;
  --text-color: #ffffff;
  --text-muted: #94a3b8;
  --accent-color: #E7B544;
  --accent-glow: rgba(231, 181, 68, 0.5);
  --border-color: rgba(255, 255, 255, 0.1);
  --badge-bg: rgba(255, 255, 255, 0.1);
  --info-panel-bg: rgba(15, 23, 42, 0.6);
}

/* Brightness contrast adaptation classes set by JS */
.theme-light {
  --text-color: #0f172a;
  --text-muted: #475569;
  --border-color: rgba(0, 0, 0, 0.1);
  --badge-bg: rgba(0, 0, 0, 0.05);
  --info-panel-bg: rgba(255, 255, 255, 0.7);
}

.theme-dark {
  --text-color: #ffffff;
  --text-muted: #94a3b8;
  --border-color: rgba(255, 255, 255, 0.1);
  --badge-bg: rgba(255, 255, 255, 0.1);
  --info-panel-bg: rgba(15, 23, 42, 0.6);
}

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

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  transition: background-color 1.5s ease;
  user-select: none;
}

/* Outer layout container */
.app-container {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  box-sizing: border-box;
}

/* ==========================================================================
   SECTOR M: Main Image Viewer
   ========================================================================== */
.sector-m {
  grid-column: 1;
  grid-row: 1;
  position: relative;
  overflow: hidden;
  border-right: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  background-color: #000;
}

.main-image-container {
  width: 100%;
  height: 100%;
  position: relative;
}

.main-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0;
  transform: scale(1);
  transition: opacity 0.8s ease-in-out;
  z-index: 1;
}

.main-image.active {
  opacity: 1;
  z-index: 2;
}

/* Soft Zoom Animation class */
.zoom-active {
  animation: softZoom var(--zoom-duration, 5s) linear forwards;
}

@keyframes softZoom {
  from {
    transform: scale(1);
  }
  to {
    transform: scale(1.08);
  }
}

/* ==========================================================================
   SECTOR L: Thumbnail Column (L1, L2, L3)
   ========================================================================== */
.sector-l {
  grid-column: 2;
  grid-row: 1;
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--border-color);
  background-color: rgba(0, 0, 0, 0.2);
}

.thumbnail-slider {
  display: flex;
  flex-direction: column;
  height: 134.5%; /* Slightly taller to push the bottom border of the 3rd thumbnail into the overflow clip area, avoiding double lines */
  width: 100%;
  transition: none; /* Reset state has no transition */
}

/* Dynamic shifting transition */
.thumbnail-slider.shift-up {
  transition: transform var(--transition-speed) var(--easing);
  transform: translateY(-25%); /* Shift up by exactly 1 thumbnail's height (since there are 4, 1/4 = 25%) */
}

.thumb-card {
  height: 25%; /* 1/4th of slider container */
  width: 100%;
  padding: 10px;
  box-sizing: border-box;
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--border-color);
}

.thumb-card-inner {
  width: 100%;
  height: 100%;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  border: 2px solid transparent;
  transition: border-color 0.3s ease;
}

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

/* ==========================================================================
   SECTOR A: Company Logo Area
   ========================================================================== */
.sector-a {
  grid-column: 1;
  grid-row: 2;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid var(--border-color);
  padding: 20px;
  box-sizing: border-box;
  background-color: rgba(0, 0, 0, 0.1);
}

.logo-wrapper {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.logo-img {
  max-width: 90%;
  max-height: 85%;
  object-fit: contain;
}

/* Fallback Logo Style (when logo.png is missing or fails) */
.fallback-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: 'Outfit', sans-serif;
  color: var(--text-color);
  text-align: center;
}

.fallback-logo .icon {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -1px;
  color: var(--accent-color);
  margin-bottom: 2px;
  text-shadow: 0 0 15px var(--accent-glow);
  display: flex;
  align-items: center;
  gap: 6px;
}

.fallback-logo .brand-name {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.fallback-logo .tagline {
  font-size: 0.65rem;
  font-weight: 400;
  letter-spacing: 3px;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* ==========================================================================
   SECTOR B: Property Information Panel
   ========================================================================== */
.row-top {
  display: flex;
  height: 75%;
  width: 100%;
}

.row-bottom {
  display: flex;
  height: 25%;
  width: 100%;
  border-top: 1px solid var(--border-color);
  position: relative; /* Create relative stacking context */
  z-index: 10;        /* Stack border and panel above top-row images */
}

.sector-m {
  width: 78%;
  height: 100%;
}

.sector-l {
  width: 22%;
  height: 100%;
}

.sector-a {
  width: 20%;
  height: 100%;
  border-right: 1px solid var(--border-color);
}

.sector-b {
  width: 80%;
  height: 100%;
  padding: 10px 20px 0px 20px; /* Shifted top padding to 20px to prevent border overlap */
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: flex-start; /* Align text block to the top instead of centering */
  background-color: var(--info-panel-bg);
  backdrop-filter: blur(10px);
  position: relative;
  gap: 8px; /* Use flexbox gap to control vertical spacing cleanly */
}

/* Layout within Info Panel B */
.info-header {
  display: flex;
  justify-content: space-between;
  align-items: center; /* Align title and price tag vertically centered */
}

.property-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1.2; /* Restored to standard line-height for clean alignment */
}

.price-tag {
  font-family: 'Outfit', sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent-color);
  text-shadow: 0 0 10px var(--accent-glow);
  white-space: nowrap;
  line-height: 1.2; /* Set matching line-height for baseline text alignment */
}

.badge-row {
  display: flex;
  gap: 10px;
}

.badge {
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 2px 12px;
  border-radius: 12px;
  background-color: var(--badge-bg);
  border: 1px solid var(--border-color);
}

.badge.operation {
  background-color: var(--accent-color);
  color: #ffffff;
  border: none;
}

.property-description {
  font-size: 0.8rem;
  line-height: 1.1;
  color: var(--text-muted);
  max-width: 100%;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Status indicator for offline reload sync */
.sync-status {
  position: absolute;
  top: 15px;
  right: 30px;
  font-size: 0.7rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
  opacity: 0.7;
}

.sync-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #10b981; /* Green for online */
}

.sync-dot.offline {
  background-color: #ef4444; /* Red for offline */
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% { opacity: 0.4; }
  50% { opacity: 1; }
  100% { opacity: 0.4; }
}

/* ==========================================================================
   PROPERTY CHANGE CURTAIN TRANSITION
   ========================================================================== */
.curtain-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 100;
  pointer-events: none;
  display: flex;
  flex-direction: column;
}

.curtain-top, .curtain-bottom {
  width: 100%;
  height: 50%;
  background-color: #090d16;
  position: absolute;
  transition: transform 0.6s cubic-bezier(0.77, 0, 0.175, 1);
}

.curtain-top {
  top: 0;
  transform: translateY(-100%);
  border-bottom: 2px solid var(--accent-color);
}

.curtain-bottom {
  bottom: 0;
  transform: translateY(100%);
  border-top: 2px solid var(--accent-color);
}

.curtain-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  z-index: 110;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
  width: 80%;
  height: 320px;
  display: flex;
  flex-direction: column;
}

.curtain-content-top {
  height: 50%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding-bottom: 25px;
  box-sizing: border-box;
}

.curtain-content-bottom {
  height: 50%;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding-top: 25px;
  box-sizing: border-box;
}

.curtain-content .curtain-operation {
  font-size: 1rem;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--accent-color);
  font-weight: 700;
  margin-bottom: 8px;
}

.curtain-content .curtain-title {
  font-family: 'Outfit', sans-serif;
  font-size: 2.8rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 0;
  letter-spacing: -1px;
  line-height: 1.2;
}

.curtain-content .curtain-price {
  font-family: 'Outfit', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  color: #ffffff;
  opacity: 0.9;
}

/* Curtain active states */
.curtain-overlay.active .curtain-top {
  transform: translateY(0);
}

.curtain-overlay.active .curtain-bottom {
  transform: translateY(0);
}

.curtain-overlay.active .curtain-content {
  opacity: 1;
  transition-delay: 0.5s;
}

/* ==========================================================================
   PORTRAIT / RESPONSIVE LAYOUT
   ========================================================================== */
@media (orientation: portrait) {
  .app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
  }
  
  .row-top {
    flex-direction: column;
    height: 68%; /* Increased from 60% to give images more space */
  }
  
  .sector-m {
    width: 100%;
    height: 75%; /* Main image takes larger vertical space */
  }
  
  .sector-l {
    width: 100%;
    height: 25%; /* Thumbs are horizontal at bottom of top section */
  }
  
  .thumbnail-slider {
    flex-direction: row;
    height: 100%;
    width: 134.5%; /* Slightly wider to push the right border of the 3rd thumbnail into the overflow clip area, avoiding double lines */
  }
  
  .thumbnail-slider.shift-up {
    transform: translateX(-25%); /* Slide left instead of up */
  }
  
  .thumb-card {
    height: 100%;
    width: 25%; /* 1/4th of horizontal width */
    padding: 6px;
    border-bottom: none;
    border-right: 1px solid var(--border-color);
  }
  
  .row-bottom {
    flex-direction: column;
    height: 32%; /* Reduced from 40% to fit details and logo tighter */
    border-top: 1px solid var(--border-color);
  }
  
  .sector-a {
    width: 100%;
    height: 20%; /* Reduced from 30% to fit tighter */
    order: 2; /* Put logo below details */
    border-right: none;
    border-top: 1px solid var(--border-color);
    padding: 4px 10px; /* Reduced from 10px to minimize vertical space */
  }
  
  .sector-a .logo-img {
    max-width: 50%;
    max-height: 80%; /* Increased max-height relative to smaller container */
  }
  
  .sector-b {
    width: 100%;
    height: 80%; /* Takes 80% of row-bottom */
    order: 1;
    padding: 10px 20px 0px 20px; /* Shifted top padding to 10px to prevent border overlap */
    gap: 4px; /* Added tighter gap for mobile to pull badges up closer to title */
    justify-content: flex-start; /* Align text block to the top in portrait too */
  }
  
  .property-title {
    font-size: 1.4rem;
  }
  
  .price-tag {
    font-size: 1.4rem;
  }
  
  .property-description {
    max-width: 100%;
    -webkit-line-clamp: 4;
    font-size: 0.85rem; /* Reduced from 1rem to fit better on smartphones */
    line-height: 1.5; /* Slightly tighter line height */
  }
}
