/* =====================================================
   Global base styles
   Shared theme for Inventory, Customer, Orders, and Handling pages
   ===================================================== */

:root {
  --bg-soft: #f3ecdf;
  --bg-soft-2: #fcf7ef;
  --bg-accent: rgba(194, 167, 120, 0.16);
  --bg-accent-2: rgba(147, 117, 78, 0.1);
  --bg-accent-3: rgba(255, 255, 255, 0.72);
  --surface: #ffffff;
  --surface-2: #f7f2ea;
  --surface-3: #f2ebe0;
  --line: #ded6c8;
  --line-strong: #cbbda8;
  --text: #2f261c;
  --muted: #7a6b58;
  --brand: #7c5c36;
  --brand-strong: #624521;
  --danger: #b00020;
  --success: #21724f;
  --shadow-soft: 0 12px 30px rgba(62, 44, 23, 0.06);
  --shadow-strong: 0 24px 60px rgba(62, 44, 23, 0.18);
  --focus-ring: 0 0 0 4px rgba(124, 92, 54, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #f7f1e6;
}

body {
  position: relative;
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  min-height: 100vh;
  background: transparent;
  color: var(--text);
  line-height: 1.45;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle at 12% 10%, var(--bg-accent), transparent 28%),
    radial-gradient(circle at 88% 14%, rgba(255, 233, 201, 0.58), transparent 24%),
    radial-gradient(circle at 78% 72%, var(--bg-accent-2), transparent 26%),
    linear-gradient(135deg, var(--bg-accent-3) 0%, rgba(255, 255, 255, 0) 38%),
    linear-gradient(180deg, var(--bg-soft-2) 0%, var(--bg-soft) 55%, #efe4d2 100%);
}

/* Links */
a {
  color: var(--brand-strong);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Buttons */
button,
.btn {
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background-color: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

button:hover,
.btn:hover {
  background-color: var(--surface-2);
  border-color: var(--line-strong);
  box-shadow: 0 10px 18px rgba(62, 44, 23, 0.08);
  transform: translateY(-1px);
}

button:disabled,
.btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  box-shadow: none;
  transform: none;
}

.primary-btn {
  background: linear-gradient(135deg, #8f6a3f 0%, var(--brand-strong) 100%);
  color: #fff;
  border-color: transparent;
}

.primary-btn:hover {
  background: linear-gradient(135deg, #9a7448 0%, #6d4e29 100%);
}

.secondary-btn {
  background: var(--surface-2);
  border-color: rgba(203, 189, 168, 0.9);
}

.ghost-btn {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.ghost-btn:hover {
  background: rgba(124, 92, 54, 0.08);
  box-shadow: none;
}

/* Cards / containers */
.card {
  border: 1px solid rgba(203, 189, 168, 0.8);
  border-radius: 18px;
  padding: 16px;
  background-color: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-soft);
}

/* Inputs */
input,
select,
textarea {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  font-size: 14px;
  width: 100%;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: var(--focus-ring);
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 10px;
  border-bottom: 1px solid #eee6db;
  text-align: left;
}

th {
  background-color: rgba(247, 242, 234, 0.9);
  font-weight: 600;
}

dialog {
  border: none;
  border-radius: 24px;
  box-shadow: var(--shadow-strong);
}

dialog::backdrop {
  background: rgba(47, 38, 28, 0.42);
  backdrop-filter: blur(6px);
}

.modal-close,
body .modal-close {
  width: 42px !important;
  height: 42px !important;
  min-width: 42px !important;
  padding: 0 !important;
  margin: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 999px !important;
  border: none !important;
  background: linear-gradient(180deg, #fffdf9 0%, #f5ede1 100%) !important;
  color: var(--brand-strong) !important;
  font-size: 22px !important;
  line-height: 1 !important;
  box-shadow: 0 8px 18px rgba(62, 44, 23, 0.08) !important;
  cursor: pointer !important;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease !important;
}

.modal-close:hover,
body .modal-close:hover {
  transform: translateY(-1px) !important;
  border-color: var(--line-strong) !important;
  background: linear-gradient(180deg, #ffffff 0%, #efe3d2 100%) !important;
  box-shadow: 0 10px 20px rgba(62, 44, 23, 0.12) !important;
}

.modal-close:focus,
.modal-close:focus-visible,
body .modal-close:focus,
body .modal-close:focus-visible,
dialog button.modal-close:focus,
dialog button.modal-close:focus-visible {
  outline: none !important;
  border: none !important;
  box-shadow: 0 0 0 3px rgba(124, 92, 54, 0.14) !important;
}

/* Utility helpers */
.text-muted {
  color: var(--muted);
}

.text-right {
  text-align: right;
}

.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }

/* -----------------------------------------------------
   Stronger theme overrides for legacy page-local styles
   ----------------------------------------------------- */

body .card {
  border: 1px solid rgba(203, 189, 168, 0.8);
  border-radius: 18px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-soft);
}

body input,
body select,
body textarea {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
}

body input:focus,
body select:focus,
body textarea:focus {
  border-color: var(--brand);
  box-shadow: var(--focus-ring);
}

body button,
body .btn {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  box-shadow: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

body button:hover,
body .btn:hover {
  background: var(--surface-2);
  border-color: var(--line-strong);
  box-shadow: 0 10px 18px rgba(62, 44, 23, 0.08);
  transform: translateY(-1px);
}

body button:disabled,
body .btn:disabled {
  opacity: 0.55;
  box-shadow: none;
  transform: none;
}

body a {
  color: var(--brand-strong);
}

body a.menu-card,
body a.menu-item,
body .btn,
body button,
body .menu-card,
body .menu-item {
  text-decoration: none !important;
}

body table th,
body table td {
  border-bottom: 1px solid #eee6db;
}

body table th {
  background: rgba(247, 242, 234, 0.9);
}

body .muted,
body .text-muted,
body .hint {
  color: var(--muted);
}

body .err,
body .status-err {
  color: var(--danger);
  font-weight: 600;
}

body .ok,
body .status-ok {
  color: var(--success);
  font-weight: 600;
}

body .mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

body dialog {
  border: none;
  border-radius: 24px;
  padding: 0;
  overflow: hidden;
  box-shadow: var(--shadow-strong);
  background:
    radial-gradient(circle at top right, rgba(214, 189, 150, 0.35), transparent 28%),
    linear-gradient(180deg, #fffcf6 0%, #fffaf3 100%);
}

body dialog::backdrop {
  background: rgba(47, 38, 28, 0.42);
  backdrop-filter: blur(6px);
}

body .modal-head {
  padding: 20px 24px;
  border-bottom: 1px solid rgba(203, 189, 168, 0.7);
}

body .modal-title {
  margin: 0;
  font-size: 28px;
  line-height: 1.15;
}

body .modal-body {
  padding: 22px 24px 24px;
}

body .modal-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

body .modal-row label {
  min-width: 60px;
  font-weight: 700;
}

body .modal-row input,
body .modal-row select,
body .modal-row textarea {
  flex: 1;
}

body .list,
body .overlay-list,
body .autocomplete-list,
body .order-panel {
  border: 1px solid rgba(203, 189, 168, 0.8);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 12px 24px rgba(62, 44, 23, 0.08);
}

body .list-item,
body .batch-suggest-item {
  border-bottom: 1px solid #eee6db;
}

body .list-item:hover,
body .batch-suggest-item:hover {
  background: rgba(247, 242, 234, 0.85);
}

body .pagination .current,
body .pager button.active {
  background: linear-gradient(135deg, #8f6a3f 0%, var(--brand-strong) 100%);
  color: #fff;
  border-color: transparent;
  border-radius: 999px;
  padding: 8px 12px;
  box-shadow: 0 10px 18px rgba(62, 44, 23, 0.12);
}

body .pagination .disabled {
  color: #a59684;
}

body .btn-primary,
body .primary-btn {
  background: linear-gradient(135deg, #8f6a3f 0%, var(--brand-strong) 100%);
  color: #fff;
  border-color: transparent;
}

body .btn-primary:hover,
body .primary-btn:hover {
  background: linear-gradient(135deg, #9a7448 0%, #6d4e29 100%);
}

body .btn-danger,
body .danger-btn {
  background: linear-gradient(135deg, #c64040 0%, #991b1b 100%);
  color: #fff;
  border-color: transparent;
}

body .btn-danger:hover,
body .danger-btn:hover {
  background: linear-gradient(135deg, #d14f4f 0%, #a92222 100%);
}

body .badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(33, 114, 79, 0.18);
  background: rgba(33, 114, 79, 0.12);
  color: var(--success);
  font-size: 13px;
  font-weight: 700;
}

body .menu-card,
body .menu-item {
  display: block;
  border: 1px solid rgba(203, 189, 168, 0.8);
  border-radius: 18px;
  padding: 18px;
  text-decoration: none;
  color: var(--text);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-soft);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

body .menu-card:hover,
body .menu-item:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  background: linear-gradient(180deg, rgba(255, 252, 246, 0.98), rgba(247, 242, 234, 0.98));
  box-shadow: 0 16px 34px rgba(62, 44, 23, 0.1);
  text-decoration: none;
}

body .menu-title {
  font-weight: 700;
  margin: 0 0 6px;
}

body .menu-desc {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

body .stat-box {
  border: 1px solid rgba(203, 189, 168, 0.8);
  border-radius: 18px;
  padding: 14px;
  background: linear-gradient(180deg, rgba(255, 252, 246, 0.96), rgba(247, 242, 234, 0.9));
}

body .chart-card {
  border: 1px solid rgba(203, 189, 168, 0.9);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 253, 248, 0.98), rgba(247, 242, 234, 0.95));
  box-shadow: var(--shadow-soft);
}

body .chart-card.active {
  border-color: var(--brand-strong);
  box-shadow: 0 0 0 4px rgba(124, 92, 54, 0.18);
  background: linear-gradient(135deg, #8f6a3f 0%, var(--brand-strong) 100%);
}

body .chart-number {
  color: var(--text);
}

body .chart-card.active .chart-number {
  color: #fff;
}

body .chart-empty {
  border: 1px dashed rgba(203, 189, 168, 0.95);
  border-radius: 14px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.72);
}

body .chart-foot {
  border-top: 1px solid rgba(203, 189, 168, 0.6);
  color: var(--muted);
}

body .chart-card.active .chart-foot {
  border-top-color: rgba(255, 255, 255, 0.28);
  color: #fdf7ef;
}

@media (max-width: 640px) {
  body .modal-row {
    flex-direction: column;
    align-items: stretch;
  }
}

/* Final global override for every popup close button */
dialog button.modal-close,
body dialog button.modal-close,
button.modal-close {
  width: 42px !important;
  height: 42px !important;
  min-width: 42px !important;
  padding: 0 !important;
  margin: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 999px !important;
  border: none !important;
  background: linear-gradient(180deg, #fffdf9 0%, #f5ede1 100%) !important;
  color: var(--brand-strong) !important;
  font-size: 22px !important;
  line-height: 1 !important;
  box-shadow: 0 8px 18px rgba(62, 44, 23, 0.08) !important;
  cursor: pointer !important;
  appearance: none !important;
  -webkit-appearance: none !important;
}

dialog button.modal-close:hover,
body dialog button.modal-close:hover,
button.modal-close:hover {
  transform: translateY(-1px) !important;
  border-color: var(--line-strong) !important;
  background: linear-gradient(180deg, #ffffff 0%, #efe3d2 100%) !important;
  box-shadow: 0 10px 20px rgba(62, 44, 23, 0.12) !important;
}
