
/* ---------- Tokens ---------- */
:root {
  --bg: #0f1115;
  --surface: #171b24;
  --surface-2: #1f2532;
  --text: #e9ecf3;
  --muted: #9aa3b2;
  --border: #2c3443;

  --primary: #6aa9ff;
  --primary-strong: #3d8bff;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;

  --radius: 12px;
  --radius-sm: 10px;
  --shadow: 0 8px 20px rgba(0,0,0,.25);

  --container: 1120px;
  --sp-1: 8px;  --sp-2: 12px; --sp-3: 16px; --sp-4: 24px; --sp-5: 32px;
  --ring: 0 0 0 3px rgba(61,139,255,.28);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f6f7fb;
    --surface: #ffffff;
    --surface-2: #f1f4fb;
    --text: #0b1120;
    --muted: #5b6275;
    --border: #e5e7ef;
    --shadow: 0 8px 20px rgba(15,23,42,.08);
  }
}

/* ============================= Base =================================================*/
* { 
  box-sizing: 
  border-box;
 }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { 
  color: var(--primary); 
  text-decoration: none; }
a:hover { 
  color: var(--primary-strong); }

img { 
  max-width: 100%; 
  display: block; 
  height: auto; }

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: var(--sp-5) var(--sp-4);
}

/* ====================Nav =================== */
.nav {
  position: sticky; 
  top: 0;
  z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-2) var(--sp-4);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.nav .brand { font-weight: 800; color: var(--text); letter-spacing: .2px; }
.nav a, .nav .link {
  color: var(--text);
  margin-left: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: background .15s ease, border-color .15s ease, transform .12s ease;
}
.nav a:hover, .nav .link:hover { 
  background: var(--surface-2); 
  border-color: var(--border); 
  transform: translateY(-1px); }
.link { 
  background: none; 
  border: none; 
  cursor: pointer; }

/* =======================================Hero + Filters ===============================*/
.hero { 
  margin-bottom: var(--sp-4); 
}
.hero h1 { 
  margin: 0 0 var(--sp-2);
   font-size: clamp(26px, 4vw, 38px); }

.filters {
  display: grid;
  grid-template-columns: 1.2fr 1fr 150px 150px auto;
  gap: var(--sp-2);
  align-items: center;
}
@media (max-width: 900px) { 
  .filters { 
    grid-template-columns: 1fr 1fr; 
  } }

.filters input, .filters select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  outline: none;
  transition: box-shadow .15s ease, border-color .15s ease;
}
.filters input:focus, .filters select:focus {
   border-color: var(--primary-strong); 
   box-shadow: var(--ring); }
.filters button {
  padding: 10px 14px;
  border-radius: 10px;
  border: 0;
  cursor: pointer;
  background: linear-gradient(180deg, var(--primary), var(--primary-strong));
  color: #fff;
  font-weight: 600;
  transition: transform .12s ease, box-shadow .15s ease;
}
.filters button:hover { 
  transform: translateY(-1px);
  box-shadow: var(--shadow); }

/* ---------- Grid & Cards ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--sp-3);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-2);
  box-shadow: var(--shadow);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.card:hover { 
  transform: translateY(-2px); 
  border-color: var(--primary); 
}
.card h3 { 
  margin: 10px 0 6px; 
  font-size: 18px; 
}
.card .meta { 
  color: var(--muted); 
  font-size: 14px; }
.card .price { 
  font-weight: 700; 
  margin-top: 6px; }


.card .poster,
.card img.poster,
.card > a > img:not([class]) {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

/* =======================================Details page =======================================*/
.details {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: var(--sp-4);
}
@media (max-width: 900px) {
   .details { 
    grid-template-columns: 1fr; 
  } }

.details .poster,
.details > img:not([class]) {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.details h1 { margin: 0 0 8px; font-size: clamp(24px, 4vw, 34px); }
.details .badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
}
.details .price { 
  font-size: 22px; 
  font-weight: 800; 
  margin: var(--sp-2) 0; }

/*================================================== Buttons =========================================*/
button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  transition: transform .12s ease, border-color .15s ease, box-shadow .15s ease;
}
button:hover, .button:hover { 
  border-color: var(--primary);
  transform: translateY(-1px); }
button.primary { 
  background: linear-gradient(180deg, var(--primary), var(--primary-strong)); 
  color: #fff; 
  border: 0; }
button.danger { 
  background: #7f1d1d; 
  color: #fff; 
  border-color: #6b1515; }
button:disabled { 
  opacity: .6; 
  cursor: not-allowed; }

/*====================================================== Forms ====================================== */
.form label { 
  display: block; 
  margin: 0 0 var(--sp-2); 
  font-weight: 600; }
.form input, .form textarea, .form select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  outline: none;
  transition: box-shadow .15s ease, border-color .15s ease;
}
.form textarea { 
  min-height: 120px; 
  resize: vertical; }
.form input:focus, .form textarea:focus, .form select:focus { 
  border-color: var(--primary-strong); 
  box-shadow: var(--ring); 
}
.form .actions {
   display: flex; 
   gap: var(--sp-2); 
   margin-top: var(--sp-3); 
   flex-wrap: wrap; }

/* =============================================== Alerts ======================================= */
.alert {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  margin: var(--sp-2) 0;
}
.alert-success { 
  background: #0f2b1f; 
  color: #b7f3d5; 
  border-color: #1d5f46; }
.alert-error   { 
  background: #2b1414; 
  color: #f7b4b4; 
  border-color: #6b1d1d; }
.alert-warning {
   background: #2b240f; 
   color: #f6e0a6; 
   border-color: #7a671f; }

/* =================================================== Table ===================================*/
.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.table th, .table td { 
  padding: 12px 14px; 
  border-bottom: 1px solid var(--border); 
  text-align: left; 
}
.table thead th {
   background: var(--surface-2); 
   color: var(--muted); 
   font-weight: 700;
   }
.table tfoot td { 
  background: var(--surface-2); 
  font-weight: 700;
 }

/*============================================= Footer ================================== */
.footer {
  margin-top: var(--sp-5);
  padding: var(--sp-4);
  text-align: center;
  color: var(--muted);
  border-top: 1px solid var(--border);
}
/*============================================== Utilities =================================*/
.mute {
  color: var(--muted); 
}
.badge { 
  display: inline-block; 
  padding: 4px 10px; 
  border-radius: 999px; 
  background: var(--surface-2); 
  border: 1px solid var(--border); 
  color: var(--muted); 
  font-size: 12px; 
}
.stack-sm { 
  display: flex;  
  flex-direction: column; 
  gap: var(--sp-1);
 }
.stack  { 
  display: flex;  
  flex-direction: column; 
  gap: var(--sp-2); 
}
.stack-lg { 
  display: flex;  
  flex-direction: column; 
  gap: var(--sp-3);
 }

/*===================================== Page tweaks ==============================================*/
.index .card form { 
  margin-top: var(--sp-2); 
  display: flex; 
  gap: 8px; 
  align-items: center;
 }
.index .card input[type="number"] {
  width: 86px;
  text-align: center;
  background: var(--surface);
  border-radius: 10px;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px;
}

/* ====================================Focus visible ==========================================*/
:focus-visible { 
  outline: none; 
  box-shadow: var(--ring); 
  border-color: var(--primary-strong); 
}
