/* =========================
   FEEDS (Home + Rent)
   ========================= */
#home-feed,
#rent-feed,
#favorites-feed,
#profile-feed {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--spacing-sm);
  padding: var(--spacing-xs);
  width: min(100%, 1600px);
  margin-inline: auto;
}

@media (min-width: 640px) {
  #home-feed,
  #rent-feed,
  #favorites-feed,
  #profile-feed {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 900px) {
  #home-feed,
  #rent-feed,
  #favorites-feed,
  #profile-feed {
    grid-template-columns: repeat(4, 1fr);
    gap: var(--spacing-md);
  }
}

@media (min-width: 1200px) {
  #home-feed,
  #rent-feed,
  #favorites-feed,
  #profile-feed {
    grid-template-columns: repeat(5, 1fr);
  }
}

@media (min-width: 1500px) {
  #home-feed,
  #rent-feed,
  #favorites-feed,
  #profile-feed {
    grid-template-columns: repeat(6, 1fr);
  }
}

/* =========================
   SHARED PRIMITIVES
   ========================= */

.surface-card,
.item-card,
.rent-preview-card,
.profile-card {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
}

.campus-pill,
.category-btn,
.listing-mode-banner,
.selected-images-clear,
.item-status-badge {
  --pill-border: var(--color-border);
  --pill-bg: var(--color-bg-alt);
  --pill-color: var(--color-text-muted);
  border-radius: 999px;
  border-style: solid;
  border-width: 1px;
  border-color: var(--pill-border);
  background: var(--pill-bg);
  color: var(--pill-color);
}

.header-action-btn,
.item-fav-btn,
.selected-image-remove {
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* =========================
   TOAST
   ========================= */

.toast-host {
  position: fixed;
  top: calc(16px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 3200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(92vw, 420px);
  pointer-events: none;
}

.toast {
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
  border-radius: 12px;
  border: 1px solid var(--color-border);
  background: var(--color-bg-elevated);
  color: var(--color-text);
  padding: 10px 12px;
  font-size: 13px;
  font-weight: var(--font-weight-medium);
  line-height: 1.35;
  box-shadow: 0 8px 22px rgba(2, 6, 23, 0.22);
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast--success {
  border-color: rgba(74, 222, 128, 0.45);
  background: rgba(74, 222, 128, 0.14);
}

.toast--error {
  border-color: rgba(239, 68, 68, 0.45);
  background: rgba(239, 68, 68, 0.14);
}

/* =========================
   HEADER BRANDING
   ========================= */

.topbar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px 8px;
  background: var(--color-bg-elevated);
  border-bottom: 1px solid var(--color-border);
}

.header-main-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 40px;
}

.logo-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.logo {
  width: 138px;
  height: 28px;
  display: block;
  object-fit: contain;
  object-position: left center;
  flex-shrink: 0;
}

@media (min-width: 768px) {
  .logo {
    width: 156px;
    height: 30px;
  }
}

.campus-pill {
  --pill-border: rgba(37, 99, 235, 0.35);
  --pill-bg: var(--color-accent-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: var(--font-weight-semibold);
  line-height: 1;
  white-space: nowrap;
}

.header-actions {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.header-action-btn {
  position: relative;
  width: 34px;
  height: 34px;
  min-width: 34px;
  min-height: 34px;
  border: 1px solid var(--color-border);
  background: var(--color-bg-alt);
  color: var(--color-text-muted);
  flex-shrink: 0;
  padding: 0;
}

@media (min-width: 768px) {
  .header-action-btn {
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
  }
}

.header-action-btn:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.theme-toggle-icon {
  width: 17px;
  height: 17px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-icon-sun {
  display: none;
}

html[data-theme="dark"] .theme-icon-moon {
  display: none;
}

html[data-theme="dark"] .theme-icon-sun {
  display: block;
}

.header-fav-icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.header-fav-btn.is-active {
  color: var(--color-favorite);
}

.header-fav-btn.is-active .header-fav-icon {
  stroke: currentColor;
  fill: currentColor;
}

.header-fav-count {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: var(--font-weight-bold);
  line-height: 1;
  color: #ffffff;
  background: var(--color-favorite);
  border: 1px solid var(--color-bg-elevated);
}

/* =========================
   SECTION TYPOGRAPHY
   ========================= */

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 18px 8px 10px;
}

.section-title {
  margin: 0;
  color: var(--color-text);
  font-size: clamp(1.2rem, 1.05rem + 0.55vw, 1.45rem);
  font-weight: 600;
  line-height: 1.18;
  letter-spacing: -0.01em;
}

@media (min-width: 768px) {
  .section-head {
    margin: 20px 8px 12px;
  }

  .section-title {
    font-size: clamp(1.25rem, 1.08rem + 0.45vw, 1.55rem);
  }
}

.section-subtitle {
  margin: 0;
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  line-height: 1.25;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.section-action-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--color-accent);
  font-size: 13px;
  font-weight: var(--font-weight-semibold);
  line-height: 1;
  letter-spacing: 0;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.18s ease;
}

.section-action-link:hover {
  color: var(--color-accent-hover);
}

.section-action-link:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: 6px;
}

.section-action-arrow {
  font-size: 1.05em;
  line-height: 1;
  transition: transform 0.18s ease;
}

.section-action-link:hover .section-action-arrow {
  transform: translateX(2px);
}

.is-hidden {
  display: none;
}

/* =========================
   ITEM CARD
   ========================= */

.item-card {
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* =========================
   IMAGE WRAPPER (FIXED SIZE)
   ========================= */

.item-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--color-bg-alt);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.item-status-badge {
  --pill-border: var(--color-border);
  --pill-bg: rgba(0, 0, 0, 0.45);
  --pill-color: var(--color-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  max-width: 100%;
  padding: 3px 8px;
  font-size: 10px;
  font-weight: var(--font-weight-semibold);
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.item-thumb > .item-status-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  max-width: calc(100% - 44px);
  backdrop-filter: blur(2px);
}

.item-meta-row > .item-status-badge {
  flex-shrink: 0;
  backdrop-filter: none;
}

.item-status-badge.status-available {
  --pill-border: rgba(74, 222, 128, 0.45);
  --pill-bg: rgba(74, 222, 128, 0.2);
}

.item-status-badge.status-sold {
  --pill-border: rgba(239, 68, 68, 0.45);
  --pill-bg: rgba(239, 68, 68, 0.2);
}

.item-status-badge.status-rented {
  --pill-border: rgba(245, 158, 11, 0.45);
  --pill-bg: rgba(245, 158, 11, 0.2);
}

.item-status-badge.status-unavailable {
  --pill-border: rgba(156, 163, 175, 0.45);
  --pill-bg: rgba(156, 163, 175, 0.18);
}

.item-fav-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(0, 0, 0, 0.05);
  background: rgba(255, 255, 255, 0.9);
  color: #111827;
  font-size: 18px;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.16);
  backdrop-filter: blur(8px);
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease,
    transform 0.12s ease, box-shadow 0.18s ease;
}

html[data-theme="dark"] .item-fav-btn:not(.active) {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(17, 24, 39, 0.75);
  color: rgba(255, 255, 255, 0.92);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

.item-fav-btn.active {
  border-color: var(--color-favorite-border);
  background: rgba(255, 255, 255, 0.92);
  color: var(--color-favorite);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.16);
}

html[data-theme="dark"] .item-fav-btn.active {
  background: rgba(17, 24, 39, 0.8);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

.item-fav-btn:active {
  transform: scale(0.96);
}

.item-fav-btn:disabled {
  opacity: 0.65;
  cursor: default;
}

/* Placeholder / skeleton when no image */
.item-thumb.placeholder {
  background: var(--color-bg-alt);
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
  display: flex;
  align-items: center;
  justify-content: center;
}



.item-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;

  /* smooth image loading */
  opacity: 0;
  filter: blur(12px);
  transform: scale(1.02);
  transition: opacity 220ms ease, filter 220ms ease, transform 220ms ease;
}

.item-thumb img.loaded {
  opacity: 1;
  filter: blur(0);
  transform: scale(1);
}

.item-card.is-sold .item-thumb img.loaded,
.item-card.is-rented .item-thumb img.loaded {
  opacity: 0.78;
  filter: blur(1.6px) brightness(0.82);
  transform: scale(1.01);
}

.item-card.is-sold .item-thumb,
.item-card.is-rented .item-thumb {
  opacity: 0.9;
}

/* =========================
   CARD INFO
   ========================= */

.item-info {
  padding: var(--spacing-sm);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.item-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.item-info h3 {
  font-size: var(--font-size-sm);
  margin: 0;
  font-weight: var(--font-weight-semibold);
}

.item-info p {
  font-size: var(--font-size-xs);
  margin: 0;
  opacity: var(--opacity-muted);
}

.item-info .item-price {
  margin: 0;
  margin-left: 8px;
  font-size: 15px;
  font-weight: var(--font-weight-bold);
  line-height: 1.2;
  text-align: right;
  white-space: nowrap;
  color: var(--color-text);
  opacity: 1;
}

.item-info .item-title {
  margin: 0;
  font-size: 15px;
  font-weight: var(--font-weight-semibold);
  line-height: 1.3;
  color: var(--color-text);
}

.item-info .item-seller {
  margin: 0;
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  opacity: 1;
}

/* =========================
   EMPTY STATES
   ========================= */

#home-empty,
#rent-empty,
#favorites-empty {
  opacity: var(--opacity-muted);
  padding: var(--spacing-md);
  font-size: var(--font-size-sm);
  text-align: center;
}

/* =========================
   BOTTOM NAV (GLOBAL)
   ========================= */

.nav-bar {
  --nav-active-color: var(--color-accent);
  --nav-active-pill-bg: var(--color-accent-soft);
  --nav-inactive-color: #6b7280;
}

html[data-theme="dark"] .nav-bar {
  --nav-active-color: #7cb6ff;
  --nav-active-pill-bg: rgba(124, 182, 255, 0.16);
  --nav-inactive-color: #c4cfdf;
}

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;

  display: flex;
  justify-content: space-around;
  align-items: center;

  height: 64px;
  padding-top: 4px;
  padding-bottom: env(safe-area-inset-bottom);

  background: var(--color-bg-alt);
  border-top: 1px solid var(--color-border-alt);
  z-index: 1000;
}

.bottom-nav .nav-item {
  flex: 1;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 100%;
  color: var(--nav-inactive-color);
  transition: color 0.2s ease;
}

.bottom-nav .nav-pill {
  min-width: 42px;
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: inherit;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.bottom-nav .nav-item.active {
  color: var(--nav-active-color);
}

.bottom-nav .nav-item.active .nav-pill {
  background: var(--nav-active-pill-bg);
  color: var(--nav-active-color);
}

.bottom-nav .nav-item:active .nav-pill {
  transform: scale(0.96);
}

.bottom-nav .nav-label {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  line-height: 1.1;
  color: inherit;
  transition: color 0.2s ease;
}

.bottom-nav svg {
  width: 21px;
  height: 21px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

/* =========================
   TOP BAR ICON BUTTONS
   ========================= */

.icon-btn {
  background: none;
  border: none;
  color: var(--color-text);
  font-size: var(--font-size-lg);
  cursor: pointer;
}

.icon-btn svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

/* =========================
   PAGE SPACING FIX
   ========================= */

body {
  padding-bottom: 72px;
}

/* =========================
   SEARCH (INPUT + CLEAR)
   ========================= */

.search-wrap {
  position: relative;
  flex: 1;
  max-width: 560px;
}

.top-actions {
  width: 100%;
  margin-top: 0;
}
.search-input {
  width: 100%;
  height: 36px;
  padding: 0 36px 0 12px;

  border-radius: var(--border-radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-bg-alt);
  color: var(--color-text);

  font-size: var(--font-size-sm);
  outline: none;
  box-shadow: none;
}
.search-input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 1px var(--color-accent-soft);
}

.search-input::placeholder {
  color: var(--color-text-muted);
}
.search-clear {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);

  width: 20px;
  height: 20px;

  display: flex;
  align-items: center;
  justify-content: center;

  background: none;
  border: none;
  color: var(--color-text-muted);

  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.search-clear.hidden {
  display: none;
}

@media (min-width: 768px) {
  .topbar {
    padding: 12px 16px 10px;
  }

  .header-main-row {
    min-height: 44px;
  }

  .theme-toggle-icon {
    width: 18px;
    height: 18px;
  }

  .header-fav-icon {
    width: 19px;
    height: 19px;
  }

  .search-input {
    height: 38px;
  }
}
/* =========================
   CATEGORIES
   ========================= */

.categories {
  padding: var(--spacing-sm) var(--spacing-sm) 0;
}

.categories-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.category-btn {
  flex-shrink: 0;
  padding: 6px 12px;

  font-size: var(--font-size-xs);
  cursor: pointer;
  white-space: nowrap;
}

.category-btn.active {
  --pill-border: var(--color-accent);
  --pill-bg: var(--color-accent-soft);
  --pill-color: var(--color-text);
}

/* =========================
   HOME RENTAL PREVIEW
   ========================= */

.explore-view-all,
.rent-preview-cta-card {
  transition: opacity 160ms ease;
}

.explore-view-all.cta-hidden,
.rent-preview-cta-card.cta-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.rent-preview-row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 0 8px 8px;
  -webkit-overflow-scrolling: touch;
}

.rent-preview-card {
  flex: 0 0 150px;
  border-radius: var(--border-radius-md);
  overflow: hidden;
  cursor: pointer;
}

.rent-preview-cta-card {
  min-height: 136px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.rent-preview-cta-card .rent-preview-info {
  padding: 0 8px;
  text-align: center;
}

.rent-preview-cta-card .rent-preview-name {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-accent);
}

.rent-preview-thumb {
  width: 100%;
  height: 96px;
  object-fit: cover;
  background: var(--color-bg-alt);
}

.rent-preview-info {
  padding: 8px;
}

.rent-preview-name {
  font-size: var(--font-size-xs);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rent-preview-price {
  margin-top: 4px;
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

#rent-preview-empty {
  opacity: var(--opacity-muted);
  padding: 0 8px 8px;
  font-size: var(--font-size-sm);
}

/* =========================
   PROFILE PAGE
   ========================= */

.profile-card {
  margin: var(--spacing-sm);
  padding: 0;
  border-radius: var(--border-radius-lg);
  overflow: hidden;
}

.profile-identity-section {
  padding: 14px 16px 12px;
}

.profile-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.profile-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1 1 auto;
}

.profile-meta-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.profile-name-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.profile-photo {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--color-border);
  background: var(--color-bg-alt);
  flex-shrink: 0;
}

.profile-name {
  margin: 0;
  font-size: clamp(1rem, 0.9rem + 0.35vw, 1.15rem);
  font-weight: 600;
  line-height: 1.15;
}

.profile-email {
  margin: 0;
  font-size: 14px;
  color: #6b7280;
  line-height: 1.3;
  word-break: break-word;
}

.profile-logout-btn {
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-text-muted);
  font-size: 12px;
  font-weight: var(--font-weight-semibold);
  padding: 7px 11px;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.profile-logout-btn:hover {
  border-color: rgba(239, 68, 68, 0.35);
  color: var(--color-danger);
  background: rgba(239, 68, 68, 0.08);
}

.profile-logout-btn:disabled,
.profile-logout-btn.is-loading {
  cursor: default;
  opacity: 0.75;
}

.profile-verified-badge {
  width: 17px;
  height: 17px;
  border-radius: 999px;
  border: 1px solid rgba(37, 99, 235, 0.35);
  background: rgba(37, 99, 235, 0.14);
  color: var(--color-accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.profile-verified-badge svg {
  width: 11px;
  height: 11px;
  stroke: currentColor;
  stroke-width: 2.4;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.profile-stats-section {
  display: flex;
  align-items: center;
  justify-content: stretch;
  border-top: 1px solid rgba(15, 23, 42, 0.06);
  background: rgba(255, 255, 255, 0.36);
}

html[data-theme="dark"] .profile-stats-section {
  border-top-color: rgba(148, 163, 184, 0.12);
  background: rgba(148, 163, 184, 0.04);
}

.profile-stat-card {
  flex: 1 1 0;
  min-width: 0;
  padding: 12px 10px 13px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.profile-stat-card + .profile-stat-card {
  border-left: 1px solid rgba(15, 23, 42, 0.06);
}

html[data-theme="dark"] .profile-stat-card + .profile-stat-card {
  border-left-color: rgba(148, 163, 184, 0.12);
}

.profile-stat-value {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.1;
  color: var(--color-text);
}

.profile-stat-label {
  margin-top: 5px;
  font-size: 12px;
  font-weight: var(--font-weight-medium);
  line-height: 1.1;
  color: #6b7280;
}

.profile-listings-section {
  margin-top: 6px;
}

.profile-listings-toolbar {
  margin: 8px var(--spacing-sm) 6px;
}

.profile-items-toggle {
  width: 100%;
  border: 1px solid var(--color-border-alt);
  border-radius: var(--border-radius-md);
  background: var(--color-bg-elevated);
  color: var(--color-text);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  padding: 9px 12px;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.profile-items-toggle:hover {
  border-color: var(--color-accent);
  background: var(--color-accent-soft);
}

.profile-items-toggle:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.profile-items-toggle-label {
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
  line-height: 1.2;
}

.profile-items-toggle-count {
  margin-left: auto;
  min-width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-bg-alt);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
}

.profile-items-toggle-chevron {
  font-size: 14px;
  line-height: 1;
  color: var(--color-text-faint);
  transition: transform 0.18s ease;
}

.profile-items-toggle[aria-expanded="false"] .profile-items-toggle-chevron {
  transform: rotate(-90deg);
}

.profile-listing-controls {
  margin-bottom: 2px;
}

.profile-items-panel {
  max-height: none;
  opacity: 1;
  visibility: visible;
  overflow: hidden;
  transition: max-height 0.28s ease, opacity 0.2s ease, visibility 0.2s ease;
}

.profile-listings-section.is-controls-collapsed .profile-items-panel {
  max-height: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.profile-listings-section .categories {
  margin-bottom: 8px;
}

.profile-services-empty {
  margin: 10px 0 0;
  padding: 0 12px;
  text-align: center;
}

.profile-secondary-section {
  margin: 14px var(--spacing-sm) var(--spacing-sm);
}

.profile-secondary-title {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: var(--font-weight-semibold);
  line-height: 1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-faint);
}

.profile-support-list {
  margin: 0;
  border: 1px solid var(--color-border-alt);
  border-radius: var(--border-radius-lg);
  background: var(--color-bg-elevated);
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}

html[data-theme="dark"] .profile-support-list {
  box-shadow: 0 12px 28px rgba(2, 6, 23, 0.2);
}

.profile-support-row {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: 13px;
  text-align: left;
  padding: 14px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.profile-support-row:last-child {
  border-bottom: 0;
}

.profile-support-row:hover {
  background: var(--color-accent-soft);
}

.profile-support-row:hover .profile-support-chevron {
  color: var(--color-accent);
  transform: translateX(2px);
}

.profile-support-row:active {
  background: rgba(37, 99, 235, 0.1);
}

.profile-support-row:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.profile-support-icon {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 999px;
  border: 1px solid rgba(37, 99, 235, 0.14);
  background: rgba(37, 99, 235, 0.08);
  color: var(--color-accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.profile-support-icon svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.profile-support-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 3px;
}

.profile-support-title {
  font-size: 15px;
  font-weight: var(--font-weight-semibold);
  line-height: 1.2;
}

.profile-support-subtitle {
  max-width: 100%;
  font-size: 13px;
  color: var(--color-text-muted);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-support-chevron {
  margin-left: auto;
  color: var(--color-text-faint);
  font-size: 18px;
  line-height: 1;
  transition: transform 0.18s ease, color 0.18s ease;
}

body.profile-modal-open {
  overflow: hidden;
}

body.service-overlay-open {
  overflow: hidden;
}

.service-overlay {
  position: fixed;
  inset: 0;
  z-index: 2550;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(2, 6, 23, 0.52);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.service-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.service-overlay[hidden] {
  display: none !important;
}

.service-overlay-card {
  width: min(100%, 560px);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-lg);
  background: var(--color-bg-elevated);
  color: var(--color-text);
  box-shadow: 0 16px 38px rgba(2, 6, 23, 0.28);
  transform: translateY(8px) scale(0.98);
  opacity: 0;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.service-overlay.is-open .service-overlay-card {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.service-overlay-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--color-border);
}

.service-overlay-head h2 {
  margin: 0;
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-bold);
  line-height: 1.2;
}

.service-overlay-close {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-bg-alt);
  color: var(--color-text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.service-overlay-close:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.service-overlay-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.service-overlay-title {
  margin: 0;
  font-size: clamp(1rem, 0.88rem + 0.45vw, 1.2rem);
  font-weight: var(--font-weight-semibold);
  line-height: 1.2;
}

.service-overlay-price {
  margin: 0;
  font-size: clamp(1.05rem, 0.95rem + 0.45vw, 1.3rem);
  font-weight: var(--font-weight-bold);
  color: var(--color-text);
}

.service-overlay-description {
  margin: 0;
  font-size: var(--font-size-sm);
  line-height: 1.5;
  color: var(--color-text-muted);
  white-space: pre-wrap;
}

.service-overlay-meta {
  margin: 2px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.service-overlay-meta-row {
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: var(--font-size-sm);
}

.service-overlay-meta-row dt {
  color: var(--color-text-faint);
  font-weight: var(--font-weight-medium);
}

.service-overlay-meta-row dd {
  margin: 0;
  color: var(--color-text);
  font-weight: var(--font-weight-semibold);
}

.service-overlay-actions {
  padding: 0 14px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--color-border);
}

.service-overlay-contact-btn {
  width: 100%;
  min-height: 44px;
  margin-top: 12px;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--color-accent);
  background: var(--color-accent-soft);
  color: var(--color-text);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
}

.service-overlay-contact-btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.profile-announcements-overlay {
  position: fixed;
  inset: 0;
  z-index: 2500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(2, 6, 23, 0.52);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.profile-announcements-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.profile-announcements-overlay[hidden] {
  display: none !important;
}

.profile-announcements-modal {
  width: min(100%, 460px);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-lg);
  background: var(--color-bg-elevated);
  color: var(--color-text);
  box-shadow: 0 16px 38px rgba(2, 6, 23, 0.28);
  transform: translateY(8px) scale(0.98);
  opacity: 0;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.profile-announcements-overlay.is-open .profile-announcements-modal {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.profile-announcements-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 14px 8px;
}

.profile-announcements-head h2 {
  margin: 0;
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-bold);
  line-height: 1.2;
}

.profile-announcements-close {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-bg-alt);
  color: var(--color-text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  line-height: 1;
}

.profile-announcements-close:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.profile-announcements-message {
  margin: 0;
  padding: 0 14px 14px;
  font-size: var(--font-size-sm);
  line-height: 1.5;
  color: var(--color-text-muted);
}

@media (max-width: 560px) {
  .profile-card {
    margin: 8px;
  }

  .profile-identity-section {
    padding: 12px 12px 10px;
  }

  .profile-card-top {
    align-items: flex-start;
    flex-direction: row;
    gap: 10px;
  }

  .profile-logout-btn {
    width: auto;
    flex-shrink: 0;
  }

  .profile-photo {
    width: 40px;
    height: 40px;
  }

  .profile-stat-card {
    padding: 10px 6px 11px;
  }

  .profile-stat-value {
    font-size: 17px;
  }

  .profile-listings-toolbar {
    margin: 8px 8px 5px;
  }

  .profile-secondary-section {
    margin: 12px 8px 8px;
  }

  .profile-secondary-title {
    margin-bottom: 7px;
  }

  .profile-support-row {
    gap: 11px;
    padding: 13px 12px;
  }

  .profile-support-icon {
    width: 34px;
    height: 34px;
  }

  .profile-support-title {
    font-size: 14px;
  }

  .profile-support-subtitle {
    font-size: 12px;
  }

  .profile-announcements-overlay {
    padding: 12px;
    align-items: flex-end;
  }

  .service-overlay {
    padding: 12px;
    align-items: flex-end;
  }

  .service-overlay-card {
    width: 100%;
    border-radius: 14px;
  }

  .profile-announcements-modal {
    width: 100%;
    border-radius: 14px;
  }
}

#profile-empty {
  padding: var(--spacing-md);
  text-align: center;
  color: var(--color-text-muted);
}

.profile-empty-cta {
  display: inline-block;
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--color-accent);
  background: var(--color-accent-soft);
  color: var(--color-text);
}

/* =========================
   SELL FORM
   ========================= */

.sell-page {
  max-width: 760px;
  margin: 0 auto;
  padding: var(--spacing-sm) var(--spacing-sm)
    calc(112px + env(safe-area-inset-bottom));
}

.listing-page-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin: 4px 0 22px;
}

.listing-page-title {
  letter-spacing: -0.01em;
}

.listing-service-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--color-border-alt);
  background: var(--color-bg-alt);
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  line-height: 1;
  text-decoration: none;
  transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
}

.listing-service-cta:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
  background: var(--color-accent-soft);
}

.listing-service-cta:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.listing-mode-banner {
  --pill-border: var(--color-border-alt);
  --pill-bg: rgba(245, 158, 11, 0.14);
  --pill-color: #b45309;
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: 4px 10px;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  line-height: 1;
}

.listing-mode-banner[hidden] {
  display: none;
}

.listing-mode-banner.is-editing {
  --pill-border: rgba(245, 158, 11, 0.35);
  --pill-bg: rgba(245, 158, 11, 0.14);
  --pill-color: #b45309;
}

html[data-theme="dark"] .listing-mode-banner {
  --pill-bg: rgba(245, 158, 11, 0.16);
  --pill-color: #fbbf24;
}

@media (min-width: 768px) {
  .listing-page-header {
    margin: 6px 0 24px;
  }
}

#sellForm {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sell-form-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sell-form-section + .sell-form-section {
  border-top: 1px solid var(--color-border);
  padding-top: 14px;
}

.sell-form-section-title {
  margin: 0;
}

.sell-form-section-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.existing-images-preview {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.selected-images-preview {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.selected-images-preview[hidden] {
  display: none;
}

.selected-images-note {
  margin: 0;
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

.selected-images-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.selected-images-clear {
  font-size: 11px;
  line-height: 1;
  padding: 5px 9px;
}

.selected-images-grid {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.selected-image-tile {
  position: relative;
  flex: 0 0 86px;
  width: 86px;
  aspect-ratio: 1 / 1;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-bg-alt);
  overflow: hidden;
}

@media (min-width: 768px) {
  .selected-image-tile {
    flex-basis: 96px;
    width: 96px;
  }
}

.selected-image-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.selected-image-remove {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 22px;
  height: 22px;
  z-index: 2;
  border: 1px solid rgba(255, 255, 255, 0.6);
  background: rgba(7, 13, 28, 0.92);
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
}

.existing-images-preview[hidden] {
  display: none;
}

.existing-images-note {
  margin: 0;
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

.existing-images-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

@media (min-width: 768px) {
  .existing-images-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

.existing-image-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-bg-alt);
}

#sellForm label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: var(--font-size-sm);
}

#sellForm :is(input[type="text"], input[type="number"], input[type="tel"], select, textarea, input[type="file"]) {
  width: 100%;
}

#sellForm :is(input[type="text"], input[type="number"], input[type="tel"], select) {
  border-radius: var(--border-radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-bg-alt);
  color: var(--color-text);
  padding: 10px 12px;
  font-size: var(--font-size-sm);
}

#sellForm textarea {
  border-radius: var(--border-radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-bg-alt);
  color: var(--color-text);
  padding: 10px 12px;
  font-size: var(--font-size-sm);
  min-height: 110px;
  resize: vertical;
}

#sellForm input::placeholder,
#sellForm textarea::placeholder {
  color: var(--color-text-muted);
}

#sellForm input.input-error,
#sellForm select.input-error,
#sellForm textarea.input-error {
  border-color: var(--color-danger);
}

.field-error {
  min-height: 14px;
  margin: 0;
  font-size: 11px;
  line-height: 1.25;
  color: var(--color-danger);
}

#sellFields.is-collapsed .field-error,
#rentFields.is-collapsed .field-error {
  display: none;
}

#sellFields,
#rentFields {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  overflow: hidden;
  opacity: 1;
  max-height: 420px;
  transform: translateY(0);
  transition:
    opacity 160ms ease,
    max-height 220ms ease,
    transform 160ms ease;
}

#sellFields.is-collapsed,
#rentFields.is-collapsed {
  opacity: 0;
  max-height: 0;
  transform: translateY(-4px);
  pointer-events: none;
}

.sell-submit-area {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#postBtn {
  width: 100%;
  min-height: 42px;
  margin-top: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--color-accent);
  background: var(--color-accent-soft);
  color: var(--color-text);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
}

#postBtn.is-loading {
  cursor: wait;
}

#postBtn.is-loading::before {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(229, 231, 235, 0.35);
  border-top-color: var(--color-text);
  animation: sell-btn-spin 0.7s linear infinite;
}

#postBtn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

#postBtn.is-loading:disabled {
  cursor: wait;
}

#statusText {
  min-height: 18px;
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  margin: 0;
}

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

@media (min-width: 768px) {
  #sellFields,
  #rentFields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

}
