﻿:root {
  --bg-light: #f7f5e7;
  --primary: #d5a773;
  --accent: #f9f78a;
  --text-dark: #2f2a1f;
  --muted: #8a7a58;
}

body {
  font-family: "Inter", "Segoe UI", sans-serif;
  background: var(--bg-light);
  color: var(--text-dark);
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

#app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 270px;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  background: #fff;
  z-index: 1020;
  overflow-y: auto;
  padding-bottom: 2rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(213,167,115,0.5) transparent;
}

.sidebar::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(213,167,115,0.35);
  border-radius: 999px;
}

.sidebar .nav-link {
  color: var(--text-dark);
  border-radius: 10px;
  padding: 0.55rem 0.85rem;
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sidebar .nav-link.active,
.sidebar .nav-link:hover {
  background: var(--primary);
  color: #fff;
}

.sidebar .nav-section {
  margin-top: 1rem;
  margin-bottom: 0.35rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.08em;
}

.main-wrapper {
  margin-left: 270px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 1010;
  border-bottom: 1px solid rgba(0,0,0,0.05);
}

.content {
  flex: 1;
  background: var(--bg-light);
}

.card {
  border: none;
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.05);
}

.metric-card {
  border-left: 5px solid var(--primary);
}

.badge {
  background: var(--accent);
  color: var(--text-dark);
}

.quick-search-trigger,
.notification-bell {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--bg-light);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.notification-bell .badge {
  position: absolute;
  top: -4px;
  right: -2px;
  background: #e94f37;
  color: #fff;
  font-size: 0.65rem;
}

.quick-tools {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 2000;
}

.quick-tools button {
  border-radius: 999px;
  box-shadow: 0 15px 30px rgba(0,0,0,0.15);
}

.quick-search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 3000;
}

.quick-search-overlay.active {
  display: flex;
}

.quick-search-box {
  background: #fff;
  padding: 2rem;
  border-radius: 18px;
  width: min(600px, 90vw);
  box-shadow: 0 25px 60px rgba(0,0,0,0.2);
}

.alert-card { border-left: 4px solid #e94f37; }

/* ══════════════════════════════════════════════
   MOBILE SIDEBAR OVERLAY
══════════════════════════════════════════════ */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1015;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.sidebar-backdrop.active {
  display: block;
}

/* ══════════════════════════════════════════════
   BREAKPOINT ≤ 991px  (tablet + mobile)
══════════════════════════════════════════════ */
@media (max-width: 991.98px) {

  /* Sidebar slides in/out */
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(.4,0,.2,1);
    z-index: 1020;
    width: 270px;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 6px 0 40px rgba(0,0,0,0.18);
  }

  /* Main fills full width */
  .main-wrapper {
    margin-left: 0 !important;
  }

  /* Reduce main content padding */
  .content {
    padding: 1rem !important;
  }

  /* Header: truncate admin name on small screens */
  .topbar .btn span {
    display: none;
  }
  .topbar .btn .rounded-circle {
    display: inline-block !important;
  }

  /* Hide brand subtitle in topbar on very small screens */
  .topbar h5 + small {
    display: none;
  }

  /* Topbar brand stays compact */
  .topbar h5 {
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
  }

  /* Tables always scroll horizontally */
  .table-responsive {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  /* Quick tools: float bottom-left on mobile, smaller */
  .quick-tools {
    bottom: 16px;
    right: 16px;
    gap: 8px;
  }
  .quick-tools button {
    font-size: 0.85rem;
    padding: 0.5rem 1rem;
  }
  #quickOrderBtn span {
    display: none;
  }

  /* KPI/metric card grids */
  .row .col-md-3,
  .row .col-md-4,
  .row .col-md-6 {
    margin-bottom: 0.75rem;
  }

  /* Preset filter buttons wrap properly */
  .preset-btn {
    font-size: 0.75rem !important;
    padding: 3px 8px !important;
  }

  /* Date filter row on sales report */
  .d-flex.flex-wrap.gap-3 {
    gap: 0.5rem !important;
  }

  /* Form controls: ensure touch-friendly height */
  .form-control,
  .form-select {
    min-height: 42px;
    font-size: 0.9rem;
  }

  /* Card padding tighter on mobile */
  .card-body {
    padding: 1rem !important;
  }

  /* Offcanvas full-width on mobile */
  .offcanvas {
    width: 100% !important;
    max-width: 100vw !important;
  }

  /* Chart cards: full width */
  .chart-card {
    padding: 14px !important;
  }

  /* Financial summary two-column → single column */
  .col-md-6.border-start {
    border-left: none !important;
    border-top: 1px solid #e2e8f0;
    padding-left: 0 !important;
    margin-top: 0.75rem;
  }

  /* Blog editor: stack columns */
  .col-xl-8, .col-xl-4 {
    width: 100% !important;
  }

  /* Topbar gap tighter */
  .topbar {
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
  }

  /* Stats / KPI number bigger tap targets */
  .kpi-card,
  .metric-card {
    padding: 12px 14px !important;
  }

  /* action bar with buttons — wrap and stack */
  .d-flex.gap-2 .btn {
    font-size: 0.8rem;
    padding: 0.35rem 0.65rem;
  }

  /* Hide long labels, keep icons */
  .tbl-mini td, .tbl-mini th {
    padding: 6px 8px !important;
    font-size: 0.76rem !important;
  }

  /* Page headings smaller */
  h4.fw-bold, h1.fw-bold {
    font-size: 1.15rem;
  }
}

/* ══════════════════════════════════════════════
   BREAKPOINT ≤ 575px  (phones only)
══════════════════════════════════════════════ */
@media (max-width: 575.98px) {

  /* Even more compact padding */
  .content {
    padding: 0.75rem !important;
  }

  /* Topbar: hide brand text completely, show only toggle + icons */
  .topbar .d-flex:first-child > div:last-child {
    display: none !important;
  }

  /* Stack date range form on one line */
  .d-flex.gap-1.align-items-center {
    flex-wrap: wrap;
  }
  .d-flex.gap-1.align-items-center input[type=date] {
    width: calc(50% - 0.5rem) !important;
    min-width: auto !important;
  }

  /* Reduce card border radius on phone */
  .card { border-radius: 12px; }
  .chart-card { border-radius: 10px; }

  /* Notification bell + search: tighter */
  .quick-search-trigger,
  .notification-bell {
    width: 36px;
    height: 36px;
    border-radius: 9px;
  }

  /* Section headings bold+small */
  h4 { font-size: 1.05rem !important; }
  h5 { font-size: 0.95rem !important; }

  /* Blog category offcanvas form stacked */
  .row.g-3 > [class*=" col-"] {
    margin-bottom: 0.5rem;
  }

  /* Filters: collapse to icon-only on phones */
  .btn-export span,
  .btn-export i ~ span {
    display: none;
  }

  /* Top products table: hide margin column on phone */
  .table th:last-child,
  .table td:last-child {
    display: none;
  }

  /* Quick tools on phone: only icon */
  .quick-tools button i + * {
    display: none;
  }
  .quick-tools button {
    width: 48px;
    height: 48px;
    padding: 0 !important;
    border-radius: 50% !important;
    justify-content: center;
  }

  /* Sidebar brand */
  .sidebar .brand h4 {
    font-size: 1rem;
  }
}

/* ══════════════════════════════════════════════
   AUTH PAGES (login etc) always responsive
══════════════════════════════════════════════ */
.auth-body {
  background: linear-gradient(135deg, #f9f8ef, #f7f5e7);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.auth-card {
  max-width: 440px;
  width: 100%;
  border-radius: 24px;
  box-shadow: 0 30px 60px rgba(0,0,0,0.08);
  background: #fff;
  padding: 2.5rem;
}

@media (max-width: 480px) {
  .auth-card {
    padding: 1.5rem;
    border-radius: 16px;
  }
}

.auth-card h2 {
  font-weight: 700;
  color: var(--text-dark);
}

.brand-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  background: rgba(213,167,115,0.15);
  color: var(--text-dark);
  font-weight: 600;
}


.table thead {
  background: var(--primary);
  color: #fff;
}

.progress-bar {
  background: var(--primary);
}

.chart-card canvas {
  max-height: 280px;
}

.stat-chip {
  border-radius: 999px;
  padding: 0.35rem 1rem;
  background: rgba(213,167,115,0.12);
  color: var(--text-dark);
  font-size: 0.85rem;
}

.widget-list li { display:flex; justify-content:space-between; margin-bottom:0.35rem; }

.form-label { font-weight: 600; color: var(--muted); }

.form-control, .form-select {
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,0.08);
}

.table-responsive { border-radius: 18px; overflow: hidden; }

.status-pill {
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
}

.status-pill.pending { background: #fff2d6; color: #a56700; }
.status-pill.delivered { background: #d9f7e7; color: #1b7c41; }
.status-pill.cancelled { background: #ffe0e0; color: #b63a3a; }

.order-actions button { border-radius: 12px; }

.cms-card {
  border: 1px dashed rgba(0,0,0,0.08);
  border-radius: 16px;
  padding: 1.5rem;
  background: #fff;
}

.timeline {
  list-style: none;
  padding-left: 0;
}

.timeline li {
  position: relative;
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

.timeline li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.35rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
}

.rich-editor-wrapper {
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 18px;
  padding: 1rem;
  background: #fffdf7;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.02);
}

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.editor-toolbar button,
.editor-toolbar select {
  border: 1px solid rgba(0,0,0,0.1);
  background: #fff;
  border-radius: 10px;
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.editor-toolbar button.active {
  background: var(--primary);
  color: #fff;
}

.rich-editor {
  min-height: 220px;
  outline: none;
  font-size: 1rem;
  line-height: 1.6;
  padding: 0.25rem;
}

.rich-editor:empty::before {
  content: attr(data-placeholder);
  color: var(--muted);
  opacity: 0.7;
}

.auth-body {
  background: linear-gradient(135deg, #f9f8ef, #f7f5e7);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.auth-card {
  max-width: 440px;
  width: 100%;
  border-radius: 24px;
  box-shadow: 0 30px 60px rgba(0,0,0,0.08);
  background: #fff;
  padding: 2.5rem;
}

.auth-card h2 {
  font-weight: 700;
  color: var(--text-dark);
}

.brand-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  background: rgba(213,167,115,0.15);
  color: var(--text-dark);
  font-weight: 600;
}
