/* Design System & Premium Aesthetics */
:root {
  --bg-dark: #0f172a;
  --bg-card: #1e293b;
  --bg-card-hover: #334155;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --accent-amber: #f59e0b;
  --accent-emerald: #10b981;
  --accent-rose: #f43f5e;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border: #334155;
  --glass: rgba(30, 41, 59, 0.85);
  --radius: 12px;
  --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
}

/* Header & Navbar */
.navbar {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  background: var(--glass);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  text-decoration: none;
  flex-shrink: 0;
}

.logo span {
  color: var(--accent-amber);
}

.logo-badge {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-amber);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  border: 1px solid rgba(245, 158, 11, 0.3);
  white-space: nowrap;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  max-width: 100%;
}

.agent-email-text {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.nav-btn {
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
  font-size: 0.82rem;
  transition: all 0.2s ease;
  cursor: pointer;
  border: none;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nav-btn-primary {
  background: var(--primary);
  color: white;
}

.nav-btn-primary:hover {
  background: var(--primary-hover);
}

.nav-btn-outline {
  background: transparent;
  color: var(--text-main);
  border: 1px solid var(--border);
}

.nav-btn-outline:hover {
  background: var(--bg-card);
}

/* Hero Section */
.hero {
  padding: 2.5rem 1rem 1.5rem;
  text-align: center;
  max-width: 800px;
  margin: 0 auto;
}

.hero h1 {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 0.75rem;
  background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  word-wrap: break-word;
}

.hero p {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Search & Filter Bar */
.filter-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  max-width: 1100px;
  margin: 0 auto 2rem;
  box-shadow: var(--shadow);
}

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

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.filter-group label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.filter-group select, .filter-group input {
  background: var(--bg-dark);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  font-size: 0.85rem;
  outline: none;
  width: 100%;
}

/* Container & Listings Grid */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem 3rem;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.section-title h2 {
  font-size: 1.25rem;
  font-weight: 700;
}

.listing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
}

.property-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all 0.25s ease;
  display: flex;
  flex-direction: column;
  position: relative;
  width: 100%;
}

.card-img-wrap {
  width: 100%;
  height: 190px;
  background: #090d16;
  position: relative;
  overflow: hidden;
}

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

.badge-tag {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(4px);
  color: var(--text-main);
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  border: 1px solid var(--border);
}

.badge-status {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--accent-emerald);
  color: white;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 700;
}

.card-body {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.card-price {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--accent-amber);
  margin-bottom: 0.2rem;
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
  color: var(--text-main);
  line-height: 1.3;
}

.card-location {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

/* Industrial Spec Grid */
.spec-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.4rem;
  margin-bottom: 1rem;
  background: rgba(15, 23, 42, 0.6);
  padding: 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.spec-item {
  display: flex;
  flex-direction: column;
}

.spec-item .label {
  font-size: 0.62rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.spec-item .val {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-main);
}

.card-actions {
  margin-top: auto;
  display: flex;
  gap: 0.5rem;
}

.btn-whatsapp {
  flex: 1;
  background: #25d366;
  color: #000;
  font-weight: 700;
  padding: 0.6rem;
  border-radius: 8px;
  text-decoration: none;
  text-align: center;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
}

.btn-detail {
  background: var(--bg-dark);
  color: var(--text-main);
  border: 1px solid var(--border);
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.8rem;
}

/* Modal View */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(6px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  padding: 0.75rem;
}

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

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 700px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.25rem;
  box-shadow: var(--shadow);
  position: relative;
}

.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Dashboard Layout */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  width: 100%;
}

@media (min-width: 900px) {
  .dashboard-grid {
    grid-template-columns: 360px 1fr;
  }
}

.form-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem;
  width: 100%;
}

.form-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.85rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

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

.form-control {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 0.75rem;
  width: 100%;
}

.form-control label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
}

.form-control input, .form-control select, .form-control textarea {
  background: var(--bg-dark);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  font-size: 0.85rem;
  outline: none;
  width: 100%;
}

.form-control textarea {
  resize: vertical;
  min-height: 70px;
}

.table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  width: 100%;
  max-width: 100%;
  display: block;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.82rem;
}

th, td {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border);
}

th {
  background: rgba(15, 23, 42, 0.8);
  color: var(--text-muted);
  font-size: 0.7rem;
  text-transform: uppercase;
}

/* ===================================================
   STRICT MOBILE BREAKPOINTS (<= 640px)
   =================================================== */
@media (max-width: 640px) {
  .navbar {
    padding: 0.65rem 0.85rem;
    flex-wrap: wrap;
    gap: 0.4rem;
  }

  .nav-dashboard {
    flex-direction: column;
    align-items: stretch;
  }

  .nav-dashboard .logo {
    margin-bottom: 0.2rem;
  }

  .nav-dashboard .nav-links {
    width: 100%;
    justify-content: space-between;
    align-items: center;
  }

  .agent-email-text {
    font-size: 0.7rem;
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .logo {
    font-size: 1rem;
  }

  .logo-badge {
    display: none;
  }

  .hero {
    padding: 1.5rem 0.5rem 1rem;
  }

  .hero h1 {
    font-size: 1.4rem;
    line-height: 1.3;
  }

  .hero p {
    font-size: 0.85rem;
  }

  .filter-card {
    margin: 0 0.25rem 1.5rem;
    padding: 0.75rem;
  }

  .filter-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }

  .container {
    padding: 0 0.5rem 2rem;
  }

  .listing-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .form-card {
    padding: 0.85rem;
  }

  .form-row {
    grid-template-columns: 1fr;
    gap: 0;
  }

  table {
    font-size: 0.78rem;
  }

  th, td {
    padding: 0.5rem 0.6rem;
  }
}
