/* SBOit - Custom styles (Bootstrap 5.3 overrides + app-specific components)
   ========================================================================= */

/* ------------------------------------------------------------------
   1. CSS Custom Properties (steel-blue palette)
   ------------------------------------------------------------------ */
:root {
  --primary: #4a7c9b;
  --primary-dark: #3a6580;
  --primary-light: #6a9ab8;
  --secondary: #6b7a87;
  --success: #4a8a5e;
  --danger: #c0392b;
  --warning: #c8922a;
  --bg: #f5f7f8;
  --bg-white: #ffffff;
  --text: #2a3540;
  --text-light: #5e6d78;
  --border: #dce2e7;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(42, 53, 64, 0.08);
  --shadow-lg: 0 10px 15px -3px rgba(42, 53, 64, 0.1);
}

/* ------------------------------------------------------------------
   2. Bootstrap variable overrides
   ------------------------------------------------------------------ */
[data-bs-theme],
:root {
  --bs-primary: #4a7c9b;
  --bs-primary-rgb: 74, 124, 155;
  --bs-link-color: #4a7c9b;
  --bs-link-color-rgb: 74, 124, 155;
  --bs-link-hover-color: #3a6580;
  --bs-link-hover-color-rgb: 58, 101, 128;
}

/* ------------------------------------------------------------------
   3. Base overrides
   ------------------------------------------------------------------ */
body {
  background-color: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; }

.btn-primary {
  --bs-btn-bg: #4a7c9b;
  --bs-btn-border-color: #4a7c9b;
  --bs-btn-hover-bg: #3a6580;
  --bs-btn-hover-border-color: #3a6580;
  --bs-btn-active-bg: #325872;
  --bs-btn-active-border-color: #325872;
  --bs-btn-disabled-bg: #4a7c9b;
  --bs-btn-disabled-border-color: #4a7c9b;
}

.btn-success {
  --bs-btn-bg: #4a8a5e;
  --bs-btn-border-color: #4a8a5e;
  --bs-btn-hover-bg: #15803d;
  --bs-btn-hover-border-color: #15803d;
}

.btn-link { color: var(--primary); }
.btn-link.danger { color: var(--danger); }

a { color: var(--primary); }
a:hover { color: var(--primary-dark); }

/* ------------------------------------------------------------------
   4. Footer
   ------------------------------------------------------------------ */
.site-footer {
  background: var(--text);
  color: #cbd5e1;
  padding: 2.5rem 0 1.25rem;
  margin-top: 3rem;
}

.site-footer h5 { font-size: 1rem; }
.site-footer p { font-size: 0.9rem; }
.site-footer a {
  display: block;
  color: #cbd5e1;
  text-decoration: none;
  margin-bottom: 0.25rem;
  font-size: 0.9rem;
}
.site-footer a:hover { color: #fff; }

/* ------------------------------------------------------------------
   5. Listing cards & grid
   ------------------------------------------------------------------ */
.listing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}

.listing-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow 0.15s, transform 0.15s;
}
.listing-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.listing-card a { text-decoration: none; color: var(--text); }

.listing-card-img {
  position: relative;
  aspect-ratio: 4/3;
  background: #f1f5f9;
  overflow: hidden;
}
.listing-card-img img { width: 100%; height: 100%; object-fit: cover; }
.listing-card-img .no-image {
  display: flex; align-items: center; justify-content: center;
  height: 100%; color: var(--text-light);
}

.listing-type-badge {
  position: absolute; top: 0.5rem; left: 0.5rem;
  background: var(--primary); color: #fff;
  padding: 0.2rem 0.6rem; border-radius: 4px;
  font-size: 0.75rem; font-weight: 600; text-transform: uppercase;
}
.listing-type-badge.large { position: static; font-size: 0.85rem; padding: 0.3rem 0.75rem; }
.listing-type-badge.small { position: static; font-size: 0.7rem; padding: 0.15rem 0.5rem; }

.listing-card-body { padding: 1rem; }
.listing-card-body h3 {
  font-size: 1rem; margin-bottom: 0.25rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.listing-location { font-size: 0.85rem; color: var(--text-light); }
.listing-price { font-size: 1.1rem; font-weight: 700; color: var(--primary); margin-top: 0.5rem; }

/* ------------------------------------------------------------------
   6. Listing detail & gallery
   ------------------------------------------------------------------ */
.listing-detail {
  display: grid; grid-template-columns: 1fr 400px;
  gap: 2rem; margin: 2rem 0;
}

.gallery-main { border-radius: var(--radius); overflow: hidden; background: #f1f5f9; }
.gallery-main img { width: 100%; max-height: 500px; object-fit: contain; }
.no-image-lg {
  display: flex; align-items: center; justify-content: center;
  min-height: 300px; color: var(--text-light); font-size: 1.2rem;
}

.gallery-thumbs { display: flex; gap: 0.5rem; margin-top: 0.75rem; overflow-x: auto; }
.gallery-thumb {
  width: 80px; height: 60px; object-fit: cover;
  border-radius: 4px; cursor: pointer; border: 2px solid transparent;
}
.gallery-thumb:hover { border-color: var(--primary); }

.listing-info {
  background: var(--bg-white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem;
}
.listing-info-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; margin-bottom: 1rem;
}
.listing-info-header h1 { font-size: 1.5rem; }

.price-display { margin: 1rem 0; }
.price-display label { display: block; font-size: 0.85rem; color: var(--text-light); }
.price-display .price { font-size: 2rem; font-weight: 800; color: var(--primary); }

.sealed-bid-info {
  background: #f0f9ff; border: 1px solid #bae6fd;
  border-radius: var(--radius); padding: 1rem; margin: 1rem 0;
}

.specs-table { width: 100%; border-collapse: collapse; margin-top: 0.5rem; }
.specs-table td { padding: 0.4rem 0; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.specs-table td:first-child { font-weight: 600; width: 140px; color: var(--text-light); }

.item-specs-detail, .listing-description, .listing-contact { margin-top: 1.5rem; }
.item-specs-detail h3, .listing-description h3, .listing-contact h3 { margin-bottom: 0.5rem; }
.view-count { font-size: 0.85rem; color: var(--text-light); margin-top: 1.5rem; }

/* ------------------------------------------------------------------
   7. Bid forms
   ------------------------------------------------------------------ */
.bid-forms { margin-top: 1rem; }
.bid-actions { display: flex; gap: 0.75rem; margin-top: 1rem; }
.bid-form-inline { display: flex; gap: 0.75rem; align-items: flex-end; margin-bottom: 0.75rem; }
.bid-form-stack { margin-bottom: 0.75rem; }
.bid-form-stack .form-group { margin-bottom: 0.75rem; }
.bid-input {
  width: 100%; padding: 0.6rem 0.75rem;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 1.1rem; font-weight: 600;
}
.bid-input:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(74, 124, 155, 0.15);
}
.bid-count { font-size: 0.9rem; color: var(--text-light); margin: 0.25rem 0; }
.bid-amount-cell { font-weight: 700; color: var(--primary); }
.auction-timer { margin: 0.75rem 0; }
.auction-timer label { font-size: 0.85rem; color: var(--text-light); display: block; }

/* ------------------------------------------------------------------
   8. Status badges (app-specific colors)
   ------------------------------------------------------------------ */
.badge.DRAFT { background: #f1f5f9; color: #475569; }
.badge.PENDING_VERIFICATION { background: #fef3c7; color: #b45309; }
.badge.VERIFIED { background: #dbeafe; color: #1d4ed8; }
.badge.ACTIVE { background: #d1fae5; color: #065f46; }
.badge.ENDED { background: #e2e8f0; color: #475569; }
.badge.SOLD { background: #d1fae5; color: #065f46; }
.badge.CREATED { background: #f1f5f9; color: #475569; }
.badge.ASSIGNED { background: #dbeafe; color: #1d4ed8; }
.badge.IN_PROGRESS { background: #fef3c7; color: #b45309; }
.badge.COMPLETED { background: #d1fae5; color: #065f46; }
.badge.CANCELED { background: #fee2e2; color: #991b1b; }
.badge.WON { background: #d1fae5; color: #065f46; }
.badge.LOST { background: #fee2e2; color: #991b1b; }
.badge.OUTBID { background: #fef3c7; color: #b45309; }
.badge.RETRACTED { background: #e2e8f0; color: #475569; }

/* ------------------------------------------------------------------
   9. Stats grid (admin dashboard)
   ------------------------------------------------------------------ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem; margin-bottom: 2rem;
}
.stat-card {
  background: var(--bg-white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem; text-align: center;
}
.stat-number { font-size: 2.5rem; font-weight: 800; color: var(--primary); }
.stat-label { font-size: 0.9rem; color: var(--text-light); margin-top: 0.25rem; }

/* ------------------------------------------------------------------
   10. Photo grid (media management)
   ------------------------------------------------------------------ */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem;
}
.photo-grid.small { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.photo-card { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }
.photo-card img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; }
.photo-info {
  padding: 0.5rem; font-size: 0.8rem;
  display: flex; justify-content: space-between; align-items: center;
}

/* ------------------------------------------------------------------
   11. App layout helpers
   ------------------------------------------------------------------ */
.hero { text-align: center; padding: 4rem 0 3rem; }
.hero h1 { font-size: 3rem; font-weight: 800; letter-spacing: -1px; margin-bottom: 0.75rem; }
.hero p { font-size: 1.25rem; color: var(--text-light); margin-bottom: 2rem; }
.hero-actions { display: flex; gap: 1rem; justify-content: center; }

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}
.category-card {
  background: var(--bg-white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem;
  text-decoration: none; color: var(--text);
  transition: all 0.15s; text-align: center;
}
.category-card:hover { border-color: var(--primary); box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.category-card h3 { font-size: 1.1rem; margin-bottom: 0.25rem; }
.category-card p { font-size: 0.85rem; color: var(--text-light); }

.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 2rem; }
.step { text-align: center; }
.step-number {
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.25rem; font-weight: 700; margin-bottom: 0.75rem;
}
.step h3 { margin-bottom: 0.5rem; }
.step p { color: var(--text-light); font-size: 0.9rem; }

.auth-form {
  max-width: 440px; margin: 3rem auto;
  background: var(--bg-white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 2.5rem;
}
.auth-form h2 { text-align: center; margin-bottom: 1.5rem; }
.auth-links { text-align: center; margin-top: 1.5rem; font-size: 0.9rem; }

.error-page { text-align: center; padding: 4rem 0; }
.error-page h1 { font-size: 5rem; color: var(--text-light); }
.error-page p { margin: 1rem 0 2rem; color: var(--text-light); }

.dashboard-header {
  display: flex; align-items: center; justify-content: space-between;
  margin: 1.5rem 0;
}
.empty-state {
  text-align: center; padding: 3rem;
  background: var(--bg-white); border: 1px solid var(--border); border-radius: var(--radius);
}
.empty-state p { color: var(--text-light); margin-bottom: 1rem; }

.browse-layout { display: grid; grid-template-columns: 220px 1fr; gap: 2rem; }
.category-sidebar h3 { margin-bottom: 0.75rem; }
.category-sidebar ul { list-style: none; padding-left: 0; }
.category-sidebar li { margin-bottom: 0.25rem; }
.category-sidebar a {
  color: var(--text); text-decoration: none; font-size: 0.9rem;
  padding: 0.25rem 0; display: block;
}
.category-sidebar a:hover, .category-sidebar a.active { color: var(--primary); font-weight: 600; }

.form-page { max-width: 800px; margin: 2rem auto; }
.form-page h1 { margin-bottom: 0.5rem; }
.listing-form fieldset {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.5rem; margin-bottom: 1.5rem; background: var(--bg-white);
}
.listing-form legend { font-weight: 700; font-size: 1.1rem; padding: 0 0.5rem; }
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.search-bar { display: flex; gap: 0.75rem; margin-bottom: 1rem; }
.search-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
}
.search-results-count { color: var(--text-light); font-size: 0.9rem; margin-bottom: 1rem; }

.item-specs { font-size: 0.9rem; color: var(--text-light); margin-top: 0.5rem; }

/* ------------------------------------------------------------------
   12. Responsive adjustments
   ------------------------------------------------------------------ */
@media (max-width: 768px) {
  .hero h1 { font-size: 2rem; }
  .hero-actions { flex-direction: column; align-items: center; }
  .browse-layout { grid-template-columns: 1fr; }
  .category-sidebar { display: none; }
  .listing-detail { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .bid-form-inline { flex-direction: column; align-items: stretch; }
}
