/* =====================================================================
   A2Z BILLING POS — Design System
   "Smart Billing. Powerful Business Management."
   ===================================================================== */

:root {
  /* Brand */
  --a2z-primary: #4f46e5;
  --a2z-primary-dark: #4338ca;
  --a2z-primary-light: #818cf8;
  --a2z-secondary: #06b6d4;
  --a2z-success: #16a34a;
  --a2z-warning: #f59e0b;
  --a2z-danger: #ef4444;
  --a2z-info: #0ea5e9;

  --a2z-gradient: linear-gradient(135deg, #4f46e5 0%, #06b6d4 100%);
  --a2z-gradient-warm: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);

  /* Surfaces — light mode */
  --a2z-bg: #f4f6fb;
  --a2z-surface: #ffffff;
  --a2z-surface-glass: rgba(255, 255, 255, 0.65);
  --a2z-border: #e6e9f2;
  --a2z-text: #1a1d29;
  --a2z-text-muted: #6b7280;
  --a2z-sidebar-bg: #14162a;
  --a2z-sidebar-text: #c9ccdb;

  --a2z-radius-sm: 8px;
  --a2z-radius-md: 14px;
  --a2z-radius-lg: 20px;
  --a2z-shadow-sm: 0 1px 3px rgba(20, 22, 42, 0.06);
  --a2z-shadow-md: 0 8px 24px rgba(20, 22, 42, 0.08);
  --a2z-shadow-lg: 0 16px 48px rgba(20, 22, 42, 0.14);

  --a2z-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --a2z-transition: 180ms cubic-bezier(0.4, 0, 0.2, 1);
  --a2z-sidebar-width: 264px;
  --a2z-topbar-height: 68px;
}

[data-theme="dark"] {
  --a2z-bg: #0f1120;
  --a2z-surface: #171a2e;
  --a2z-surface-glass: rgba(23, 26, 46, 0.65);
  --a2z-border: #262a45;
  --a2z-text: #eef0fa;
  --a2z-text-muted: #9296b3;
  --a2z-sidebar-bg: #0b0c18;
  --a2z-sidebar-text: #b6b9d0;
  --a2z-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --a2z-shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --a2z-shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }

body {
  font-family: var(--a2z-font);
  background: var(--a2z-bg);
  color: var(--a2z-text);
  margin: 0;
  transition: background var(--a2z-transition), color var(--a2z-transition);
  -webkit-font-smoothing: antialiased;
}

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

/* ---------------------------------------------------------------------
   LAYOUT SHELL: sidebar + topbar + content
   --------------------------------------------------------------------- */
.a2z-shell { display: flex; min-height: 100vh; }

.a2z-sidebar {
  width: var(--a2z-sidebar-width);
  background: var(--a2z-sidebar-bg);
  color: var(--a2z-sidebar-text);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform var(--a2z-transition);
}

.a2z-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 24px;
  font-weight: 700;
  font-size: 1.05rem;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.a2z-sidebar-brand .logo-mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--a2z-gradient);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 0.95rem; color: #fff;
}
.a2z-sidebar-brand small { display: block; font-weight: 400; font-size: 0.68rem; color: var(--a2z-sidebar-text); }

.a2z-nav { padding: 14px 12px; overflow-y: auto; flex: 1; }
.a2z-nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; margin-bottom: 2px;
  border-radius: var(--a2z-radius-sm);
  font-size: 0.88rem; font-weight: 500;
  color: var(--a2z-sidebar-text);
  cursor: pointer;
  transition: background var(--a2z-transition), color var(--a2z-transition), transform var(--a2z-transition);
}
.a2z-nav-item i, .a2z-nav-item svg { width: 18px; flex-shrink: 0; }
.a2z-nav-item:hover { background: rgba(255,255,255,0.06); color: #fff; transform: translateX(2px); }
.a2z-nav-item.active {
  background: var(--a2z-gradient);
  color: #fff;
  box-shadow: var(--a2z-shadow-sm);
}

.a2z-main { margin-left: var(--a2z-sidebar-width); flex: 1; display: flex; flex-direction: column; min-width: 0; }

.a2z-topbar {
  height: var(--a2z-topbar-height);
  background: var(--a2z-surface-glass);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--a2z-border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  position: sticky; top: 0; z-index: 50;
}

.a2z-content { padding: 26px; flex: 1; }

/* ---------------------------------------------------------------------
   CARDS
   --------------------------------------------------------------------- */
.a2z-card {
  background: var(--a2z-surface);
  border: 1px solid var(--a2z-border);
  border-radius: var(--a2z-radius-md);
  box-shadow: var(--a2z-shadow-sm);
  padding: 20px;
  transition: transform var(--a2z-transition), box-shadow var(--a2z-transition);
}
.a2z-card:hover { box-shadow: var(--a2z-shadow-md); transform: translateY(-2px); }

.a2z-stat-card {
  position: relative;
  overflow: hidden;
  display: flex; flex-direction: column; gap: 6px;
}
.a2z-stat-card .icon-badge {
  width: 42px; height: 42px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: var(--a2z-gradient); color: #fff; font-size: 1.1rem;
  margin-bottom: 6px;
}
.a2z-stat-card .value { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.02em; }
.a2z-stat-card .label { font-size: 0.8rem; color: var(--a2z-text-muted); font-weight: 500; }
.a2z-stat-card .trend { font-size: 0.75rem; font-weight: 600; }
.a2z-stat-card .trend.up { color: var(--a2z-success); }
.a2z-stat-card .trend.down { color: var(--a2z-danger); }

/* Glassmorphism accent panel (used sparingly — hero/summary banners) */
.a2z-glass-panel {
  background: var(--a2z-surface-glass);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: var(--a2z-radius-lg);
  box-shadow: var(--a2z-shadow-lg);
}

/* ---------------------------------------------------------------------
   BUTTONS
   --------------------------------------------------------------------- */
.a2z-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px;
  border-radius: var(--a2z-radius-sm);
  font-weight: 600; font-size: 0.88rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform var(--a2z-transition), box-shadow var(--a2z-transition), background var(--a2z-transition);
}
.a2z-btn:active { transform: scale(0.97); }
.a2z-btn-primary { background: var(--a2z-gradient); color: #fff; box-shadow: var(--a2z-shadow-sm); }
.a2z-btn-primary:hover { box-shadow: var(--a2z-shadow-md); }
.a2z-btn-outline { background: transparent; border-color: var(--a2z-border); color: var(--a2z-text); }
.a2z-btn-outline:hover { background: var(--a2z-bg); }
.a2z-btn-danger { background: var(--a2z-danger); color: #fff; }
.a2z-btn-sm { padding: 6px 12px; font-size: 0.78rem; }

/* ---------------------------------------------------------------------
   FORMS
   --------------------------------------------------------------------- */
.a2z-input, .a2z-select, textarea.a2z-input {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--a2z-radius-sm);
  border: 1px solid var(--a2z-border);
  background: var(--a2z-surface);
  color: var(--a2z-text);
  font-size: 0.88rem;
  transition: border-color var(--a2z-transition), box-shadow var(--a2z-transition);
}
.a2z-input:focus, .a2z-select:focus {
  outline: none;
  border-color: var(--a2z-primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}
.a2z-label { font-size: 0.8rem; font-weight: 600; margin-bottom: 6px; display: block; color: var(--a2z-text-muted); }

/* ---------------------------------------------------------------------
   TABLES
   --------------------------------------------------------------------- */
.a2z-table-wrap { background: var(--a2z-surface); border-radius: var(--a2z-radius-md); border: 1px solid var(--a2z-border); overflow: hidden; }
table.a2z-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
table.a2z-table thead th {
  text-align: left; padding: 14px 18px; font-weight: 600;
  color: var(--a2z-text-muted); text-transform: uppercase; font-size: 0.7rem; letter-spacing: 0.04em;
  border-bottom: 1px solid var(--a2z-border);
}
table.a2z-table tbody td { padding: 14px 18px; border-bottom: 1px solid var(--a2z-border); }
table.a2z-table tbody tr { transition: background var(--a2z-transition); }
table.a2z-table tbody tr:hover { background: var(--a2z-bg); }
table.a2z-table tbody tr:last-child td { border-bottom: none; }

/* Badges */
.a2z-badge { padding: 4px 10px; border-radius: 999px; font-size: 0.72rem; font-weight: 700; display: inline-block; }
.a2z-badge-success { background: rgba(22,163,74,0.12); color: var(--a2z-success); }
.a2z-badge-warning { background: rgba(245,158,11,0.12); color: var(--a2z-warning); }
.a2z-badge-danger { background: rgba(239,68,68,0.12); color: var(--a2z-danger); }
.a2z-badge-info { background: rgba(14,165,233,0.12); color: var(--a2z-info); }

/* ---------------------------------------------------------------------
   SKELETON LOADERS
   --------------------------------------------------------------------- */
.a2z-skeleton {
  background: linear-gradient(90deg, var(--a2z-border) 25%, rgba(255,255,255,0.4) 37%, var(--a2z-border) 63%);
  background-size: 400% 100%;
  animation: a2z-skeleton-wave 1.4s ease infinite;
  border-radius: var(--a2z-radius-sm);
}
@keyframes a2z-skeleton-wave { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------------------------------------------------------------------
   PAGE / NUMBER ANIMATIONS
   --------------------------------------------------------------------- */
@keyframes a2z-fade-up { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.a2z-animate-in { animation: a2z-fade-up 0.4s ease both; }

/* ---------------------------------------------------------------------
   AUTH PAGES (login/register)
   --------------------------------------------------------------------- */
.a2z-auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--a2z-gradient);
  padding: 20px;
}
.a2z-auth-card {
  width: 100%; max-width: 420px;
  background: var(--a2z-surface);
  border-radius: var(--a2z-radius-lg);
  box-shadow: var(--a2z-shadow-lg);
  padding: 40px 36px;
}
.a2z-auth-logo { text-align: center; margin-bottom: 24px; }
.a2z-auth-logo .logo-mark {
  width: 52px; height: 52px; border-radius: 14px; margin: 0 auto 12px;
  background: var(--a2z-gradient); display: flex; align-items: center; justify-content: center;
  font-weight: 800; color: #fff; font-size: 1.3rem;
}

/* ---------------------------------------------------------------------
   TOASTS (fallback if SweetAlert2 toast not used directly)
   --------------------------------------------------------------------- */
.a2z-toast-container { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }

/* ---------------------------------------------------------------------
   GLOBAL AJAX LOADER
   --------------------------------------------------------------------- */
#a2z-global-loader {
  position: fixed; inset: 0; background: rgba(15,17,32,0.35); backdrop-filter: blur(2px);
  display: none; align-items: center; justify-content: center; z-index: 10000;
}
#a2z-global-loader .spinner {
  width: 44px; height: 44px; border-radius: 50%;
  border: 4px solid rgba(255,255,255,0.35); border-top-color: #fff;
  animation: a2z-spin 0.7s linear infinite;
}
@keyframes a2z-spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------------
   RESPONSIVE
   --------------------------------------------------------------------- */
.a2z-sidebar-toggle { display: none; }

@media (max-width: 992px) {
  .a2z-sidebar { transform: translateX(-100%); }
  .a2z-sidebar.open { transform: translateX(0); box-shadow: var(--a2z-shadow-lg); }
  .a2z-main { margin-left: 0; }
  .a2z-sidebar-toggle { display: inline-flex; }
}

@media (max-width: 576px) {
  .a2z-content { padding: 16px; }
  .a2z-auth-card { padding: 28px 22px; }
}

/* ---------------------------------------------------------------------
   PRINT (thermal receipt + A4 invoice) — base rules, extended per template
   --------------------------------------------------------------------- */
@media print {
  .a2z-sidebar, .a2z-topbar, .no-print { display: none !important; }
  .a2z-main { margin-left: 0 !important; }
  body { background: #fff !important; }
}
