/* ============================================================
   PG Finder — Dashboard Page  (dashboard.css)
   Page-specific styles ONLY.
   Global design system tokens & components → styles.css
   ============================================================ */


/* ── Page shell ──────────────────────────────────────────────────────────── */
.dashboard-page {
  background-color: var(--color-surface);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}


/* ── Hero bar ────────────────────────────────────────────────────────────── */
.dashboard-hero {
  padding-top: calc(var(--navbar-h) + var(--space-12));
  padding-bottom: calc(var(--space-12) + var(--space-10)); /* extra room for floating card */
  background: linear-gradient(135deg, var(--color-primary) 0%, #1E40AF 100%);
  position: relative;
  overflow: hidden;
}

.dashboard-hero__bg-pattern {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 80% 30%, rgba(255,255,255,0.07) 0%, transparent 55%),
    radial-gradient(circle at 10% 80%, rgba(255,255,255,0.04) 0%, transparent 45%);
}

.dashboard-hero .container {
  position: relative;
  z-index: 1;
}

.dashboard-hero__title {
  /* Override global h1 size for this compact hero */
  font-size: clamp(1.75rem, 3.5vw, 2.6rem) !important;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: var(--space-3);
}

.dashboard-hero__subtitle {
  font-size: var(--font-size-md);
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.6;
  max-width: 520px;
}


/* ── Main content area ───────────────────────────────────────────────────── */
.dashboard-main {
  flex: 1;
  padding-bottom: var(--space-16);
}


/* ── Search section — floats up over hero ────────────────────────────────── */
.search-section {
  background-color: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  padding: var(--space-6) var(--space-8);
  margin-top: calc(-1 * var(--space-10));
  position: relative;
  z-index: 10;
  margin-bottom: var(--space-8);
}

/* Search input + button row */
.search-bar {
  display: flex;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.search-bar .form-input {
  flex: 1;
  min-width: 0; /* prevent overflow in flex */
}

.search-bar .btn {
  flex-shrink: 0;
}


/* ── Filters toggle ──────────────────────────────────────────────────────── */
.filters-toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: none;
  border: none;
  padding: 0;
  color: var(--color-primary);
  font-size: var(--font-size-sm);
  font-weight: 600;
  font-family: var(--font-family);
  cursor: pointer;
  transition: var(--transition-fast);
  user-select: none;
}

.filters-toggle:hover {
  color: var(--color-primary-dark);
}

.filters-toggle__chevron {
  transition: transform 0.2s ease;
}

/* Rotate chevron when panel is open */
#filtersPanel.active ~ * .filters-toggle__chevron,
.filters-panel.active + .filters-toggle .filters-toggle__chevron {
  transform: rotate(180deg);
}


/* ── Filters panel ───────────────────────────────────────────────────────── */
.filters-panel {
  display: none;
  margin-top: var(--space-5);
  padding-top: var(--space-5);
  border-top: 1px solid var(--color-border);
}

.filters-panel.active {
  display: block;
}

/* 3-column grid of filters */
.filters-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4) var(--space-6);
  margin-bottom: var(--space-5);
}

/* Individual filter field */
.filter-group {
  display: flex;
  flex-direction: column;
}

.filter-label {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: var(--space-2);
  letter-spacing: 0.01em;
}

/* Shared input/select style */
.filter-input,
.filter-select {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  font-family: var(--font-family);
  color: var(--color-text-primary);
  background-color: var(--color-bg);
  outline: none;
  transition: var(--transition-fast);
  line-height: 1.5;
}

.filter-input::placeholder {
  color: var(--color-text-muted);
}

.filter-input:focus,
.filter-select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.10);
}

/* Custom select arrow */
.filter-select {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 7L11 1' stroke='%2364748B' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}

/* Rent range: two number inputs side by side */
.rent-range {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.rent-range .filter-input {
  flex: 1;
  min-width: 0;
}

.rent-range__sep {
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  font-weight: 600;
  flex-shrink: 0;
}

/* Apply / Reset buttons */
.filter-actions {
  display: flex;
  gap: var(--space-3);
  align-items: center;
}


/* ── Results header ──────────────────────────────────────────────────────── */
.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

.results-header__title {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--color-text-primary);
  letter-spacing: -0.02em;
}

.results-count {
  display: inline-flex;
  align-items: center;
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-secondary);
  background-color: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  padding: 4px 14px;
}


/* ── Properties grid (className set by JS) ───────────────────────────────── */
.properties-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-6);
}


/* ── Property card inner content (HTML injected by JS) ──────────────────── */
/*
   Base .property-card styles (bg, border, border-radius, overflow, hover)
   already defined in styles.css — these are the inner content styles only.
*/

.property-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.1);
  position: relative;
  animation: cardFadeIn 0.5s ease-out;
}

@keyframes cardFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.property-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1), 0 4px 10px rgba(0, 0, 0, 0.05);
  border-color: var(--color-primary-border);
}

.property-card:hover .property-title {
  color: var(--color-primary);
}

.property-image {
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
  background-color: var(--color-surface-alt);
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 0;
  position: relative;
  overflow: hidden;
}

.property-card:hover .property-image {
  transform: scale(1.03);
}

/* Add a subtle overlay on hover */
.property-image::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.1) 0%, transparent 50%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.property-card:hover .property-image::after {
  opacity: 1;
}

/* Placeholder for no image */
.property-image[style*="display: flex"] {
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  border-bottom: 1px solid var(--color-border);
  font-weight: 500;
  letter-spacing: 0.025em;
}

.property-content {
  padding: var(--space-6);
  position: relative;
}

.property-title {
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--color-text-primary);
  margin-bottom: var(--space-3);
  line-height: 1.3;
  letter-spacing: -0.025em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.property-location {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-4);
  line-height: 1.5;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 500;
}

.property-location svg {
  flex-shrink: 0;
  opacity: 0.7;
}

.property-details {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}

.detail-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  background: none;
  border: none;
  border-radius: 0;
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-secondary);
  white-space: nowrap;
  letter-spacing: 0;
  transition: none;
  line-height: 1.4;
}

.detail-badge svg {
  flex-shrink: 0;
  opacity: 0.7;
  width: 13px;
  height: 13px;
}

.detail-badge:hover {
  background: none;
  color: var(--color-text-primary);
  transform: none;
}

.detail-badge:hover svg {
  opacity: 1;
}

/* Feature group styling */
.feature-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-3);
  line-height: 1.4;
}

.feature-group .detail-badge {
  position: relative;
}

.feature-group .detail-badge:not(:last-child)::after {
  content: '·';
  position: absolute;
  right: -10px;
  color: var(--color-border);
  font-weight: 600;
}

.property-rent {
  font-size: var(--font-size-2xl);
  font-weight: 800;
  color: var(--color-primary);
  letter-spacing: -0.03em;
  margin-bottom: var(--space-5);
  line-height: 1.1;
  display: flex;
  align-items: baseline;
  gap: var(--space-1);
}

.property-rent::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--color-border) 0%, transparent 100%);
  margin-left: var(--space-3);
}

.view-details-btn {
  width: 100%;
  padding: 12px var(--space-4);
  background: linear-gradient(135deg, var(--color-primary) 0%, #1e40af 100%);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: var(--font-size-sm);
  font-weight: 600;
  font-family: var(--font-family);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  letter-spacing: 0.025em;
  position: relative;
  overflow: hidden;
}

.view-details-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s ease;
}

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

.view-details-btn:hover {
  background: linear-gradient(135deg, #1e40af 0%, var(--color-primary) 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(37, 99, 235, 0.4);
}

.view-details-btn:active {
  transform: translateY(0);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}


/* ── Loading state (innerHTML set by JS) ─────────────────────────────────── */
.loading-state {
  text-align: center;
  padding: var(--space-20) var(--space-6);
  color: var(--color-text-secondary);
  font-size: var(--font-size-base);
  font-weight: 500;
}

/* CSS-only spinner — safe, no JS changes needed */
.loading-state::before {
  content: '';
  display: block;
  width: 48px;
  height: 48px;
  border: 3px solid var(--color-primary-light);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  margin: 0 auto var(--space-6);
  animation: ld-spin 0.8s linear infinite;
}

@keyframes ld-spin {
  to { transform: rotate(360deg); }
}


/* ── Empty / error state (innerHTML set by JS) ───────────────────────────── */
.empty-state {
  text-align: center;
  padding: var(--space-20) var(--space-6);
  color: var(--color-text-secondary);
}

.empty-state::before {
  content: '';
  display: block;
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--color-surface-alt) 0%, var(--color-border) 100%);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-full);
  margin: 0 auto var(--space-6);
  /* House icon via mask */
  mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='1.5' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3 9l9-7 9 7v11a2 2 0 01-2 2H5a2 2 0 01-2-2z'/%3E%3Cpolyline points='9 22 9 12 15 12 15 22'/%3E%3C/svg%3E");
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: 32px;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='1.5' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3 9l9-7 9 7v11a2 2 0 01-2 2H5a2 2 0 01-2-2z'/%3E%3Cpolyline points='9 22 9 12 15 12 15 22'/%3E%3C/svg%3E");
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: 32px;
}

.empty-state h3 {
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--color-text-primary);
  margin-bottom: var(--space-3);
  letter-spacing: -0.02em;
}

.empty-state p {
  font-size: var(--font-size-base);
  color: var(--color-text-secondary);
  line-height: 1.6;
}


/* ── Footer ──────────────────────────────────────────────────────────────── */
.dashboard-footer {
  background-color: var(--color-bg);
  border-top: 1px solid var(--color-border);
  padding: var(--space-6) 0;
}

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

.dashboard-footer__logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.dashboard-footer__logo-icon {
  width: 26px;
  height: 26px;
  background-color: var(--color-primary);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.dashboard-footer__brand {
  font-size: var(--font-size-base);
  font-weight: 700;
  color: var(--color-text-primary);
  letter-spacing: -0.02em;
}

.dashboard-footer__copy {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}


/* ── Responsive — Tablet (768px) ─────────────────────────────────────────── */
@media (max-width: 768px) {

  .dashboard-hero {
    padding-top: calc(var(--navbar-h) + var(--space-8));
    padding-bottom: calc(var(--space-10) + var(--space-8));
  }

  .search-section {
    padding: var(--space-5);
    margin-top: calc(-1 * var(--space-8));
  }

  .search-bar {
    flex-direction: column;
  }

  .search-bar .btn {
    width: 100%;
    justify-content: center;
  }

  .filters-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .properties-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-5);
  }

  .property-card {
    border-radius: 14px;
  }

  .property-image {
    height: 180px;
  }

  .property-content {
    padding: var(--space-5);
  }

  .property-title {
    font-size: var(--font-size-base);
  }

  .property-rent {
    font-size: var(--font-size-xl);
  }

  .dashboard-footer__inner {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3);
  }
}


/* ── Responsive — Mobile (480px) ─────────────────────────────────────────── */
@media (max-width: 480px) {

  .dashboard-hero {
    padding-top: calc(var(--navbar-h) + var(--space-6));
    padding-bottom: calc(var(--space-8) + var(--space-6));
  }

  .dashboard-hero .container {
    text-align: center;
  }

  .dashboard-hero__title {
    margin-left: auto;
    margin-right: auto;
  }

  .dashboard-hero__subtitle {
    font-size: var(--font-size-base);
    margin-left: auto;
    margin-right: auto;
  }

  .search-section {
    padding: var(--space-4);
    border-radius: var(--radius-lg);
    margin-top: calc(-1 * var(--space-6));
  }

  .filters-grid {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }

  .filter-actions {
    flex-direction: column;
  }

  .filter-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .properties-grid {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }

  .property-card {
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  }

  .property-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
  }

  .property-image {
    height: 200px;
  }

  .property-content {
    padding: var(--space-4);
  }

  .property-title {
    font-size: var(--font-size-base);
    margin-bottom: var(--space-2);
  }

  .property-location {
    margin-bottom: var(--space-3);
  }

  .property-details {
    margin-bottom: var(--space-4);
  }

  .detail-badge {
    font-size: var(--font-size-sm);
  }

  .detail-badge svg {
    width: 12px;
    height: 12px;
  }

  .feature-group {
    gap: var(--space-2);
  }

  .property-rent {
    font-size: var(--font-size-lg);
    margin-bottom: var(--space-4);
  }

  .view-details-btn {
    padding: 10px var(--space-3);
    font-size: 13px;
  }

  .results-header {
    flex-direction: column;
    align-items: flex-start;
  }
}
