@import 'property-grid-updates.css';

/* Property Grid Component - 2025 Glass Cards */

.properties-section {
  padding: var(--space-24) 0;
  background: linear-gradient(180deg,
    rgba(255, 255, 255, 0.95) 0%,
    rgba(250, 250, 250, 0.98) 50%,
    rgba(245, 245, 245, 0.95) 100%
  );
  position: relative;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-16);
  flex-wrap: wrap;
  gap: var(--space-6);
  animation: section-header-slide 1s ease-out both;
}

@keyframes section-header-slide {
  0% {
    opacity: 0;
    transform: translateY(-30px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.section-header h2 {
  font-size: clamp(2.2rem, 4vw, 3.5rem);
  font-weight: var(--font-weight-black);
  color: var(--color-navy);
  margin: 0;
  line-height: 1.1;
}

.section-actions {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.filter-btn {
  padding: var(--space-3) var(--space-6);
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(10, 10, 10, 0.1);
  border-radius: var(--border-radius-full);
  font-family: var(--font-primary);
  font-weight: var(--font-weight-medium);
  font-size: 0.95rem;
  color: rgba(10, 10, 10, 0.8);
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-out-quart);
  position: relative;
  overflow: hidden;
}

.filter-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg,
    transparent,
    rgba(212, 175, 55, 0.1),
    transparent
  );
  transition: left var(--duration-slow) var(--ease-out-quart);
}

.filter-btn:hover::before {
  left: 100%;
}

.filter-btn:hover {
  background: rgba(255, 255, 255, 0.8);
  border-color: rgba(212, 175, 55, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

.filter-btn.active {
  background: linear-gradient(135deg,
    var(--color-primary) 0%,
    var(--color-primary-light) 100%
  );
  color: var(--color-white);
  border-color: var(--color-primary);
  box-shadow: 0 6px 20px rgba(212, 175, 55, 0.3);
}

.filter-btn.active:hover {
  background: linear-gradient(135deg,
    var(--color-primary-dark) 0%,
    var(--color-primary) 100%
  );
}

/* Properties Grid */
.properties-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
  gap: var(--space-10);
  margin-bottom: var(--space-16);
}

.property-card {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--border-radius-2xl);
  overflow: hidden;
  transition:
    transform var(--duration-normal) var(--ease-out-quart),
    background var(--duration-normal) var(--ease-out-quart),
    border-color var(--duration-normal) var(--ease-out-quart),
    backdrop-filter var(--duration-normal) var(--ease-out-quart),
    -webkit-backdrop-filter var(--duration-normal) var(--ease-out-quart),
    box-shadow var(--duration-normal) var(--ease-out-quart);
  box-shadow:
    0 10px 40px rgba(0, 0, 0, 0.08),
    inset 0 1px 2px rgba(255, 255, 255, 0.3);
  /* Animation will be triggered by JavaScript on scroll */
  position: relative;
  /* FIX FLASH: Start invisible to prevent flash */
  opacity: 0;
  transform: translateY(30px) scale(0.95);
}

/* Animation delays now handled by JavaScript scroll observer */

@keyframes property-card-fade {
  0% {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.property-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg,
    transparent,
    rgba(255, 255, 255, 0.6),
    transparent
  );
  transition: all var(--duration-normal) var(--ease-out-quart);
}

.property-card:hover {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(212, 175, 55, 0.2);
  transform: translateY(-12px) scale(1.02);
  box-shadow: 
    0 25px 80px rgba(0, 0, 0, 0.12),
    0 0 30px rgba(212, 175, 55, 0.1),
    inset 0 1px 2px rgba(255, 255, 255, 0.4);
}

.property-card:hover::before {
  background: linear-gradient(90deg,
    transparent,
    rgba(212, 175, 55, 0.6),
    transparent
  );
}

/* Property Image */
.property-image {
  position: relative;
  height: 280px;
  overflow: hidden;
}

.property-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: all var(--duration-slow) var(--ease-out-quart);
  filter: brightness(1) contrast(1.05);
}

.property-card:hover .property-image img {
  transform: scale(1.05);
  filter: brightness(1.05) contrast(1.1);
}

.property-badge {
  position: absolute;
  top: var(--space-4);
  left: var(--space-4);
  padding: var(--space-2) var(--space-4);
  background: rgba(212, 175, 55, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--color-white);
  font-family: var(--font-primary);
  font-weight: var(--font-weight-bold);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-radius: var(--border-radius-md);
  box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
  animation: badge-pulse 2s ease-in-out infinite alternate;
}

@keyframes badge-pulse {
  0% { box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3); }
  100% { box-shadow: 0 6px 20px rgba(212, 175, 55, 0.5); }
}

.property-favorite {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  width: 45px;
  height: 45px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  color: rgba(10, 10, 10, 0.6);
  font-size: 1.1rem;
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-out-quart);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.property-favorite:hover {
  background: rgba(230, 57, 70, 0.9);
  color: var(--color-white);
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(230, 57, 70, 0.3);
}

.property-favorite.active {
  background: rgba(230, 57, 70, 0.9);
  color: var(--color-white);
}

/* Property Content */
.property-content {
  padding: var(--space-8);
}

.property-title {
  font-size: 1.4rem;
  font-weight: var(--font-weight-bold);
  color: var(--color-navy);
  margin-bottom: var(--space-3);
  line-height: 1.3;
}

.property-location {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.95rem;
  color: rgba(10, 10, 10, 0.7);
  margin-bottom: var(--space-4);
  font-weight: var(--font-weight-medium);
}

.property-location i {
  color: var(--color-primary);
  font-size: 0.9em;
}

.property-description {
  font-size: 0.95rem;
  line-height: 1.6;
  color: rgba(10, 10, 10, 0.8);
  margin-bottom: var(--space-6);
  min-height: 4.8em; /* Ensure consistent height for truncated text */
}

.read-more {
  color: var(--color-primary);
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s;
}

.read-more:hover {
  color: var(--color-primary-dark);
  text-decoration: underline;
}

/* Description Modal */
.desc-modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.desc-modal-overlay.active {
  opacity: 1;
}

.desc-modal-content {
  background: white;
  padding: 0; /* Reset padding */
  border-radius: 16px;
  max-width: 500px;
  width: 90%;
  position: relative;
  box-shadow: 0 20px 50px rgba(0,0,0,0.3);
  transform: translateY(20px);
  transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
  overflow: hidden; /* Clip header image */
}

.desc-modal-header {
  height: 150px;
  background-size: cover;
  background-position: center;
  position: relative;
  display: flex;
  align-items: flex-end;
  padding: 1.5rem;
}

.desc-modal-header-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0), rgba(0,0,0,0.7));
}

.desc-modal-header h3 {
  color: white;
  font-size: 1.5rem;
  font-weight: 700;
  position: relative;
  z-index: 1;
  margin: 0;
  text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

.desc-modal-text {
  padding: 2rem; /* Move padding here */
  font-size: 1.1rem;
  line-height: 1.7;
  color: #333;
  /* Scrollable Content Logic */
  max-height: 60vh; /* Limit height relative to viewport */
  overflow-y: auto; /* Enable vertical scrolling */
  /* Custom Scrollbar */
  scrollbar-width: thin;
  scrollbar-color: var(--color-primary) transparent;
}

.desc-modal-text::-webkit-scrollbar {
  width: 6px;
}

.desc-modal-text::-webkit-scrollbar-track {
  background: transparent;
}

.desc-modal-text::-webkit-scrollbar-thumb {
  background-color: var(--color-primary);
  border-radius: 20px;
}

.desc-modal-close {
  position: absolute;
  top: 15px;
  right: 15px;
  background: rgba(0,0,0,0.3);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  cursor: pointer;
  color: white;
  transition: all 0.2s;
  z-index: 10;
}

.desc-modal-close:hover {
  background: rgba(0,0,0,0.6);
  transform: scale(1.1);
}

.property-details {
  display: flex;
  gap: var(--space-8);
  margin-bottom: var(--space-6);
  padding: var(--space-4) 0;
  border-top: 1px solid rgba(10, 10, 10, 0.08);
  border-bottom: 1px solid rgba(10, 10, 10, 0.08);
}

.property-spec {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.spec-label {
  font-size: 0.8rem;
  color: rgba(10, 10, 10, 0.6);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: var(--font-weight-medium);
}

.spec-value {
  font-size: 1rem;
  font-weight: var(--font-weight-bold);
  color: var(--color-navy);
}

.property-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
}

.property-price {
  font-family: var(--font-primary);
  font-size: 1.8rem;
  font-weight: var(--font-weight-black);
  color: var(--color-navy);
}

.property-cta {
  padding: var(--space-4) var(--space-8);
  background: rgba(10, 10, 10, 0.05);
  border: 1px solid rgba(10, 10, 10, 0.1);
  border-radius: var(--border-radius-full);
  font-family: var(--font-primary);
  font-weight: var(--font-weight-semibold);
  font-size: 0.95rem;
  color: var(--color-navy);
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-out-quart);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}

.property-cta::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg,
    transparent,
    rgba(212, 175, 55, 0.1),
    transparent
  );
  transition: left var(--duration-slow) var(--ease-out-quart);
}

.property-cta:hover::before {
  left: 100%;
}

.property-cta:hover {
  background: var(--color-primary);
  color: var(--color-white);
  border-color: var(--color-primary);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(212, 175, 55, 0.3);
}

/* Load More Section */
.load-more-section {
  text-align: center;
  animation: load-more-fade 1s ease-out 0.8s both;
}

@keyframes load-more-fade {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.load-more-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-5) var(--space-10);
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 1px solid rgba(212, 175, 55, 0.3);
  border-radius: var(--border-radius-full);
  font-family: var(--font-primary);
  font-weight: var(--font-weight-semibold);
  font-size: 1.1rem;
  color: var(--color-navy);
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-out-quart);
  position: relative;
  overflow: hidden;
}

.load-more-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg,
    transparent,
    rgba(212, 175, 55, 0.15),
    transparent
  );
  transition: left var(--duration-slow) var(--ease-out-quart);
}

.load-more-btn:hover::before {
  left: 100%;
}

.load-more-btn:hover {
  background: rgba(212, 175, 55, 0.1);
  border-color: var(--color-primary);
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 10px 30px rgba(212, 175, 55, 0.2);
}

.load-more-btn i {
  transition: all var(--duration-normal) var(--ease-bounce);
}

.load-more-btn:hover i {
  transform: scale(1.1) rotate(90deg);
}

/* Responsive Design */
@media (max-width: 968px) {
  .properties-grid {
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: var(--space-8);
  }
  
  .section-header {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }
  
  .section-actions {
    justify-content: center;
  }
}

@media (max-width: 768px) {
  .properties-section {
    padding: var(--space-20) 0;
  }
  
  .properties-grid {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }
  
  /* FORCE GLASS EFFECTS ON MOBILE */
  .property-card {
    background: rgba(255, 255, 255, 0.85) !important;
    backdrop-filter: blur(25px) !important;
    -webkit-backdrop-filter: blur(25px) !important;
    border: 1px solid rgba(255, 255, 255, 0.35) !important;
  }
  
  .property-card:hover {
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(30px) !important;
    -webkit-backdrop-filter: blur(30px) !important;
  }
  
  .property-image {
    height: 250px;
  }
  
  .property-content {
    padding: var(--space-6);
  }
  
  .property-details {
    gap: var(--space-6);
  }
  
  .property-footer {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-4);
  }
  
  .property-cta {
    text-align: center;
    padding: var(--space-4) var(--space-6);
  }
}

@media (max-width: 480px) {
  .properties-section {
    padding: var(--space-16) 0;
  }
  
  .property-image {
    height: 220px;
  }
  
  .property-content {
    padding: var(--space-5);
  }
  
  .property-title {
    font-size: 1.2rem;
  }
  
  .property-price {
    font-size: 1.5rem;
  }
  
  .section-actions {
    gap: var(--space-2);
  }
  
  .filter-btn {
    padding: var(--space-2) var(--space-4);
    font-size: 0.9rem;
  }
}
