:root {
  --primary-gold: #c29b38;
  --gold-dark: #8c6d1c;
  --gold-light: #fbf7eb;
  --gold-accent: #e6c875;
  --gold-border: #ebd394;
  --bg-main: #fdfdfd;
  --bg-card: #ffffff;
  --text-dark: #0f172a;
  --text-muted: #64748b;
  --border-color: #f1f5f9;
  --sidebar-width: 260px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-dark);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* App Layout */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
  color: #f8fafc;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  border-right: 1px solid #334155;
  transition: all 0.3s ease;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
}

.sidebar-header {
  padding: 20px 16px;
  border-bottom: 1px solid #334155;
  display: flex;
  align-items: center;
  gap: 12px;
}

.shop-logo-img {
  width: 44px;
  height: 44px;
  background: #ffffff;
  border-radius: 8px;
  padding: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.shop-title-wrap h1 {
  font-family: 'Cinzel', serif;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 1px;
  color: #fef08a;
  margin: 0;
  line-height: 1.2;
  text-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

.shop-title-wrap p {
  font-size: 11px;
  color: #94a3b8;
  margin: 0;
}

.sidebar-nav {
  flex: 1;
  padding: 14px 10px;
  overflow-y: auto;
}

.nav-category {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #64748b;
  margin: 14px 8px 6px 8px;
  font-weight: 700;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  color: #cbd5e1;
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 3px;
}

.nav-link:hover {
  background-color: #334155;
  color: #ffffff;
}

.nav-link.active {
  background: linear-gradient(90deg, #8c6d1c 0%, #c29b38 100%);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(194, 155, 56, 0.25);
}

.nav-link svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid #334155;
  font-size: 11px;
  color: #94a3b8;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Main Content Area */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-x: hidden;
}

/* Top Rate Bar */
.top-rate-bar {
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  padding: 10px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
  position: sticky;
  top: 0;
  z-index: 30;
}

.rate-tickers {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.rate-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #fffbeb;
  border: 1px solid #fef3c7;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12.5px;
}

.rate-badge.silver {
  background: #f1f5f9;
  border-color: #e2e8f0;
}

.rate-badge-title {
  font-weight: 600;
  color: #78350f;
}

.rate-badge.silver .rate-badge-title {
  color: #334155;
}

.rate-badge-val {
  font-weight: 800;
  color: #b45309;
}

.rate-badge.silver .rate-badge-val {
  color: #0f172a;
}

.page-content {
  flex: 1;
  padding: 24px;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

/* Card Styles */
.card {
  background: #ffffff;
  border-radius: 12px;
  border: 1.5px solid #f1f5f9;
  box-shadow: 0 10px 30px -10px rgba(15, 23, 42, 0.04);
  padding: 20px;
  margin-bottom: 20px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #f1f5f9;
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Form Controls */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: #475569;
}

.form-control {
  padding: 8px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 13.5px;
  outline: none;
  transition: all 0.2s;
  background-color: #ffffff;
  color: #0f172a;
}

.form-control:focus {
  border-color: #b45309;
  box-shadow: 0 0 0 3px rgba(180, 83, 9, 0.15);
}

.form-control[readonly], .form-control:disabled {
  background-color: #f8fafc;
  color: #64748b;
  cursor: not-allowed;
}

/* Button Styles */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 13.5px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, #a47c24 0%, #c29b38 100%);
  color: #ffffff;
  border: 1px solid #8c6d1c;
  box-shadow: 0 4px 10px rgba(194, 155, 56, 0.2);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #8c6d1c 0%, #a47c24 100%);
}

.btn-secondary {
  background: #ffffff;
  color: #334155;
  border: 1px solid #cbd5e1;
}

.btn-secondary:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

.btn-success {
  background: #16a34a;
  color: #ffffff;
}

.btn-success:hover {
  background: #15803d;
}

.btn-danger {
  background: #dc2626;
  color: #ffffff;
}

.btn-danger:hover {
  background: #b91c1c;
}

.btn-whatsapp {
  background: #25d366;
  color: #ffffff;
  font-weight: 700;
}

.btn-whatsapp:hover {
  background: #1da851;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 4px;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 15px;
}

/* Tables */
.data-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: 8px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.data-table th {
  background-color: #f8fafc;
  padding: 10px 14px;
  font-weight: 600;
  color: #475569;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid #f1f5f9;
  color: #1e293b;
  vertical-align: middle;
}

.data-table tbody tr:hover {
  background-color: #fbfcfe;
}

/* Summary / Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: #ffffff;
  padding: 18px;
  border-radius: 12px;
  border: 1.5px solid #f1f5f9;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.02), 0 8px 10px -6px rgba(15, 23, 42, 0.02);
  transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 30px -10px rgba(15, 23, 42, 0.06);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon.gold {
  background: var(--gold-light);
  color: var(--gold-dark);
  border: 1px solid var(--gold-border);
}

.stat-icon.silver {
  background: #f8fafc;
  color: #475569;
  border: 1px solid #e2e8f0;
}

.stat-icon.green {
  background: #f0fdf4;
  color: #16a34a;
  border: 1px solid #bbf7d0;
}

.stat-icon.blue {
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
}

.stat-info h3 {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.stat-info .stat-value {
  font-size: 20px;
  font-weight: 800;
  color: #0f172a;
}

/* Modal Dialog */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
  backdrop-filter: blur(2px);
}

.modal-content {
  background: #ffffff;
  border-radius: 12px;
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 25px -5px rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-body {
  padding: 20px;
  flex: 1;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background-color: #f8fafc;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 700;
}

.badge-gold {
  background: #fef3c7;
  color: #92400e;
}

.badge-silver {
  background: #e2e8f0;
  color: #334155;
}

.badge-diamond {
  background: #e0e7ff;
  color: #3730a3;
}

.badge-success {
  background: #dcfce7;
  color: #166534;
}

.badge-danger {
  background: #fee2e2;
  color: #991b1b;
}

/* Tabs */
.tabs-container {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid #e2e8f0;
  margin-bottom: 20px;
}

.tab-btn {
  padding: 8px 18px;
  font-weight: 600;
  font-size: 13.5px;
  color: #64748b;
  border: none;
  background: transparent;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
}

.tab-btn:hover {
  color: #0f172a;
}

.tab-btn.active {
  color: #b45309;
  border-bottom-color: #b45309;
}

/* Toast Alerts */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  padding: 12px 18px;
  border-radius: 8px;
  background: #1e293b;
  color: #ffffff;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: 0 10px 15px -3px rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideIn 0.3s ease;
}

.toast.success {
  background: #15803d;
}

.toast.error {
  background: #b91c1c;
}

.toast.info {
  background: #0369a1;
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@media (max-width: 900px) {
  .app-container {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
  }
  .sidebar-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
  }
}

/* Collapsible Sidebar Styles */
.sidebar-header {
  position: relative;
}

.sidebar-toggle-btn {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 6px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.sidebar-toggle-btn:hover {
  background: #334155;
  color: #ffffff;
}

.sidebar-toggle-btn svg {
  width: 18px;
  height: 18px;
}

/* Collapsed Sidebar Menu State */
.sidebar.collapsed {
  width: 70px !important;
}

.sidebar.collapsed #sidebar-brand-wrapper,
.sidebar.collapsed .nav-category,
.sidebar.collapsed .nav-link span,
.sidebar.collapsed .sidebar-footer {
  display: none !important;
}

.sidebar.collapsed .sidebar-header {
  flex-direction: column;
  padding: 15px 10px;
  gap: 10px;
  justify-content: center !important;
}

.sidebar.collapsed .shop-logo-img {
  width: 38px;
  height: 38px;
  padding: 2px;
}

.sidebar.collapsed .nav-link {
  justify-content: center;
  padding: 12px 0;
  margin-bottom: 6px;
}

.sidebar.collapsed .nav-link svg {
  margin: 0;
  width: 20px;
  height: 20px;
}

.sidebar.collapsed .sidebar-nav {
  padding: 14px 6px;
}

/* Card Row for Line Items */
.line-item-row {
  transition: border-color 0.2s, box-shadow 0.2s;
}

.line-item-row:hover {
  border-color: #b45309 !important;
  box-shadow: 0 4px 12px rgba(180, 83, 9, 0.05) !important;
}

.line-item-row .form-group label {
  font-size: 10px !important;
  font-weight: 700 !important;
  color: #64748b !important;
  text-transform: uppercase !important;
  letter-spacing: 0.5px !important;
}

/* Premium Typography for Numeric Values */
.stat-value, 
.summary-grandtotal, 
#summary-grandtotal, 
.rate-badge-val, 
#summary-subtotal, 
#summary-net-wt, 
#summary-cgst, 
#summary-sgst, 
#summary-igst,
.item-net-weight,
.item-taxable-amount,
.bill-grand-total-bar span,
.bill-pay-val,
.bill-table-total-row td {
  font-family: 'JetBrains Mono', monospace !important;
  letter-spacing: -0.2px;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

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

::-webkit-scrollbar-thumb {
  background: #e2e8f0;
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-gold);
}

/* Sidebar Nav Income/Expense Colors */
.nav-link.nav-income svg { color: #22c55e; }
.nav-link.nav-income:hover svg, .nav-link.nav-income.active svg { color: #ffffff; }

.nav-link.nav-expense svg { color: #ef4444; }
.nav-link.nav-expense:hover svg, .nav-link.nav-expense.active svg { color: #ffffff; }
