/* ============================================================
   Automation Service — Admin panel (black & gold, responsive)
   ============================================================ */

:root {
  --gold: #e6c06a;
  --gold-2: #f0d692;
  --gold-dim: rgba(230, 192, 106, 0.12);
  --bg: #0b0b0d;
  --panel: #141417;
  --panel-2: #1a1a1f;
  --line: #2b2b31;
  --text: #ece9e1;
  --muted: #a19c90;
  --danger: #e06666;
  --danger-bg: rgba(224, 102, 102, 0.10);
  --ok: #6fcf97;
  --ok-bg: rgba(111, 207, 151, 0.12);
  --warn: #e6c06a;
  --warn-bg: rgba(230, 192, 106, 0.12);
  --info: #7fb4e6;
  --info-bg: rgba(127, 180, 230, 0.12);
  --radius: 12px;
  --sidebar-w: 248px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 system-ui, "Segoe UI", Roboto, "Noto Sans Bengali", "Hind Siliguri", sans-serif;
}

a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { font-weight: 600; line-height: 1.3; margin: 0 0 12px; }
h1 { font-size: 21px; }
h2 { font-size: 17px; color: var(--gold); border-bottom: 1px solid var(--line); padding-bottom: 8px; }
code {
  background: #000; border: 1px solid var(--line); border-radius: 6px;
  padding: 1px 6px; font-size: 13px; color: var(--gold-2);
}

/* ---------------- layout ---------------- */

.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: linear-gradient(180deg, #101013 0%, #0c0c0f 100%);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--line);
}
.brand-dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--gold-2), var(--gold) 60%, #8a6d2c);
  box-shadow: 0 0 12px rgba(230, 192, 106, 0.6);
  flex: 0 0 12px;
}
.brand-dot.big { width: 22px; height: 22px; flex-basis: 22px; margin: 0 auto 6px; }
.brand strong { display: block; font-size: 15px; color: var(--text); }
.brand small { color: var(--muted); font-size: 12px; }

.nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.nav a {
  display: block; padding: 10px 14px; margin: 2px 0;
  color: #cfc9bb; border-radius: 8px; font-size: 14.5px;
  border: 1px solid transparent;
}
.nav a:hover { background: var(--gold-dim); color: var(--text); text-decoration: none; }
.nav a.active {
  background: linear-gradient(90deg, rgba(230,192,106,0.18), rgba(230,192,106,0.05));
  border-color: rgba(230,192,106,0.35);
  color: var(--gold-2);
  box-shadow: inset 3px 0 0 var(--gold);
}

.sidebar-foot {
  padding: 14px 12px; border-top: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.user-chip {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px;
  padding: 4px 12px; font-size: 13px; color: var(--gold-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.main { flex: 1; min-width: 0; }
.topbar {
  padding: 18px 26px;
  border-bottom: 1px solid var(--line);
  background: rgba(20,20,23,0.7);
  backdrop-filter: blur(4px);
  position: sticky; top: 0; z-index: 5;
}
.topbar h1 { margin: 0; }
.content { padding: 22px 26px 60px; max-width: 1180px; }

/* ---------------- cards & tables ---------------- */

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 18px;
}
.card-danger { border-color: rgba(224,102,102,0.45); background: linear-gradient(180deg, #1a1315, var(--panel)); }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat {
  background: linear-gradient(160deg, #191920, var(--panel));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; text-align: center;
}
.stat-num { display: block; font-size: 28px; font-weight: 700; color: var(--gold-2); }
.stat-label { color: var(--muted); font-size: 13px; }
.rev-est { font-size: 18px; margin: 4px 0 10px; }
.rev-est strong { color: var(--gold-2); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 640px; }
th {
  text-align: left; font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
td { padding: 10px; border-bottom: 1px solid rgba(43,43,49,0.6); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr.row-off td { opacity: 0.55; }

.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.badge-pending   { background: var(--warn-bg); color: var(--warn);   border: 1px solid rgba(230,192,106,0.4); }
.badge-contacted { background: var(--info-bg); color: var(--info);   border: 1px solid rgba(127,180,230,0.4); }
.badge-completed { background: var(--ok-bg);   color: var(--ok);     border: 1px solid rgba(111,207,151,0.4); }
.badge-cancelled { background: rgba(160,160,170,0.12); color: var(--muted); border: 1px solid rgba(160,160,170,0.35); }

.pill {
  display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px;
  font-size: 11.5px; color: #2a2108; background: var(--gold); font-weight: 600;
}
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.row-actions form { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.pre { white-space: pre-wrap; }
.col-span, .field-wide { grid-column: 1 / -1; }
.inline-form { display: inline; }
.pager { display: flex; gap: 6px; margin: 14px 0 4px; flex-wrap: wrap; }
.pg {
  min-width: 32px; text-align: center; padding: 5px 8px;
  border: 1px solid var(--line); border-radius: 8px; color: var(--text);
  background: var(--panel-2); font-size: 13.5px;
}
.pg:hover { text-decoration: none; border-color: var(--gold); }
.pg.cur { background: var(--gold); color: #17130a; border-color: var(--gold); font-weight: 700; }

/* ---------------- buttons ---------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: 9px; border: 1px solid transparent; cursor: pointer;
  font-size: 14px; padding: 9px 16px; font-family: inherit; line-height: 1.2;
  text-decoration: none; transition: filter .15s ease, background .15s ease;
}
.btn:hover { filter: brightness(1.12); text-decoration: none; }
.btn:active { filter: brightness(0.95); }
.btn-gold {
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  color: #241c08; font-weight: 700;
  box-shadow: 0 1px 0 rgba(255,255,255,0.35) inset, 0 2px 10px rgba(230,192,106,0.18);
}
.btn-ghost { background: transparent; border-color: var(--line); color: var(--text); }
.btn-ghost:hover { border-color: var(--gold); color: var(--gold-2); }
.btn-danger { background: var(--danger-bg); border-color: rgba(224,102,102,0.5); color: var(--danger); }
.btn-wa { background: rgba(60,180,113,0.14); border-color: rgba(60,180,113,0.5); color: #7fe0a8; }
.btn-sm { padding: 5px 10px; font-size: 13px; border-radius: 7px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------------- forms ---------------- */

.grid-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: 14px 18px;
  align-items: start;
}
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.field small { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }
input[type=text], input[type=password], input[type=email], input[type=url], input[type=tel],
input[type=number], input[type=search], input[type=color], select, textarea {
  width: 100%; padding: 9px 12px; border-radius: 9px;
  border: 1px solid var(--line); background: #0e0e11; color: var(--text);
  font: inherit;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(230,192,106,0.15); }
textarea { resize: vertical; line-height: 1.6; }
input[type=color] { padding: 2px; height: 44px; cursor: pointer; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--gold); }
.field-check label { display: flex; align-items: center; gap: 10px; color: var(--text); font-size: 14px; margin: 0; }
.field-check { padding-top: 8px; }
.actions { display: flex; gap: 10px; align-items: center; margin-top: 6px; }
.grid-form h2 { grid-column: 1 / -1; margin: 14px 0 0; }

/* ---------------- flash & callouts ---------------- */

.flash {
  padding: 12px 16px; border-radius: 10px; margin-bottom: 16px;
  border: 1px solid; font-size: 14.5px;
}
.flash-ok   { background: var(--ok-bg);   border-color: rgba(111,207,151,0.4); color: var(--ok); }
.flash-err  { background: var(--danger-bg); border-color: rgba(224,102,102,0.45); color: var(--danger); }
.flash-warn { background: var(--warn-bg); border-color: rgba(230,192,106,0.4); color: var(--warn); }

.callout { padding: 13px 16px; border-radius: 10px; margin-bottom: 16px; border: 1px solid; font-size: 14px; }
.callout-warn { background: var(--warn-bg); border-color: rgba(230,192,106,0.4); color: var(--gold-2); }
.callout-ok   { background: var(--ok-bg);   border-color: rgba(111,207,151,0.4); color: var(--ok); }
.callout-info { background: var(--info-bg); border-color: rgba(127,180,230,0.4); color: var(--info); }
.callout a { color: inherit; text-decoration: underline; }

.faq-item h3 { border: none; color: var(--gold-2); }

.kv { display: grid; grid-template-columns: 210px 1fr; row-gap: 8px; margin: 10px 0 16px; }
.kv dt { color: var(--muted); font-size: 13.5px; }
.kv dd { margin: 0; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.filter-form { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-form select, .filter-form input { width: auto; min-width: 160px; }

/* ---------------- login / setup screens ---------------- */

.login-body, .setup-body {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background:
    radial-gradient(900px 500px at 80% -10%, rgba(230,192,106,0.10), transparent 60%),
    radial-gradient(700px 500px at -10% 110%, rgba(230,192,106,0.06), transparent 60%),
    var(--bg);
}
.login-card {
  width: 100%; max-width: 380px;
  background: linear-gradient(180deg, #16161b, #101013);
  border: 1px solid var(--line); border-radius: 16px;
  padding: 30px 28px;
  box-shadow: 0 24px 70px rgba(0,0,0,0.5);
}
.setup-card {
  max-width: 620px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; padding: 28px 30px;
}
.login-brand { text-align: center; margin-bottom: 18px; }
.login-brand h1 { font-size: 22px; margin: 0 0 2px; }
.login-brand p { margin: 0; color: var(--muted); font-size: 13.5px; letter-spacing: 0.08em; }
.login-card .stack { display: flex; flex-direction: column; gap: 12px; }
.login-card label { font-size: 13px; color: var(--muted); display: block; margin-bottom: 4px; }
.setup-body code { word-break: break-all; }
.setup-body ul { padding-left: 20px; }
.setup-body .muted { margin-top: 14px; }

/* Prevent editable content and form controls from expanding narrow screens. */
.field, .grid-form > *, .card, .stat, .kv dd, .filter-form { min-width: 0; }
.card, .callout, .flash, .kv dd, .brand strong { overflow-wrap: anywhere; }
.actions { flex-wrap: wrap; }
input, select, textarea { max-width: 100%; }
input[type=checkbox] { flex-shrink: 0; }
.btn, .pg { min-height: 44px; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.table-wrap { max-width: 100%; overscroll-behavior-x: contain; }
.filter-form input, .filter-form select { min-width: 0; }
.sidebar { overflow-y: auto; }
@media (max-width: 600px) {
  .card { padding: 16px; }
  .grid-form { grid-template-columns: minmax(0, 1fr); }
  input[type=text], input[type=password], input[type=email], input[type=url], input[type=tel],
  input[type=number], input[type=search], select, textarea { font-size: 16px; }
  .login-body, .setup-body { padding: 16px; }
  .login-card, .setup-card { padding: 24px 20px; min-width: 0; }
  .filter-form { width: 100%; }
  .table-wrap:before { content: "টেবিলের বাকি অংশ দেখতে পাশে সোয়াইপ করুন →"; display: block; position: sticky; left: 0; max-width: 100%; font-size: 12px; color: var(--muted); padding-bottom: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *:before, *:after { transition: none !important; }
}

/* ---------------- responsive ---------------- */

@media (max-width: 920px) {
  .layout { flex-direction: column; }
  .sidebar {
    width: 100%; height: auto; position: static; flex: none;
    border-right: none; border-bottom: 1px solid var(--line);
  }
  .brand { padding: 12px 16px; }
  .nav { display: flex; overflow-x: auto; padding: 6px; gap: 4px; }
  .nav a { white-space: nowrap; padding: 8px 12px; margin: 0; }
  .sidebar-foot { padding: 10px 14px; }
  .content { padding: 16px 14px 48px; }
  .topbar { padding: 14px 16px; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .filter-form input, .filter-form select { width: 100%; }
  .kv { grid-template-columns: 1fr; row-gap: 2px; }
  .kv dt { margin-top: 8px; }
}
