/* ============================================================
   CHANDAMART — ADMIN PANEL STYLES
   Palette: Deep navy base, rose accent, crisp white cards
   ============================================================ */

:root {
  --navy: #14152B;
  --navy-soft: #1D1E3A;
  --rose: #E91E63;
  --rose-dark: #C2185B;
  --rose-light: #FDECF2;
  --teal: #16A085;
  --purple: #7C4DFF;
  --amber: #E8912D;
  --ink: #1A1A2E;
  --ink-soft: #6B6B7B;
  --line: #ECECF1;
  --white: #FFFFFF;
  --bg: #F6F6FA;
  --shadow: 0 8px 28px rgba(20, 21, 43, 0.12);
  --radius: 16px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Poppins', sans-serif; background: var(--bg); color: var(--ink); }
button { font-family: inherit; cursor: pointer; border: none; }
a { text-decoration: none; color: inherit; }
input, select, textarea { font-family: inherit; }

/* ---------- Login page ---------- */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--navy) 0%, #26214A 100%);
  padding: 20px;
}
.login-card {
  background: var(--white);
  border-radius: 20px;
  padding: 36px 30px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
}
.login-logo { text-align: center; margin-bottom: 6px; font-size: 22px; font-weight: 700; }
.login-logo span { color: var(--rose); }
.login-sub { text-align: center; color: var(--ink-soft); font-size: 13px; margin-bottom: 26px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12.5px; font-weight: 500; margin-bottom: 6px; color: var(--ink-soft); }
.field input {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  font-size: 14px;
  outline: none;
  background: #FAFAFB;
}
.field input:focus { border-color: var(--rose); background: var(--white); }

.btn-primary {
  width: 100%;
  padding: 13px 0;
  border-radius: var(--radius-sm);
  background: var(--rose);
  color: var(--white);
  font-weight: 600;
  font-size: 14px;
  margin-top: 6px;
  transition: background 0.15s ease;
}
.btn-primary:hover { background: var(--rose-dark); }
.btn-primary:disabled { opacity: 0.6; cursor: default; }

.link-btn { display: block; text-align: center; margin-top: 14px; font-size: 12.5px; color: var(--ink-soft); }
.link-btn:hover { color: var(--rose); }

.form-msg { font-size: 12.5px; margin-top: 10px; text-align: center; min-height: 16px; }
.form-msg.error { color: #E53935; }
.form-msg.success { color: var(--teal); }

/* ---------- App shell (dashboard/products/offers) ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px;
  background: var(--navy);
  color: var(--white);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.sidebar-logo { font-size: 18px; font-weight: 700; padding: 0 10px 24px; }
.sidebar-logo span { color: var(--rose); }
.sidebar-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  color: rgba(255,255,255,0.7);
}
.sidebar-link:hover { background: rgba(255,255,255,0.06); color: var(--white); }
.sidebar-link.active { background: var(--rose); color: var(--white); }
.sidebar-link .material-symbols-outlined { font-size: 19px; }
.sidebar-logout {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.7);
  font-size: 13.5px;
  background: none;
}
.sidebar-logout:hover { background: rgba(255,255,255,0.06); color: var(--white); }

.content { flex: 1; padding: 28px 32px; max-width: 1200px; }
.content-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.content-header h1 { font-size: 22px; font-weight: 600; }
.content-header p { font-size: 13px; color: var(--ink-soft); margin-top: 2px; }

/* Mobile top bar for small screens (sidebar collapses) */
.mobile-topbar { display: none; }

/* ---------- Stat cards ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 18px; margin-bottom: 30px; }
.stat-card { background: var(--white); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.stat-icon {
  width: 42px; height: 42px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px; color: var(--white);
}
.stat-value { font-size: 26px; font-weight: 700; }
.stat-label { font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; }

/* ---------- Buttons ---------- */
.btn { padding: 10px 18px; border-radius: var(--radius-sm); font-size: 13.5px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; }
.btn-rose { background: var(--rose); color: var(--white); }
.btn-rose:hover { background: var(--rose-dark); }
.btn-outline { background: var(--white); border: 1px solid var(--line); color: var(--ink); }
.btn-outline:hover { background: #F4F4F7; }
.btn-danger { background: #FDECEA; color: #E53935; }
.btn-danger:hover { background: #FBDAD7; }
.btn-sm { padding: 7px 12px; font-size: 12.5px; }

/* ---------- Table / list ---------- */
.panel { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.panel-head { padding: 18px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.panel-head h2 { font-size: 15.5px; font-weight: 600; }

.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.4px;
  color: var(--ink-soft); padding: 12px 20px; border-bottom: 1px solid var(--line);
}
.data-table td { padding: 12px 20px; border-bottom: 1px solid var(--line); font-size: 13.5px; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table img.thumb { width: 42px; height: 52px; object-fit: cover; border-radius: 8px; }

.pill { font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 100px; display: inline-block; }
.pill-on { background: #E4F7EF; color: var(--teal); }
.pill-off { background: #F0F0F3; color: var(--ink-soft); }

.toggle {
  width: 38px; height: 22px; border-radius: 100px; background: #D9D9E2; position: relative; transition: background 0.15s ease;
}
.toggle.on { background: var(--teal); }
.toggle .knob { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--white); transition: transform 0.15s ease; }
.toggle.on .knob { transform: translateX(16px); }

.empty-row td { text-align: center; padding: 40px 20px; color: var(--ink-soft); }

/* ---------- Modal (add/edit forms) ---------- */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(20,21,43,0.5); z-index: 100; align-items: center; justify-content: center; padding: 20px; }
.modal-overlay.active { display: flex; }
.modal-box { background: var(--white); border-radius: 18px; width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; padding: 26px; }
.modal-box h3 { font-size: 17px; margin-bottom: 18px; }

.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 12.5px; font-weight: 500; margin-bottom: 6px; color: var(--ink-soft); }
.form-row input, .form-row select, .form-row textarea {
  width: 100%; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  font-size: 13.5px; outline: none; background: #FAFAFB;
}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus { border-color: var(--rose); background: var(--white); }
.form-row textarea { resize: vertical; min-height: 70px; }
.form-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }

.img-upload-box {
  border: 2px dashed var(--line); border-radius: var(--radius-sm); padding: 20px; text-align: center;
  cursor: pointer; color: var(--ink-soft); font-size: 13px; position: relative; overflow: hidden;
}
.img-upload-box img.preview { max-height: 120px; border-radius: 8px; margin: 0 auto; }
.img-upload-box input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.modal-actions { display: flex; gap: 10px; margin-top: 20px; }
.modal-actions .btn { flex: 1; justify-content: center; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 24px; right: 24px; background: var(--ink); color: var(--white);
  padding: 12px 20px; border-radius: 10px; font-size: 13px; opacity: 0; transform: translateY(10px);
  transition: all 0.25s ease; z-index: 300;
}
.toast.show { opacity: 1; transform: none; }
.toast.error { background: #E53935; }
.toast.success { background: var(--teal); }

/* ---------- Loader ---------- */
.spinner { width: 20px; height: 20px; border: 2.5px solid rgba(255,255,255,0.4); border-top-color: var(--white); border-radius: 50%; animation: spin 0.7s linear infinite; display: inline-block; }
.spinner-dark { border: 2.5px solid var(--line); border-top-color: var(--rose); width: 26px; height: 26px; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 860px) {
  .sidebar {
    display: flex;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 60;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 4px 0 24px rgba(0,0,0,0.25);
  }
  .sidebar.sidebar-open { transform: translateX(0); }
  .sidebar-backdrop {
    display: none;
    position: fixed; inset: 0; z-index: 55;
    background: rgba(0,0,0,0.4);
  }
  .sidebar-backdrop.active { display: block; }
  .mobile-topbar {
    display: flex; align-items: center; justify-content: space-between;
    background: var(--navy); color: var(--white); padding: 14px 18px; position: sticky; top: 0; z-index: 40;
  }
  .mobile-topbar .logo { font-size: 16px; font-weight: 700; }
  .mobile-topbar .logo span { color: var(--rose); }
  .app-shell { flex-direction: column; }
  .content { padding: 20px; }
  .form-two-col { grid-template-columns: 1fr; }
  .data-table { display: block; overflow-x: auto; white-space: nowrap; }
  /* Stack the header so the "Add" button always has its own full-width
     row instead of being squeezed next to the title on narrow screens. */
  .content-header { flex-direction: column; align-items: stretch; gap: 12px; }
  .content-header > button, .content-header > a.btn { width: 100%; justify-content: center; }

  /* Floating round button that brings the sidebar into view. */
  .sidebar-fab {
    display: flex; align-items: center; justify-content: center;
    position: fixed; right: 18px; bottom: 22px; z-index: 65;
    width: 56px; height: 56px; border-radius: 50%;
    background: var(--rose); color: #fff; border: none;
    box-shadow: 0 6px 18px rgba(var(--rose-rgb,233,30,99),0.45);
    cursor: pointer;
  }
  .sidebar-fab .material-symbols-outlined { font-size: 26px; }
}
@media (min-width: 861px) {
  .sidebar-fab, .sidebar-backdrop { display: none !important; }
}
