/* =========================================
   Awadh Tiles Gallery - Admin Panel
   Navy + royal blue (naye logo ke colors)
   (the variable is still named --gold, but the colour is now blue)
   ========================================= */
:root {
  --navy: #0a2350;
  --navy-2: #12357a;
  --royal: #1f5fbf;
  --gold: #1e7be0;
  --gold-2: #8cc4ff;
  --gold-soft: #e8f1fc;
  --bg: #f3f6fb;
  --card: #ffffff;
  --text: #1c2233;
  --muted: #6b7286;
  --line: #dfe5ef;
  --green: #1f8a4c;
  --green-soft: #e3f4ea;
  --red: #c0392b;
  --red-soft: #fbe6e3;
  --amber: #b7791f;
  --amber-soft: #fdf1dc;
  --blue-soft: #e6ecfa;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(29,47,102,.06), 0 4px 16px rgba(29,47,102,.06);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }
a { color: var(--royal); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

/* ---------- Layout ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 248px; flex-shrink: 0; background: var(--navy); color: #fff;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
  background-image:
    radial-gradient(circle at 0 0, rgba(30,123,224,.12), transparent 40%),
    linear-gradient(180deg, var(--navy-2), var(--navy));
}
.brand { display: flex; align-items: center; gap: 12px; padding: 22px 20px; border-bottom: 1px solid rgba(30,123,224,.25); }
.brand img { width: 44px; height: 44px; border-radius: 6px; }
.brand-name { font-weight: 800; font-size: 21px; letter-spacing: .3px; color: #fff; line-height: 1; }
.brand-sub { font-size: 12px; font-weight: 600; letter-spacing: .5px; color: var(--gold-2); margin-top: 4px; }
.sidebar nav { flex: 1; padding: 14px 10px; display: flex; flex-direction: column; gap: 2px; }
.sidebar a { display: flex; align-items: center; gap: 12px; color: rgba(255,255,255,.82); padding: 11px 14px; border-radius: 8px; font-weight: 500; text-decoration: none; position: relative; }
.sidebar a svg { width: 20px; height: 20px; fill: currentColor; opacity: .85; }
.sidebar a:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar a.active { background: rgba(30,123,224,.16); color: var(--gold-2); }
.sidebar a.active::before { content: ''; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--gold); }
.sidebar .count { margin-left: auto; font-style: normal; background: var(--gold); color: #fff; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 20px; }
.sidebar .logout { margin: 10px; border-top: 1px solid rgba(255,255,255,.1); border-radius: 0; padding-top: 16px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 14px; background: #fff; border-bottom: 1px solid var(--line); padding: 14px 28px; position: sticky; top: 0; z-index: 5; }
.topbar h1 { font-size: 19px; margin: 0; font-weight: 700; color: var(--navy); flex: 1; }
.admin-name { color: var(--muted); font-size: 13px; }
.menu-btn { display: none; background: none; border: 0; padding: 4px; cursor: pointer; }
.menu-btn svg { width: 26px; height: 26px; fill: var(--navy); }
.content { padding: 24px 28px; flex: 1; }
.footer { padding: 16px 28px; color: var(--muted); font-size: 12px; }
.overlay { display: none; }

/* ---------- Cards / stats ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-head h2 { margin: 0; font-size: 16px; color: var(--navy); }
.card-body { padding: 20px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat { background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--gold); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); position: relative; overflow: hidden; text-decoration: none !important; color: inherit; display: block; min-width: 0; }
/* soft corner shape, always behind the text */
.stat::after { content: ''; position: absolute; right: -22px; bottom: -22px; width: 64px; height: 64px; border-radius: 50%; background: var(--gold-soft); z-index: 0; }
.stat > * { position: relative; z-index: 1; }
.stat .label { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; line-height: 1.35; }
.stat .value { font-size: 28px; font-weight: 800; color: var(--navy); margin-top: 4px; line-height: 1.2; word-break: break-word; }
.stat .hint { font-size: 12px; color: var(--muted); }
.stat.highlight { background: linear-gradient(135deg, var(--navy-2), var(--royal)); border-color: transparent; border-left-color: var(--gold-2); }
.stat.highlight .label, .stat.highlight .hint { color: rgba(255,255,255,.85); }
.stat.highlight .value { color: #fff; }
.stat.highlight::after { background: rgba(255,255,255,.08); }


/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 600; background: #f6f8fc; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f8fafd; }
td .sub { color: var(--muted); font-size: 12px; }
.thumb { width: 52px; height: 52px; min-width: 52px; max-width: none; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: var(--gold-soft); display: block; }
.thumb.empty { display: flex; align-items: center; justify-content: center; color: var(--gold); font-size: 20px; }
.empty-state { text-align: center; padding: 48px 20px; color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge-pending { background: var(--amber-soft); color: var(--amber); }
.badge-approved, .badge-in_stock, .badge-delivered { background: var(--green-soft); color: var(--green); }
.badge-rejected, .badge-blocked, .badge-out_of_stock, .badge-cancelled { background: var(--red-soft); color: var(--red); }
.badge-dispatched { background: var(--blue-soft); color: var(--royal); }
.badge-inactive { background: #eceef3; color: var(--muted); }

/* ---------- Buttons / forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: 8px; border: 1px solid transparent; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none !important; white-space: nowrap; transition: .15s; }
.btn-primary { background: var(--navy-2); color: #fff; }
.btn-primary:hover { background: var(--navy); }
.btn-gold { background: var(--gold); color: #fff; }
.btn-gold:hover { background: var(--royal); }
.btn-success { background: var(--green); color: #fff; }
.btn-danger { background: var(--red); color: #fff; }
.btn-outline { background: #fff; border-color: var(--line); color: var(--text); }
.btn-outline:hover { border-color: var(--gold); }
.btn-sm { padding: 6px 11px; font-size: 13px; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px 20px; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; color: var(--navy); }
.field small { color: var(--muted); font-size: 12px; }
input[type=text], input[type=number], input[type=password], input[type=search], input[type=email], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(30,123,224,.18); }
textarea { min-height: 90px; resize: vertical; }
.checkbox { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filters input, .filters select { width: auto; min-width: 160px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs a { padding: 7px 14px; border-radius: 20px; background: #fff; border: 1px solid var(--line); color: var(--text); font-weight: 500; font-size: 13px; text-decoration: none; }
.tabs a.active { background: var(--navy-2); border-color: var(--navy-2); color: #fff; }
.tabs a em { font-style: normal; opacity: .7; margin-left: 4px; }
.img-preview { width: 160px; height: 160px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); margin-top: 10px; }
.stock-input { width: 90px !important; padding: 6px 8px !important; }
.inline-form { display: inline-flex; gap: 6px; align-items: center; margin: 0; }

.perm-grid { display: grid; gap: 8px; }
.perm-grid .checkbox { background: var(--gold-soft); border-radius: 8px; padding: 8px 10px; font-size: 13px; }

/* ---------- Low stock ---------- */
.alert-low { background: var(--amber-soft); color: var(--amber); border-color: #f1d9a8; }
.alert-low a { color: var(--amber); font-weight: 700; margin-left: 6px; }
.sidebar .count.count-low { background: #f0a020; color: #fff; }
tr.row-low td { background: #fffaf0; }

/* ---------- Alerts ---------- */
.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-weight: 500; border: 1px solid; }
.alert-success { background: var(--green-soft); color: var(--green); border-color: #bfe3cd; }
.alert-error { background: var(--red-soft); color: var(--red); border-color: #f2c2bb; }
.alert-info { background: var(--blue-soft); color: var(--royal); border-color: #c9d5f3; }

/* ---------- Detail lists ---------- */
.details { display: grid; grid-template-columns: 160px 1fr; gap: 10px 16px; margin: 0; }
.details dt { color: var(--muted); font-weight: 500; }
.details dd { margin: 0; font-weight: 500; }
.two-col { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; align-items: start; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 18px 22px; border-left: 2px solid var(--line); margin-left: 6px; }
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before { content: ''; position: absolute; left: -7px; top: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--gold); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--gold); }
.timeline .when { color: var(--muted); font-size: 12px; }

/* ---------- Pagination ---------- */
.pagination { display: flex; gap: 6px; padding: 16px 20px; flex-wrap: wrap; }
.pagination a { min-width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--text); text-decoration: none; }
.pagination a.active { background: var(--navy-2); color: #fff; border-color: var(--navy-2); }
.pagination .dots { padding: 6px; color: var(--muted); }

/* ---------- Login ---------- */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: linear-gradient(135deg, var(--navy) 0%, var(--royal) 100%); position: relative; overflow: hidden; }
.login-page::before { content: ''; position: absolute; inset: 0; opacity: .08;
  background-image: url('../../assets/logo_mark.png'); background-size: 140px; }
.login-box { position: relative; background: #fff; border-radius: 16px; padding: 36px 32px; width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,.3); border-top: 4px solid var(--gold); }
.login-box .logo { display: block; width: 180px; margin: 0 auto 18px; }
.login-box h2 { text-align: center; margin: 0 0 22px; color: var(--navy); font-size: 18px; }
.login-box .field { margin-bottom: 16px; }
.login-box .btn { width: 100%; padding: 12px; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .sidebar { position: fixed; left: -260px; z-index: 30; transition: left .25s; }
  body.nav-open .sidebar { left: 0; }
  body.nav-open .overlay { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 20; }
  .menu-btn { display: block; }
  .topbar { padding: 12px 16px; }
  .content { padding: 16px; }
  .admin-name { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .details { grid-template-columns: 1fr; gap: 2px; }
  .details dd { margin-bottom: 10px; }
  .filters input, .filters select { min-width: 0; flex: 1 1 140px; }
}

/* Order hold + returns */
.badge-on_hold, .badge-ret-requested { background: var(--amber-soft); color: var(--amber); }
.badge-ret-approved { background: var(--green-soft); color: var(--green); }
.badge-ret-rejected { background: var(--red-soft); color: var(--red); }
.btn-warning { background: var(--amber); color: #fff; }
.return-box { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 12px; }
.return-record summary { cursor: pointer; font-weight: 600; color: var(--navy); }
.return-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.return-row input { width: 90px; }

.party-code { display: inline-block; font-weight: 700; font-size: 12px; color: var(--navy); background: var(--gold-soft, #e6f0fc); border: 1px solid var(--line); border-radius: 6px; padding: 1px 7px; letter-spacing: .3px; }

/* Order status: "Mark Dispatched / Hold" split button */
.split-btn { position: relative; display: inline-block; }
.split-btn > summary { list-style: none; cursor: pointer; }
.split-btn > summary::-webkit-details-marker { display: none; }
.split-menu { position: absolute; z-index: 10; top: calc(100% + 6px); left: 0; background: #fff; border: 1px solid var(--line);
  border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 8px; min-width: 200px; box-shadow: 0 8px 24px rgba(10,35,80,.15); }
.split-menu small { color: var(--muted, #6b7286); font-size: 11.5px; }
.variant-chip { display: inline-block; font-size: 12px; font-weight: 600; background: var(--gold-soft); color: var(--navy); border-radius: 6px; padding: 1px 8px; margin-top: 3px; }

/* Tile variants */
.variant-table { width: 100%; border-collapse: collapse; }
.variant-table th { text-align: left; font-size: 12px; color: var(--muted, #6b7286); font-weight: 600; padding: 4px 6px; }
.variant-table td { padding: 4px 6px; }
.variant-table input[type=text], .variant-table input[type=number] { width: 100%; }
.variant-stock { display: flex; flex-direction: column; gap: 4px; }
.variant-stock form { display: flex; align-items: center; gap: 6px; }
.variant-stock .vname { min-width: 64px; font-weight: 600; font-size: 13px; }
.variant-stock input { width: 70px; }
