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

/* CSS Variables & Design System - NoBroker Style Premium Light Mode */
:root {
  --font-sans: 'Inter', 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  
  /* Color Palette - Premium Light Theme */
  --bg-main: #f8fafc; /* Very soft grayish blue */
  --bg-surface: #ffffff; /* Pure white for cards and headers */
  --bg-surface-hover: #fafafb; 
  --bg-modal: #ffffff;
  
  --accent-primary: #fd3752; /* NoBroker Signature Red */
  --accent-primary-glow: rgba(253, 55, 82, 0.15);
  --accent-secondary: #0f172a; /* Slate 900 for dark texts/headers */
  --accent-success: #15803d; /* Dark green for success/prices */
  --accent-success-bg: #dcfce7; /* Light green bg for badges */
  --accent-contact: #22c55e; /* Bright green for contact actions */
  
  --text-primary: #1e293b; /* Slate 800 */
  --text-secondary: #475569; /* Slate 600 */
  --text-muted: #94a3b8; /* Slate 400 */
  
  --border-color: #e2e8f0; /* Slate 200 */
  --border-color-focus: #fd3752; /* Focus color matching accent red */
  
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px 0 rgba(0, 0, 0, 0.03);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  
  --transition-smooth: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --border-radius-sm: 6px;
  --border-radius-md: 10px;
  --border-radius-lg: 16px;
}

/* Reset and Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
}

body {
  background-color: var(--bg-main);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(253, 55, 82, 0.03) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(34, 197, 94, 0.02) 0%, transparent 40%);
  background-attachment: fixed;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* App Container Layout */
.app-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem 4rem 1rem;
}

/* Header Styles */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 2rem;
  background: transparent;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.brand-logo-wrapper {
  width: 50px;
  height: 50px;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  position: relative;
  background: transparent;
  border: 1px solid var(--border-color);
}

.brand-logo-img {
  width: 90px;
  height: auto;
  max-width: none;
  margin-top: -2px;
  display: block;
  transition: var(--transition-smooth);
}

.brand-logo-img:hover {
  opacity: 0.9;
  transform: scale(1.02);
}

.brand-details h1 {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--accent-secondary);
  line-height: 1.1;
}

.brand-details p {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Button Styling */
.btn {
  padding: 0.6rem 1.25rem;
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: var(--border-radius-sm);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition-smooth);
}

.btn-primary {
  background: var(--accent-primary);
  color: white;
  box-shadow: 0 2px 6px rgba(253, 55, 82, 0.15);
}

.btn-primary:hover {
  background: #e11d48; /* Slightly darker pinkish red */
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(253, 55, 82, 0.25);
}

.btn-secondary {
  background: white;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

/* Database Mode Badge */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  background: #f1f5f9;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.status-badge.live {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
}

.status-indicator {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
}

.status-badge.live .status-indicator {
  background: #2563eb;
  box-shadow: 0 0 6px #2563eb;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.5); }
  70% { transform: scale(1); box-shadow: 0 0 0 5px rgba(37, 99, 235, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}

/* User Profile Header Badge */
#user-profile {
  background: white;
  padding: 0.35rem 0.75rem;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-color);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

/* Hero Section & Search Container Box (NoBroker Style) */
.hero-section {
  text-align: center;
  padding: 2.5rem 0 2rem 0;
  max-width: 900px;
  margin: 0 auto;
}

.hero-title {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--accent-secondary);
  margin-bottom: 0.5rem;
}

.hero-subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

.search-container-box {
  background: white;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid #e2e8f0;
  padding: 1.5rem;
  text-align: left;
}

/* Category Tabs (Buy/Rent/Commercial/Plots) */
.search-tabs-row {
  display: flex;
  gap: 1.5rem;
  border-bottom: 1px solid #f1f5f9;
  margin-bottom: 1.25rem;
  padding-bottom: 0.25rem;
}

.search-tab-btn {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-secondary);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem 0.25rem;
  position: relative;
  transition: var(--transition-smooth);
}

.search-tab-btn:hover {
  color: var(--accent-primary);
}

.search-tab-btn.active {
  color: var(--accent-primary);
}

.search-tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--accent-primary);
  border-radius: 2px;
}

/* Main Input Bar Layout */
.search-input-bar {
  display: grid;
  grid-template-columns: 180px 1fr auto;
  gap: 0.5rem;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  padding: 0.5rem;
  border-radius: var(--border-radius-md);
  align-items: center;
}

@media (max-width: 768px) {
  .search-input-bar {
    grid-template-columns: 1fr;
    padding: 1rem;
  }
}

.search-city-select {
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.5rem;
  cursor: pointer;
  outline: none;
  border-right: 1px solid #cbd5e1;
}

@media (max-width: 768px) {
  .search-city-select {
    border-right: none;
    border-bottom: 1px solid #cbd5e1;
    padding-bottom: 0.75rem;
    margin-bottom: 0.5rem;
  }
}

.locality-search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  flex-grow: 1;
}

.locality-search-wrapper input {
  width: 100%;
  border: none;
  background: transparent;
  padding: 0.5rem 0.5rem 0.5rem 1.75rem;
  font-size: 0.95rem;
  color: var(--text-primary);
  outline: none;
}

.locality-search-wrapper svg {
  position: absolute;
  left: 0.5rem;
  color: var(--text-muted);
}

.search-action-btn {
  background: var(--accent-primary);
  color: white;
  border: none;
  padding: 0.75rem 2rem;
  border-radius: var(--border-radius-sm);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.search-action-btn:hover {
  background: #e11d48;
}

/* Locality Chips Container */
.locality-chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.locality-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  padding: 0.25rem 0.6rem;
  border-radius: 15px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.locality-chip-close {
  cursor: pointer;
  color: var(--text-muted);
  font-weight: 800;
  font-size: 0.9rem;
}

.locality-chip-close:hover {
  color: var(--accent-primary);
}

/* Trust Pillar Badges */
.trust-pillars {
  display: flex;
  justify-content: center;
  gap: 3rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.pillar-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.pillar-item svg {
  color: #22c55e; /* Green check */
}

/* Filters & Subheader bar */
.search-filter-section {
  max-width: 900px;
  margin: 2.5rem auto 1.5rem auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 0.5rem 0;
  border-bottom: 2px solid #f1f5f9;
}

.filter-tabs {
  display: flex;
  gap: 0.5rem;
}

.filter-tab {
  padding: 0.45rem 1rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-secondary);
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.filter-tab:hover {
  color: var(--accent-primary);
  border-color: #cbd5e1;
}

.filter-tab.active {
  background: var(--accent-primary-glow);
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}

#sort-select {
  padding: 0.45rem 1rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-secondary);
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  outline: none;
  max-width: 180px;
}

/* Listings Vertical Column (NoBroker style) */
.listings-grid {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  max-width: 900px;
  margin: 0 auto;
}

.no-listings {
  text-align: center;
  padding: 4rem 2rem;
  background: white;
  border-radius: var(--border-radius-lg);
  border: 1.5px dashed var(--border-color);
}

.no-listings svg {
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.no-listings h3 {
  font-size: 1.3rem;
  margin-bottom: 0.25rem;
}

.no-listings p {
  color: var(--text-secondary);
}

/* Listing Card Style - Horizontal Layout */
.listing-card {
  background: var(--bg-surface);
  border-radius: var(--border-radius-md);
  border: 1px solid var(--border-color);
  overflow: hidden;
  display: flex;
  flex-direction: row;
  transition: var(--transition-smooth);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}

.listing-card:hover {
  box-shadow: var(--shadow-lg);
  border-color: #cbd5e1;
}

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

/* Thumbnail wrapper */
.card-image-wrapper {
  position: relative;
  width: 260px;
  min-width: 260px;
  aspect-ratio: 4/3;
  overflow: hidden;
  background: #f1f5f9;
}

@media (max-width: 768px) {
  .card-image-wrapper {
    width: 100%;
    aspect-ratio: 16/9;
  }
}

.card-image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.listing-card:hover .card-image-wrapper img {
  transform: scale(1.03);
}

.card-badge {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(4px);
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Card Body Split */
.card-body {
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  justify-content: space-between;
}

.card-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #0f172a; /* Darker Slate */
  line-height: 1.3;
}

.card-location {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.2/75rem;
}

.card-location svg {
  color: var(--accent-primary);
}

/* Verification Badge */
.verified-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  background: var(--accent-success-bg);
  border-radius: 4px;
  color: var(--accent-success);
  font-size: 0.75rem;
  font-weight: 700;
}

/* Key Stats Horizontal Row (Price, Area, Type) */
.card-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  border-top: 1px solid #f1f5f9;
  border-bottom: 1px solid #f1f5f9;
  padding: 0.6rem 0;
  margin: 0.75rem 0;
}

.stat-item {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.stat-item-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.15rem;
}

.stat-item-value {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.stat-item-value.price {
  color: var(--accent-success);
  font-size: 1.05rem;
  font-weight: 800;
}

.card-description {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.45;
  margin-bottom: 0.75rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Card Footer */
.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 0.75rem;
  border-top: 1px dashed #f1f5f9;
  margin-top: auto;
}

.lister-info {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.card-footer-buttons {
  display: flex;
  gap: 0.5rem;
}

.btn-show-number {
  padding: 0.45rem 0.8rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-show-number:hover {
  background: #e2e8f0;
  color: var(--text-primary);
}

.contact-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 1rem;
  font-size: 0.8rem;
  color: white;
  background: var(--accent-contact);
  border: 1px solid var(--accent-contact);
  border-radius: var(--border-radius-sm);
  text-decoration: none;
  font-weight: 700;
  transition: var(--transition-smooth);
}

.contact-btn:hover {
  background: #16a34a;
  border-color: #16a34a;
}

/* Modals System (Light Mode optimized) */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal-content {
  background: var(--bg-modal);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  width: 90%;
  max-width: 550px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.75rem;
  box-shadow: var(--shadow-xl);
  transform: scale(0.97);
  transition: transform 0.2s ease;
}

.modal-overlay.active .modal-content {
  transform: scale(1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #f1f5f9;
}

.modal-header h2 {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--accent-secondary);
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.modal-close:hover {
  color: var(--accent-primary);
}

/* Forms (Light Mode) */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
  color: var(--text-secondary);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

input[type="text"],
input[type="number"],
input[type="tel"],
input[type="email"],
input[type="password"],
select,
textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: white;
  border: 1px solid #cbd5e1;
  border-radius: var(--border-radius-sm);
  color: var(--text-primary);
  font-size: 0.9rem;
  outline: none;
  transition: var(--transition-smooth);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--border-color-focus);
  box-shadow: 0 0 0 3px var(--accent-primary-glow);
}

textarea {
  resize: vertical;
  min-height: 80px;
}

/* File Upload */
.file-upload-container {
  position: relative;
  width: 100%;
  border: 2px dashed #cbd5e1;
  border-radius: var(--border-radius-sm);
  padding: 1.25rem;
  text-align: center;
  background: #f8fafc;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.file-upload-container:hover {
  border-color: var(--accent-primary);
  background: rgba(253, 55, 82, 0.02);
}

.file-upload-container input[type="file"] {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.upload-icon {
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.upload-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.upload-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.image-preview {
  margin-top: 0.75rem;
  width: 100%;
  aspect-ratio: 16/10;
  border-radius: var(--border-radius-sm);
  overflow: hidden;
  display: none;
  border: 1px solid var(--border-color);
}

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

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid #f1f5f9;
}

/* Info Box */
.info-box {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--border-radius-sm);
  padding: 0.75rem 1rem;
  font-size: 0.8rem;
  color: #1e40af;
  margin-bottom: 1rem;
  line-height: 1.4;
  font-weight: 500;
}

/* Admin Dashboard Table */
#admin-listings-table tr {
  border-bottom: 1px solid #e2e8f0;
  transition: var(--transition-smooth);
}

#admin-listings-table tr:hover {
  background: #f8fafc;
}

#admin-listings-table td {
  padding: 0.75rem 0.5rem;
  font-size: 0.85rem;
}

.delete-listing-btn {
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.2);
  background: rgba(239, 68, 68, 0.05);
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  font-weight: 700;
  transition: var(--transition-smooth);
}

.delete-listing-btn:hover {
  background: #ef4444;
  color: white;
  border-color: #ef4444;
}

/* Details Modal Specs Row */
#details-specs-strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: #f8fafc;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-color);
}
