/* ============================================================
   CAMPUS KARTT — Design System v5.0
   Theme: "Warm Night" — Not Too Dark, Not Light
   Orange #F26522 | Teal #0B8B8B | DTU Maroon #8B1A1A
   Bg: #1A1614 warm charcoal | Text: #EDE9E3 warm cream
   Fonts: Plus Jakarta Sans + Inter + JetBrains Mono
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Inter:wght@300;400;500;600&family=JetBrains+Mono:wght@400;500;700&display=swap');

:root {
  /* ── Brand Palette ── */
  --orange:         #F26522;
  --orange-bright:  #FF7A30;
  --orange-dark:    #C94E0F;
  --orange-soft:    rgba(242, 101, 34, 0.12);
  --orange-border:  rgba(242, 101, 34, 0.25);

  --teal:           #0B8B8B;
  --teal-bright:    #0DA8A8;
  --teal-dark:      #086B6B;
  --teal-soft:      rgba(11, 139, 139, 0.12);
  --teal-border:    rgba(11, 139, 139, 0.25);

  --maroon:         #8B1A1A;
  --maroon-soft:    rgba(139, 26, 26, 0.12);

  --gold:           #F5C842;
  --gold-soft:      rgba(245, 200, 66, 0.12);

  /* ── Backgrounds (warm charcoal — not pure black) ── */
  --bg:             #1A1614;
  --bg-page:        #1A1614;
  --bg-surface:     #231F1C;
  --bg-card:        #2A2520;
  --bg-card-hover:  #302B26;
  --bg-input:       rgba(32, 28, 24, 0.95);
  --bg-overlay:     rgba(18, 14, 12, 0.75);

  /* ── Text (warm cream) ── */
  --text-primary:   #EDE9E3;
  --text-secondary: #ABA49C;
  --text-muted:     rgba(171, 164, 156, 0.55);
  --text-light:     rgba(171, 164, 156, 0.30);
  --text-inverse:   #1A1614;

  /* ── Borders ── */
  --border:         rgba(255, 255, 255, 0.07);
  --border-warm:    rgba(242, 101, 34, 0.15);
  --border-focus:   rgba(242, 101, 34, 0.50);

  /* ── Shadows ── */
  --shadow-xs:   0 1px 3px rgba(0,0,0,0.4);
  --shadow-sm:   0 2px 8px rgba(0,0,0,0.45), 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md:   0 4px 16px rgba(0,0,0,0.50), 0 2px 6px rgba(0,0,0,0.35);
  --shadow-lg:   0 8px 32px rgba(0,0,0,0.55), 0 4px 12px rgba(0,0,0,0.40);
  --shadow-xl:   0 20px 60px rgba(0,0,0,0.65);
  --shadow-orange: 0 4px 20px rgba(242,101,34,0.30);
  --shadow-glow:   0 0 0 3px rgba(242,101,34,0.18);

  /* ── Shape ── */
  --radius-xs:  4px;
  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  18px;
  --radius-xl:  24px;
  --radius-full:100px;

  /* ── Motion ── */
  --transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  --spring:     all 0.36s cubic-bezier(0.34, 1.56, 0.64, 1);

  /* ── Legacy compat (used by JS-generated HTML) ── */
  --green-bright:  #22C55E;
  --green-mid:     #16A34A;
  --green-deep:    #14532D;
  --cream:         #2A2520;
  --cream-dark:    #302B26;
  --cream-darker:  #3A342E;
  --card-bg:       #2A2520;
  --warning:       #F5C842;
  --danger:        #EF4444;
  --success:       #22C55E;
  --green:         #22C55E;
  --border-focus-green: rgba(242,101,34,0.50);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ── Typography ── */
h1, h2, h3, h4 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
}
h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); }
h3 { font-size: clamp(1rem, 2vw, 1.3rem); }
p  { color: var(--text-secondary); line-height: 1.7; }

.text-muted   { color: var(--text-muted); font-size: 0.875rem; }
.text-small   { font-size: 0.82rem; }
.text-center  { text-align: center; }
.mono         { font-family: 'JetBrains Mono', monospace; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.65rem 1.4rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 700;
  font-family: 'Plus Jakarta Sans', sans-serif;
  transition: var(--transition);
  white-space: nowrap;
  line-height: 1;
  border: none;
  cursor: pointer;
}
.btn-primary {
  background: var(--orange);
  color: white;
  box-shadow: 0 2px 12px rgba(242,101,34,0.30);
}
.btn-primary:hover {
  background: var(--orange-bright);
  box-shadow: 0 4px 20px rgba(242,101,34,0.45);
  transform: translateY(-1px);
}
.btn-teal {
  background: var(--teal);
  color: white;
  box-shadow: 0 2px 12px rgba(11,139,139,0.25);
}
.btn-teal:hover {
  background: var(--teal-bright);
  transform: translateY(-1px);
}
.btn-outline {
  background: transparent;
  color: var(--orange);
  border: 1.5px solid var(--orange-border);
}
.btn-outline:hover {
  background: var(--orange-soft);
  border-color: var(--orange);
}
.btn-ghost {
  background: rgba(255,255,255,0.06);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  background: rgba(255,255,255,0.10);
  color: var(--text-primary);
}
.btn-danger {
  background: rgba(239,68,68,0.10);
  color: #F87171;
  border: 1px solid rgba(239,68,68,0.25);
}
.btn-danger:hover { background: rgba(239,68,68,0.20); }
.btn-lg   { padding: 0.9rem 2rem; font-size: 0.95rem; }
.btn-sm   { padding: 0.38rem 0.85rem; font-size: 0.72rem; }
.btn-full { width: 100%; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; }
.btn-loading { position: relative; color: transparent !important; }
.btn-loading::after {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.25);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ── Forms ── */
.form-group { display: flex; flex-direction: column; gap: 0.45rem; margin-bottom: 1.1rem; }
.form-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-family: 'JetBrains Mono', monospace;
}
.form-control {
  width: 100%;
  padding: 0.72rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 0.9rem;
  transition: var(--transition);
  outline: none;
}
.form-control:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(242,101,34,0.12);
}
.form-control::placeholder { color: var(--text-light); }
select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%23ABA49C' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1.1em;
  padding-right: 2.5rem;
}
textarea.form-control { resize: vertical; min-height: 100px; }
.form-hint  { font-size: 0.75rem; color: var(--text-muted); }
.form-error { font-size: 0.75rem; color: #F87171; }

.password-wrap { position: relative; }
.password-wrap .form-control { padding-right: 3rem; }
.toggle-password {
  position: absolute;
  right: 0.75rem; top: 50%;
  transform: translateY(-50%);
  background: none; border: none;
  color: var(--text-muted);
  cursor: pointer; padding: 0;
  opacity: 0.5;
  transition: var(--transition);
}
.toggle-password:hover { opacity: 1; color: var(--orange); }

/* ── Listing Cards ── */
.listing-card, .eco-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: var(--transition);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  position: relative;
}
.listing-card:hover, .eco-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--orange-border);
}
.listing-card-image, .eco-card-img img {
  width: 100%; aspect-ratio: 4/3;
  object-fit: cover;
  background: var(--bg-surface);
  transition: transform 0.35s ease;
  display: block;
}
.listing-card:hover .listing-card-image,
.eco-card:hover .eco-card-img img { transform: scale(1.05); }
.eco-card-img { overflow: hidden; aspect-ratio: 4/3; }

.listing-card-image-placeholder, .eco-card-placeholder {
  width: 100%; aspect-ratio: 4/3;
  background: linear-gradient(135deg, var(--bg-surface), var(--bg-card));
  display: flex; align-items: center; justify-content: center;
  font-size: 2.8rem;
}
.listing-card-body, .eco-card-body {
  padding: 0.9rem 1rem;
  flex: 1; display: flex; flex-direction: column; gap: 0.3rem;
}
.listing-card-category, .eco-card-cat {
  font-size: 0.6rem; font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  text-transform: uppercase; letter-spacing: 0.10em;
  color: var(--orange);
}
.listing-card-title, .eco-card-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.9rem; font-weight: 700;
  color: var(--text-primary);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.listing-card-price, .eco-card-price {
  font-size: 1.15rem; font-weight: 800;
  color: var(--gold);
  margin-top: 0.2rem;
  font-family: 'Plus Jakarta Sans', sans-serif;
}
.listing-card-footer, .eco-card-footer {
  padding: 0.6rem 1rem;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(0,0,0,0.12);
}

/* ── Listings Grid ── */
.listings-grid, .eco-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 1.1rem;
}

/* ── Badges ── */
.badge {
  display: inline-flex; align-items: center;
  padding: 0.18rem 0.55rem;
  border-radius: var(--radius-full);
  font-size: 0.62rem; font-weight: 700;
  letter-spacing: 0.04em;
  font-family: 'JetBrains Mono', monospace;
  text-transform: uppercase;
}
.badge-green  { background: rgba(34,197,94,0.12);  color: #4ADE80; border: 1px solid rgba(34,197,94,0.25); }
.badge-yellow { background: rgba(245,200,66,0.12);  color: #FCD34D; border: 1px solid rgba(245,200,66,0.25); }
.badge-blue   { background: rgba(59,130,246,0.12);  color: #93C5FD; border: 1px solid rgba(59,130,246,0.25); }
.badge-red    { background: rgba(239,68,68,0.12);   color: #F87171; border: 1px solid rgba(239,68,68,0.25); }
.badge-orange { background: var(--orange-soft);     color: var(--orange); border: 1px solid var(--orange-border); }
.badge-teal   { background: var(--teal-soft);       color: var(--teal-bright); border: 1px solid var(--teal-border); }
.badge-gray   { background: rgba(255,255,255,0.06); color: var(--text-secondary); border: 1px solid var(--border); }

/* ── Alerts ── */
.alert {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.86rem; font-weight: 500;
  margin-bottom: 1rem;
}
.alert-error   { background: rgba(239,68,68,0.10);  color: #F87171; border: 1px solid rgba(239,68,68,0.25); }
.alert-success { background: rgba(34,197,94,0.10);  color: #4ADE80; border: 1px solid rgba(34,197,94,0.25); }
.alert-info    { background: rgba(11,139,139,0.10); color: #5EEAD4; border: 1px solid rgba(11,139,139,0.25); }

/* ── Toast ── */
#toast-container {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  z-index: 9999; display: flex; flex-direction: column; gap: 0.5rem;
}
.toast {
  background: var(--bg-surface);
  border: 1px solid var(--border-warm);
  color: var(--text-primary);
  padding: 0.8rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.86rem; font-weight: 600;
  font-family: 'Plus Jakarta Sans', sans-serif;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease;
  max-width: 320px;
}
.toast.toast-error   { border-color: rgba(239,68,68,0.4); color: #F87171; }
.toast.toast-success { border-color: rgba(34,197,94,0.35); color: #4ADE80; }

/* ── Upload Area ── */
.upload-area {
  border: 2px dashed var(--orange-border);
  border-radius: var(--radius-md);
  padding: 2.5rem 1.5rem;
  text-align: center; cursor: pointer;
  transition: var(--transition);
  background: var(--bg-input);
}
.upload-area:hover, .upload-area.drag-over {
  border-color: var(--orange);
  background: var(--orange-soft);
}
.upload-icon { font-size: 2.5rem; margin-bottom: 0.75rem; }
.upload-area p { font-size: 0.875rem; color: var(--text-muted); }
.upload-area strong { color: var(--orange); }

/* ── Image Preview ── */
.image-preview-wrap { position: relative; border-radius: var(--radius-md); overflow: hidden; max-height: 280px; }
.image-preview-wrap img { width: 100%; height: 280px; object-fit: cover; }
.image-preview-remove {
  position: absolute; top: 0.5rem; right: 0.5rem;
  background: rgba(0,0,0,0.7); color: white;
  border-radius: 50%; width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 0.85rem; transition: var(--transition);
}
.image-preview-remove:hover { background: var(--orange); }

/* ── Sidebar ── */
.sidebar {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  padding: 1.25rem;
  position: sticky; top: 84px;
}
.sidebar h3 {
  font-size: 0.58rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  margin-bottom: 0.75rem;
}

/* ── Filter Pills ── */
.filter-pill {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem; font-weight: 600;
  font-family: 'Plus Jakarta Sans', sans-serif;
  color: var(--text-secondary);
  cursor: pointer; transition: var(--transition);
  border: none; background: transparent; width: 100%; text-align: left;
}
.filter-pill:hover { background: var(--orange-soft); color: var(--text-primary); }
.filter-pill.active {
  background: var(--orange-soft);
  color: var(--orange);
  font-weight: 700;
  border: 1px solid var(--orange-border);
}
.filter-pill .pill-icon { font-size: 1em; }
.filter-pill .pill-count {
  margin-left: auto;
  font-size: 0.62rem;
  background: rgba(255,255,255,0.06);
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-full);
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

/* ── Price range ── */
.price-range { display: flex; gap: 0.5rem; align-items: center; }
.price-range input {
  width: 80px; padding: 0.4rem 0.6rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.8rem; outline: none;
  background: var(--bg-input); color: var(--text-primary);
}
.price-range input:focus { border-color: var(--orange); }
.price-range span { color: var(--text-muted); font-size: 0.8rem; }
.condition-checkboxes { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.5rem; }
.condition-check { display: flex; align-items: center; gap: 0.5rem; font-size: 0.855rem; color: var(--text-secondary); cursor: pointer; }
.condition-check input { accent-color: var(--orange); }

/* ── Skeleton ── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-surface) 25%, var(--bg-card) 50%, var(--bg-surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
}
.skeleton-card { background: var(--bg-card); border-radius: var(--radius-md); overflow: hidden; border: 1px solid var(--border); }
.skeleton-img  { width: 100%; aspect-ratio: 4/3; }
.skeleton-body { padding: 1rem; display: flex; flex-direction: column; gap: 0.5rem; }
.skeleton-line { height: 12px; border-radius: 6px; }
.skeleton-price{ height: 20px; width: 55%; border-radius: 6px; }

/* ── Avatar ── */
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--orange), var(--orange-dark));
  color: white; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.82rem;
  font-family: 'JetBrains Mono', monospace;
  flex-shrink: 0; border: 2px solid rgba(242,101,34,0.35);
}

/* ── Dropdown ── */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; top: calc(100% + 8px); right: 0;
  background: #1E1B18; border: 1px solid var(--orange-border);
  border-radius: var(--radius-md); box-shadow: var(--shadow-xl);
  min-width: 200px; z-index: 50; overflow: hidden;
  animation: slideDown 0.18s ease;
}
.dropdown-item {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.65rem 1rem;
  font-size: 0.82rem; font-family: 'Plus Jakarta Sans', sans-serif;
  color: var(--text-secondary); cursor: pointer; transition: var(--transition);
}
.dropdown-item:hover { background: var(--orange-soft); color: var(--text-primary); }
.dropdown-item.danger { color: #F87171; }
.dropdown-item.danger:hover { background: rgba(239,68,68,0.10); }
.dropdown-divider { border-top: 1px solid var(--border); margin: 0.3rem 0; }

/* ── Page layout ── */
.page-container { max-width: 1280px; margin: 0 auto; padding: 0 1.5rem; }
.layout-with-sidebar { display: grid; grid-template-columns: 255px 1fr; gap: 1.5rem; align-items: start; }

/* ── Divider ── */
.divider { border: none; border-top: 1px solid var(--border); margin: 1.25rem 0; }

/* ── Empty State ── */
.empty-state { text-align: center; padding: 4rem 1rem; }
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 1rem; }
.empty-state h3 { font-size: 1.1rem; color: var(--text-secondary); margin-bottom: 0.5rem; }
.empty-state p { font-size: 0.875rem; margin-bottom: 1.5rem; }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.75); backdrop-filter: blur(6px);
  z-index: 200; display: flex; align-items: center; justify-content: center;
  padding: 1rem; animation: fadeIn 0.2s ease;
}
.modal {
  background: var(--bg-surface);
  border: 1px solid var(--orange-border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-xl);
  width: 100%; max-width: 500px; max-height: 90vh; overflow-y: auto;
  animation: slideUp 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
.modal-header { padding: 1.5rem 1.5rem 1rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-body { padding: 1.5rem; }
.modal-close {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.05); color: var(--text-muted);
  font-size: 1.1rem; cursor: pointer; transition: var(--transition);
}
.modal-close:hover { background: var(--orange-soft); color: var(--orange); }

/* ── Search bar ── */
.search-bar { position: relative; }
.search-bar input {
  width: 100%; padding: 0.6rem 1rem 0.6rem 2.75rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input); color: var(--text-primary);
  font-size: 0.86rem; transition: var(--transition); outline: none;
}
.search-bar input:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(242,101,34,0.10); }
.search-bar input::placeholder { color: var(--text-light); }
.search-bar .search-icon {
  position: absolute; left: 0.85rem; top: 50%;
  transform: translateY(-50%); color: var(--text-muted); pointer-events: none;
}

/* ── Animations ── */
@keyframes spin      { to { transform: rotate(360deg); } }
@keyframes shimmer   { to { background-position: -200% 0; } }
@keyframes fadeIn    { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideIn   { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: translateX(0); } }
@keyframes slideUp   { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse     { 0%,100%{opacity:1} 50%{opacity:0.5} }
@keyframes blink     { 0%,100%{opacity:1} 50%{opacity:0.3} }

/* ── Utilities ── */
.hidden          { display: none !important; }
.flex            { display: flex; }
.flex-col        { display: flex; flex-direction: column; }
.items-center    { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; } .gap-2 { gap: 1rem; } .gap-3 { gap: 1.5rem; }
.mt-1 { margin-top: 0.5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; } .mb-2 { margin-bottom: 1rem; }
.w-full { width: 100%; }
.rounded { border-radius: var(--radius-sm); }
.overflow-hidden { overflow: hidden; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .layout-with-sidebar { grid-template-columns: 1fr; }
  .sidebar { position: static; }
}
@media (max-width: 768px) {
  .listings-grid, .eco-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 0.85rem; }
  .page-container { padding: 0 1rem; }
}
@media (max-width: 480px) {
  .listings-grid, .eco-grid { grid-template-columns: 1fr 1fr; gap: 0.7rem; }
}
