/* ============================================================
   tuzama — Listings styles
   Shared by post-listing.html and dashboard.html.
   All values use tokens from css/variables.css.
   ============================================================ */

/* ── Sticky app nav (post-listing + dashboard) ── */
.app-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  background-color: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
}

.app-nav-logo { height: 28px; width: auto; }

.app-nav-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

/* ── Post-listing form page ── */
.listing-form-page { background-color: var(--color-background); min-height: 100dvh; }

.listing-form-container {
  max-width: 640px;
  margin: 0 auto;
  padding: var(--space-8) var(--space-4) var(--space-20);
}

.listing-form-page-title {
  font-size: var(--text-2xl);
  font-weight: var(--font-weight-bold);
  margin-bottom: var(--space-8);
}

/* ── Form sections ── */
.form-section { margin-bottom: var(--space-10); }

.form-section-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-3);
  border-bottom: 1.5px solid var(--color-border);
}

.form-section-icon {
  width: 18px;
  height: 18px;
  color: var(--color-primary);
  flex-shrink: 0;
}

.form-section-title {
  font-size: var(--text-base);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
}

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

/* ── Listing type (Rent / For Sale) toggle ── */
.listing-type-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
}

.listing-type-option {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-3) var(--space-4);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-base);
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-secondary);
  user-select: none;
  transition:
    border-color var(--transition-fast),
    background-color var(--transition-fast),
    color var(--transition-fast);
  text-align: center;
}

.listing-type-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0; height: 0;
  pointer-events: none;
}

.listing-type-option:hover {
  border-color: var(--color-primary-light);
  background-color: var(--color-primary-subtle);
}

.listing-type-option.selected {
  border-color: var(--color-primary);
  background-color: var(--color-primary-subtle);
  color: var(--color-primary);
}

/* ── Price input with "KES" prefix ── */
.price-input-wrapper {
  display: flex;
  align-items: stretch;
}

.price-prefix {
  display: flex;
  align-items: center;
  padding: 0 var(--space-3);
  background-color: var(--color-surface-alt);
  border: 1.5px solid var(--color-border);
  border-right: none;
  border-radius: var(--radius-base) 0 0 var(--radius-base);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
}

.price-input-wrapper .form-input {
  border-radius: 0 var(--radius-base) var(--radius-base) 0;
}

/* ── Furnished toggle row ── */
.furnished-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4);
  background-color: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-base);
  cursor: pointer;
  user-select: none;
}

.furnished-row-label {
  font-size: var(--text-base);
  font-weight: var(--font-weight-medium);
  color: var(--color-text);
}

.furnished-row-sub {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  margin-top: 1px;
}

/* Compact inline toggle (reused from auth.css concept) */
.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle-switch input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0; height: 0;
}

.toggle-track {
  display: block;
  position: absolute;
  inset: 0;
  background-color: var(--color-border-strong);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background-color var(--transition-fast);
}

.toggle-switch input:checked ~ .toggle-track { background-color: var(--color-primary); }

.toggle-track::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 18px; height: 18px;
  background-color: white;
  border-radius: 50%;
  box-shadow: var(--shadow-xs);
  transition: transform var(--transition-fast);
}

.toggle-switch input:checked ~ .toggle-track::after { transform: translateX(20px); }

/* ── Amenities checkbox grid ── */
.amenities-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
}

@media (min-width: 480px) {
  .amenities-grid { grid-template-columns: repeat(3, 1fr); }
}

.amenity-label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-base);
  cursor: pointer;
  font-size: var(--text-sm);
  color: var(--color-text);
  transition:
    border-color var(--transition-fast),
    background-color var(--transition-fast);
  user-select: none;
  line-height: var(--leading-snug);
}

.amenity-label input[type="checkbox"] {
  accent-color: var(--color-primary);
  width: 16px; height: 16px;
  cursor: pointer;
  flex-shrink: 0;
}

.amenity-label:has(input:checked) {
  border-color: var(--color-primary);
  background-color: var(--color-primary-subtle);
}

/* ── Image upload zone ── */
.upload-zone {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-8) var(--space-4);
  text-align: center;
  cursor: pointer;
  transition:
    border-color var(--transition-fast),
    background-color var(--transition-fast);
}

.upload-zone.drag-over {
  border-color: var(--color-primary);
  background-color: var(--color-primary-subtle);
}

.upload-zone-icon {
  color: var(--color-text-muted);
  width: 36px; height: 36px;
  margin: 0 auto var(--space-3);
}

.upload-zone-text {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-1);
}

.upload-zone-btn {
  background: none;
  border: none;
  color: var(--color-primary);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: var(--font-weight-semibold);
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
}

.upload-zone-hint {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: var(--space-1);
}

/* ── Compact upload zone once photos exist ── */
.upload-zone.has-photos {
  padding: var(--space-3) var(--space-4);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  border-radius: var(--radius-base);
}
.upload-zone.has-photos .upload-zone-icon { width: 20px; height: 20px; margin: 0; }
.upload-zone.has-photos .upload-zone-hint { display: none; }
.upload-zone.has-photos .upload-zone-text { margin: 0; }

/* ── Photo editor (split-panel: filmstrip + main preview) ── */
.photo-editor-wrap {
  display: flex;
  margin-top: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--color-surface);
}

/* ── Filmstrip (left) ── */
.photo-editor-strip {
  width: 88px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-2);
  overflow-y: auto;
  overflow-x: hidden;
  max-height: 420px;
  background: var(--color-surface-alt);
  border-right: 1px solid var(--color-border);
  scrollbar-width: thin;
  scrollbar-color: var(--color-border) transparent;
}
.photo-editor-strip::-webkit-scrollbar       { width: 4px; }
.photo-editor-strip::-webkit-scrollbar-track { background: transparent; }
.photo-editor-strip::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 2px; }

.strip-item {
  position: relative;
  flex-shrink: 0;
  width: 68px;
  height: 54px;
  border: 2px solid transparent;
  border-radius: var(--radius-base);
  overflow: hidden;
  padding: 0;
  background: var(--color-border);
  cursor: pointer;
  transition: border-color var(--transition-fast);
}
.strip-item:hover:not(.active) { border-color: var(--color-border-strong); }
.strip-item.active              { border-color: var(--color-primary); }

.strip-thumb {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

/* number badge bottom-right */
.strip-num {
  position: absolute;
  bottom: 2px; right: 3px;
  font-size: 9px;
  font-weight: var(--font-weight-bold);
  color: #fff;
  background: rgba(0,0,0,0.55);
  border-radius: 2px;
  padding: 1px 3px;
  line-height: 1;
  pointer-events: none;
}

/* green dot = cover photo (top-left) */
.strip-cover-dot {
  position: absolute;
  top: 3px; left: 3px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--color-primary);
  pointer-events: none;
}

/* white dot = has a label (top-right) */
.strip-label-dot {
  position: absolute;
  top: 3px; right: 3px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.25);
  pointer-events: none;
}

/* ── Main preview (right) ── */
.photo-editor-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.photo-main-img-wrap {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--color-surface-alt);
  overflow: hidden;
  flex-shrink: 0;
}
.photo-main-img {
  width: 100%; height: 100%;
  object-fit: contain;
  display: block;
}

.photo-cover-badge {
  position: absolute;
  top: var(--space-2); left: var(--space-2);
  font-size: 10px;
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--color-primary);
  color: #fff;
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
  pointer-events: none;
}

.photo-main-footer {
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  border-top: 1px solid var(--color-border);
}

.photo-label-input {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-base);
  font: inherit;
  font-size: var(--text-sm);
  color: var(--color-text);
  background: var(--color-surface);
  outline: none;
  transition: border-color var(--transition-fast);
  box-sizing: border-box;
}
.photo-label-input:focus       { border-color: var(--color-primary); }
.photo-label-input::placeholder { color: var(--color-text-muted); }

/* ── Label picker (preset chips + custom input) ── */
.label-picker {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.label-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}

.label-chip {
  padding: 3px var(--space-2);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-full);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  font: inherit;
  font-size: var(--text-xs);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  white-space: nowrap;
  line-height: 1.5;
  transition: border-color var(--transition-fast), background var(--transition-fast), color var(--transition-fast);
}
.label-chip:hover:not(.selected) {
  border-color: var(--color-primary-light);
  background: var(--color-primary-subtle);
  color: var(--color-primary);
}
.label-chip.selected {
  border-color: var(--color-primary);
  background: var(--color-primary-subtle);
  color: var(--color-primary);
  font-weight: var(--font-weight-semibold);
}

.photo-main-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.photo-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  flex-shrink: 0;
  border: 1.5px solid var(--color-border);
  border-radius: 50%;
  background: var(--color-surface);
  color: var(--color-text-secondary);
  cursor: pointer;
  padding: 0;
  transition: border-color var(--transition-fast), color var(--transition-fast);
}
.photo-nav-btn:hover:not(:disabled) { border-color: var(--color-primary); color: var(--color-primary); }
.photo-nav-btn:disabled             { opacity: 0.3; cursor: default; }
.photo-nav-btn svg                  { width: 16px; height: 16px; }

.photo-counter {
  flex: 1;
  text-align: center;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  user-select: none;
}

.photo-remove-btn {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  border: 1.5px solid var(--color-error);
  border-radius: var(--radius-base);
  background: transparent;
  color: var(--color-error);
  font: inherit;
  font-size: var(--text-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition-fast);
  margin-left: auto;
}
.photo-remove-btn:hover { background: var(--color-error-bg); }
.photo-remove-btn svg   { width: 14px; height: 14px; }

/* Mobile: filmstrip moves below main preview (horizontal scroll) */
@media (max-width: 500px) {
  .photo-editor-wrap    { flex-direction: column-reverse; }
  .photo-editor-strip {
    width: 100%;
    max-height: none;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    border-right: none;
    border-top: 1px solid var(--color-border);
    padding: var(--space-2);
    gap: var(--space-1);
  }
  .strip-item { width: 56px; height: 44px; flex-shrink: 0; }
}

/* ── Upload progress (shown during submit) ── */
.upload-progress-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.upload-progress-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
}

.upload-progress-name {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-progress-bar {
  width: 80px;
  height: 4px;
  background-color: var(--color-border);
  border-radius: var(--radius-full);
  overflow: hidden;
  flex-shrink: 0;
}

.upload-progress-fill {
  height: 100%;
  background-color: var(--color-primary);
  border-radius: var(--radius-full);
  transition: width 0.15s ease;
  width: 0%;
}

/* ── Dashboard page ── */
.dashboard-page { background-color: var(--color-background); min-height: 100dvh; }

.dashboard-main {
  max-width: var(--container-max-width);
  margin: 0 auto;
  padding: var(--space-8) var(--space-4) var(--space-16);
}

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

.dashboard-header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.dashboard-profile-link svg,
.dashboard-profile-link i {
  width: 14px;
  height: 14px;
}

.dashboard-title {
  font-size: var(--text-2xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-text);
}

/* ── Listing cards grid ── */
.listings-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
}

@media (min-width: 580px)  { .listings-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px)  { .listings-grid { grid-template-columns: repeat(3, 1fr); } }

/* ── Listing card ── */
.listing-card {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow var(--transition-fast);
}

.listing-card:hover { box-shadow: var(--shadow-base); }

.listing-card-thumb {
  aspect-ratio: 16 / 9;
  background-color: var(--color-surface-alt);
  overflow: hidden;
  flex-shrink: 0;
}

.listing-card-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

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

.listing-card-thumb-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%; height: 100%;
  color: var(--color-border-strong);
}

.listing-card-thumb-placeholder svg { width: 36px; height: 36px; }

.listing-card-body {
  padding: var(--space-4);
  flex: 1;
  display: flex;
  flex-direction: column;
}

.listing-card-title {
  font-size: var(--text-base);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
  margin-bottom: var(--space-1);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: var(--leading-snug);
}

.listing-card-location {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-3);
}

.listing-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  flex-wrap: wrap;
}

.listing-card-price {
  font-size: var(--text-base);
  font-weight: var(--font-weight-bold);
  color: var(--color-primary);
}

.listing-card-stats {
  display: flex;
  gap: var(--space-4);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-bottom: var(--space-4);
}

.listing-card-stat {
  display: flex;
  align-items: center;
  gap: 4px;
}

.listing-card-stat svg { width: 13px; height: 13px; }

.listing-card-updated {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
}
.listing-card-updated svg { width: 12px; height: 12px; flex-shrink: 0; }

.listing-card-actions {
  display: flex;
  gap: var(--space-2);
  margin-top: auto;
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border);
  flex-wrap: wrap;
}

.listing-card-actions .btn {
  flex: 1;
  min-width: 0;
  font-size: var(--text-xs);
  padding: var(--space-2) var(--space-3);
  gap: var(--space-1);
}

.listing-card-actions .btn svg { width: 13px; height: 13px; flex-shrink: 0; }

.btn-danger {
  background-color: transparent;
  color: var(--color-error);
  border-color: var(--color-error);
}

.btn-danger:hover { background-color: var(--color-error-bg); }

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: var(--space-20) var(--space-4);
}

.empty-state-icon {
  width: 52px; height: 52px;
  margin: 0 auto var(--space-5);
  color: var(--color-border-strong);
}

.empty-state-title {
  font-size: var(--text-xl);
  font-weight: var(--font-weight-semibold);
  margin-bottom: var(--space-2);
}

.empty-state-body {
  font-size: var(--text-base);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-6);
  max-width: 320px;
  margin-inline: auto;
  line-height: var(--leading-relaxed);
}

/* ── Toast notification ── */
.toast {
  position: fixed;
  bottom: var(--space-6);
  left: 50%;
  transform: translateX(-50%) translateY(calc(100% + var(--space-8)));
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background-color: var(--color-primary);
  color: white;
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-medium);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-toast);
  transition: transform var(--transition-slow);
  white-space: nowrap;
  pointer-events: none;
}

.toast.is-visible {
  transform: translateX(-50%) translateY(0);
}

.toast svg { width: 15px; height: 15px; }
