/* ==========================================================================
   AquaPure Manager / PureWater Pro - Design System & Stylesheet
   Spécialement conçu pour Fabricants d'Eau en Sachet (Pure Water)
   ========================================================================== */

:root {
  /* Palette Primaire - Eau Purifiée Vive & Cristalline */
  --primary-50: #f0f9ff;
  --primary-100: #e0f2fe;
  --primary-200: #bae6fd;
  --primary-300: #7dd3fc;
  --primary-400: #38bdf8;
  --primary-500: #0284c7; /* Cyan / Eau Vive */
  --primary-600: #0369a1;
  --primary-700: #075985;
  --primary-900: #0c4a6e;

  /* Couleurs de Statut & Actions */
  --success-50: #ecfdf5;
  --success-500: #10b981;
  --success-700: #047857;

  --warning-50: #fffbeb;
  --warning-500: #f59e0b;
  --warning-700: #b45309;

  --danger-50: #fef2f2;
  --danger-500: #ef4444;
  --danger-700: #b91c1c;

  --purple-50: #faf5ff;
  --purple-500: #8b5cf6;

  /* Couleurs Neutres & Surfaces */
  --bg-app: #f0f7fc; /* Teinte Glacée Rafraîchissante */
  --bg-surface: #ffffff;
  --bg-subtle: #f8fafc;
  --border-light: #e2e8f0;
  --border-subtle: #f1f5f9;

  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-dim: #94a3b8;
  --text-inverse: #ffffff;

  /* Ombres & Rayons */
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --shadow-subtle: 0 1px 3px rgba(2, 132, 199, 0.05);
  --shadow-sm: 0 2px 8px rgba(2, 132, 199, 0.08);
  --shadow-md: 0 8px 24px rgba(2, 132, 199, 0.1);
  --shadow-lg: 0 16px 36px rgba(2, 132, 199, 0.15);

  --font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  font-family: var(--font-family);
  background-color: var(--bg-app);
  color: var(--text-main);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button, input, select, textarea {
  font: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

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

/* App Layout */
#appWorkspace {
  display: none;
}

#landingScreen {
  display: flex;
}

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

/* Sidebar Navigation */
.app-sidebar {
  width: 275px;
  background: linear-gradient(180deg, #071524 0%, #0c2035 100%);
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform 0.3s ease;
  box-shadow: 4px 0 20px rgba(7, 21, 36, 0.2);
}

.brand {
  padding: 1.35rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
}

.brand-logo-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 4px 10px rgba(14, 165, 233, 0.4));
  transition: transform 0.25s ease;
}

.brand-logo-wrap:hover {
  transform: scale(1.06);
}

.brand-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.brand-app-title {
  font-size: 1.125rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.badge-pro {
  font-size: 0.625rem;
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
  color: white;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.brand-company-subtitle {
  font-size: 0.78rem;
  color: #38bdf8;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-menu {
  padding: 1rem 0.75rem;
  list-style: none;
  flex: 1;
  overflow-y: auto;
}

.nav-item {
  margin-bottom: 0.3rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-sm);
  color: #94a3b8;
  font-size: 0.925rem;
  font-weight: 500;
  transition: var(--transition);
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #ffffff;
}

.nav-link.active {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.4);
}

.nav-link .icon {
  font-size: 1.2rem;
  min-width: 24px;
  text-align: center;
}

.nav-link .badge-nav {
  margin-left: auto;
  font-size: 0.725rem;
  padding: 0.15rem 0.5rem;
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-full);
}

.nav-link.active .badge-nav {
  background: rgba(0, 0, 0, 0.25);
}

.sidebar-footer {
  padding: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.8rem;
  color: #64748b;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: rgba(0, 0, 0, 0.15);
}

.factory-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #cbd5e1;
  font-weight: 500;
}

.status-dot {
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 8px #10b981;
}

/* Main Content Area */
.app-main {
  flex: 1;
  margin-left: 275px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Top Header */
.top-header {
  height: 72px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 10px rgba(2, 132, 199, 0.04);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

/* Header Brand Badge Component */
.header-brand-badge {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: linear-gradient(135deg, #e0f2fe 0%, #f0f9ff 100%);
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-full);
  border: 1px solid #bae6fd;
}

.header-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.header-brand-text .app-title {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--primary-700);
}

.header-brand-text .factory-title {
  font-size: 0.725rem;
  font-weight: 600;
  color: var(--primary-500);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.menu-toggle {
  display: none;
  font-size: 1.4rem;
  color: var(--text-main);
}

.page-title-wrap h2 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.page-title-wrap p {
  font-size: 0.825rem;
  color: var(--text-muted);
}

.badge-text-short {
  display: none;
}

.badge-text-full {
  display: inline;
}

.user-profile-btn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  background: var(--bg-subtle);
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-light);
  transition: all 0.15s ease;
}

.user-profile-btn:hover {
  background: #f1f5f9;
  border-color: var(--primary-300);
}

.user-avatar-circle {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 50%;
  background: var(--primary-600);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 800;
  flex-shrink: 0;
}

.user-info-text {
  text-align: left;
  line-height: 1.2;
}

.user-name-text {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text-main);
}

.user-role-text {
  font-size: 0.7rem;
  color: var(--primary-600);
  font-weight: 700;
}

.user-chevron {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-left: 0.2rem;
  flex-shrink: 0;
}

/* Content View Body */
.content-body {
  padding: 1.75rem 2rem 3rem;
  flex: 1;
}

.tab-pane {
  display: none;
  animation: fadeIn 0.25s ease forwards;
}

.tab-pane.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Buttons & Controls */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.15rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary-500);
  color: var(--text-inverse);
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.25);
}

.btn-primary:hover {
  background: var(--primary-600);
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.35);
  transform: translateY(-1px);
}

.btn-success {
  background: var(--success-500);
  color: var(--text-inverse);
}

.btn-success:hover {
  background: var(--success-700);
}

.btn-secondary {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: var(--bg-subtle);
  border-color: #cbd5e1;
}

.btn-danger {
  background: var(--danger-500);
  color: var(--text-inverse);
}

.btn-danger:hover {
  background: var(--danger-700);
}

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  border-radius: var(--radius-xs);
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Cards & Layout Grids */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.75rem;
}

.stat-card {
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-subtle);
  display: flex;
  align-items: center;
  gap: 1rem;
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--primary-500);
}

.stat-card.stat-green::after { background: var(--success-500); }
.stat-card.stat-amber::after { background: var(--warning-500); }
.stat-card.stat-red::after { background: var(--danger-500); }
.stat-card.stat-purple::after { background: var(--purple-500); }

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  background: var(--primary-50);
  color: var(--primary-600);
  flex-shrink: 0;
}

.stat-green .stat-icon { background: var(--success-50); color: var(--success-700); }
.stat-amber .stat-icon { background: var(--warning-50); color: var(--warning-700); }
.stat-red .stat-icon { background: var(--danger-50); color: var(--danger-700); }
.stat-purple .stat-icon { background: var(--purple-50); color: var(--purple-500); }

.stat-content {
  flex: 1;
}

.stat-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.stat-value {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 0.2rem;
  letter-spacing: -0.02em;
}

.stat-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Dashboard Sections Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1.2fr;
  gap: 1.5rem;
}

.card {
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-subtle);
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.card-header {
  padding: 1.15rem 1.35rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-body {
  padding: 1.25rem 1.35rem;
}

/* Quick Actions Strip */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.5rem;
}

.action-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.6rem;
  transition: var(--transition);
  cursor: pointer;
}

.action-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary-500);
  box-shadow: var(--shadow-sm);
}

.action-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.action-card span {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-main);
}

/* Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

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

.data-table th {
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-weight: 600;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.data-table td {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-main);
  vertical-align: middle;
}

.data-table tr:hover td {
  background: #f8fafc;
}

/* Badges & Pills */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-success {
  background: var(--success-50);
  color: var(--success-700);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-warning {
  background: var(--warning-50);
  color: var(--warning-700);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge-danger {
  background: var(--danger-50);
  color: var(--danger-700);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.badge-info {
  background: var(--primary-50);
  color: var(--primary-700);
  border: 1px solid rgba(2, 132, 199, 0.2);
}

.badge-secondary {
  background: #f1f5f9;
  color: #475569;
}

/* Forms & Inputs */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-label {
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--text-main);
}

.form-label .required {
  color: var(--danger-500);
}

.form-control {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-main);
  outline: none;
  transition: var(--transition);
  font-size: 0.9rem;
}

.form-control:focus {
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.form-help {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* POS / Sales Grid */
.pos-layout {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 1.5rem;
}

.product-selector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}

.product-sale-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.product-sale-card:hover {
  border-color: var(--primary-500);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.product-sale-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}

.product-sale-title {
  font-size: 0.925rem;
  font-weight: 700;
  color: var(--text-main);
}

.product-sale-price {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary-600);
  margin: 0.5rem 0;
}

.product-sale-stock {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Modals */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  padding: 1rem;
}

.modal-backdrop.open {
  opacity: 1;
  visibility: visible;
}

#modalSubscriptionLock.open {
  display: flex !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

#modalSubscriptionLock:not(.open) {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.modal-dialog {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 650px;
  max-height: calc(100vh - 2.5rem);
  max-height: calc(100dvh - 2.5rem);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  transform: translateY(15px);
  transition: transform 0.2s ease;
  overflow: hidden;
  margin: auto;
}

.modal-dialog form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.modal-backdrop.open .modal-dialog {
  transform: translateY(0);
}

.modal-header {
  flex-shrink: 0;
  padding: 1.15rem 1.5rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: var(--bg-surface);
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  line-height: 1.3;
}

.modal-close {
  font-size: 1.4rem;
  color: var(--text-muted);
  line-height: 1;
  padding: 0.35rem 0.5rem;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.modal-close:hover {
  color: var(--danger-500);
  background: rgba(239, 68, 68, 0.1);
}

.modal-body {
  flex: 1;
  min-height: 0;
  padding: 1.5rem;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--primary-400) #f1f5f9;
}

.modal-body::-webkit-scrollbar {
  width: 7px;
}
.modal-body::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 4px;
}
.modal-body::-webkit-scrollbar-thumb {
  background: var(--primary-400);
  border-radius: 4px;
}
.modal-body::-webkit-scrollbar-thumb:hover {
  background: var(--primary-600);
}

.modal-footer {
  flex-shrink: 0;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.75rem;
  background: var(--bg-subtle);
  border-bottom-left-radius: var(--radius-lg);
  border-bottom-right-radius: var(--radius-lg);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  pointer-events: none;
}

.toast {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.25rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-main);
  animation: toastIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  pointer-events: auto;
  max-width: 380px;
}

.toast-success { border-left: 4px solid var(--success-500); }
.toast-error { border-left: 4px solid var(--danger-500); }
.toast-warning { border-left: 4px solid var(--warning-500); }
.toast-info { border-left: 4px solid var(--primary-500); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(20px) scale(0.9); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* =============================================================================
   PAGE D'ACCUEIL & CONNEXION (MOBILE-FIRST CLEAN DESIGN)
   ============================================================================= */
.landing-screen {
  min-height: 100vh;
  min-height: 100dvh;
  background: radial-gradient(circle at 50% 10%, #e0f2fe 0%, #f8fafc 60%, #f1f5f9 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem;
  color: var(--text-main);
}

.landing-container {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1.75rem;
}

/* 1. Logo Block on Top */
.landing-logo-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.landing-hero-logo {
  filter: drop-shadow(0 10px 24px rgba(2, 132, 199, 0.45));
  transition: transform 0.25s ease;
}

.landing-hero-logo:hover {
  transform: scale(1.06);
}

.landing-app-title {
  font-size: 2.35rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  color: #0c2035;
  line-height: 1.1;
  margin-top: 0.25rem;
}

.landing-app-tagline {
  font-size: 1.05rem;
  font-weight: 500;
  color: #475569;
  line-height: 1.4;
}

/* 2. Main Actions Card */
.landing-actions-card {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: #ffffff;
  padding: 1.5rem 1.25rem;
  border-radius: 24px;
  border: 1px solid rgba(2, 132, 199, 0.15);
  box-shadow: 0 12px 36px rgba(2, 132, 199, 0.12), 0 2px 8px rgba(0,0,0,0.04);
}

.btn-landing-primary {
  width: 100%;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  font-size: 1.15rem;
  font-weight: 700;
  border-radius: 16px;
  border: none;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(2, 132, 199, 0.35);
  transition: all 0.2s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.btn-landing-primary:hover {
  background: linear-gradient(135deg, #0369a1 0%, #075985 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(2, 132, 199, 0.45);
}

.btn-landing-primary:active {
  transform: scale(0.97);
}

.btn-landing-primary i {
  font-size: 1.25rem;
}

.btn-landing-secondary {
  width: 100%;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  background: #f8fafc;
  color: #0284c7;
  font-size: 1.125rem;
  font-weight: 700;
  border-radius: 16px;
  border: 2px solid #bae6fd;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.btn-landing-secondary:hover {
  background: #e0f2fe;
  border-color: #0284c7;
  transform: translateY(-2px);
}

.btn-landing-secondary:active {
  transform: scale(0.97);
}

.btn-landing-secondary i {
  font-size: 1.25rem;
  color: #0284c7;
}

/* 3. Features List (Clean mobile pills) */
.landing-features-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.landing-feature-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(226, 232, 240, 0.9);
  padding: 0.85rem 1.15rem;
  border-radius: 16px;
  font-size: 0.975rem;
  font-weight: 600;
  color: #1e293b;
  text-align: left;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
}

.feature-bullet-icon {
  width: 36px;
  height: 36px;
  min-width: 36px;
  background: #e0f2fe;
  color: #0284c7;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
}

.landing-footer-simple {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: #94a3b8;
}

/* Receipt / Ticket Thermal Design */
.receipt-paper {
  background: #ffffff;
  width: 100%;
  max-width: 380px;
  margin: 0 auto;
  padding: 1.5rem;
  border: 1px dashed #cbd5e1;
  font-family: 'Courier New', Courier, monospace;
  color: #000000;
  font-size: 0.85rem;
}

.receipt-center {
  text-align: center;
}

.receipt-divider {
  border-top: 1px dashed #64748b;
  margin: 0.75rem 0;
}

.receipt-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.35rem;
}

/* Print Styles */
@media print {
  body * {
    visibility: hidden;
  }
  .printable-area, .printable-area * {
    visibility: visible;
  }
  .printable-area {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
  }
  .no-print {
    display: none !important;
  }
}

/* =============================================================================
   MOBILE-FIRST & RESPONSIVE DESIGN (PWA APP-STYLE)
   ============================================================================= */

/* Mobile Sidebar Backdrop Overlay */
.sidebar-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(7, 21, 36, 0.65);
  backdrop-filter: blur(4px);
  z-index: 999;
  opacity: 0;
  transition: opacity 0.25s ease;
}

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

/* Mobile Bottom Navigation Bar */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 62px;
  background: #ffffff;
  border-top: 1px solid var(--border-light);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
  z-index: 1050;
  padding: 0 0.25rem;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  justify-content: space-around;
  align-items: center;
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.35rem 0.25rem;
  border-radius: var(--radius-md);
  transition: all 0.15s ease;
  flex: 1;
  text-align: center;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.mobile-nav-item i {
  font-size: 1.15rem;
}

.mobile-nav-item.active {
  color: var(--primary-600);
}

.mobile-nav-pos-btn .pos-icon-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.4);
  margin-top: -16px;
  transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.mobile-nav-pos-btn .pos-icon-circle i {
  font-size: 1.2rem;
}

.mobile-nav-pos-btn:active .pos-icon-circle {
  transform: scale(0.92);
}

/* Tablet adjustments (<= 1024px) */
@media (max-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .pos-layout {
    grid-template-columns: 1fr;
  }
}

/* Mobile Devices (<= 768px) */
@media (max-width: 768px) {
  /* Layout & Spacing */
  .mobile-bottom-nav {
    display: flex;
  }
  
  .app-main {
    margin-left: 0;
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }
  
  .app-sidebar {
    width: 285px;
    transform: translateX(-100%);
    z-index: 1000;
  }
  
  .app-sidebar.open {
    transform: translateX(0);
  }

  .menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    background: var(--bg-subtle);
    color: var(--text-main);
    font-size: 1.1rem;
    flex-shrink: 0;
  }

  /* Mobile Header - Compact & Clean Layout */
  .top-header {
    padding: 0 0.85rem;
    height: 56px;
    gap: 0.5rem;
    justify-content: flex-end;
  }

  .header-left,
  .menu-toggle,
  .page-title-wrap {
    display: none !important;
  }

  .header-actions {
    gap: 0.45rem;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-end;
  }

  /* Hide raw action buttons in top header on mobile */
  .header-actions > .btn {
    display: none !important;
  }

  /* Responsive Subscription Badge on Mobile */
  .badge-text-short {
    display: inline !important;
  }

  .badge-text-full {
    display: none !important;
  }

  #headerSubscriptionBadge {
    padding: 0.3rem 0.55rem !important;
    font-size: 0.72rem !important;
    white-space: nowrap !important;
    flex-shrink: 0;
    gap: 0.25rem !important;
    border-radius: var(--radius-full) !important;
  }

  /* Compact Cloud Status Icon on Mobile (Zero Text Squishing) */
  .hide-mobile-text {
    display: none !important;
  }

  #cloudStatusBadge {
    padding: 0.35rem !important;
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 50% !important;
    flex-shrink: 0;
  }

  #cloudStatusBadge .status-dot {
    margin: 0 !important;
    width: 8px !important;
    height: 8px !important;
  }

  /* Priority User Profile Pill on Mobile Header - Name 100% visible */
  .user-profile-btn {
    padding: 0.25rem 0.55rem !important;
    gap: 0.4rem !important;
    background: var(--bg-subtle) !important;
    border-radius: var(--radius-full) !important;
    border: 1px solid var(--border-light) !important;
    flex-shrink: 1 !important;
    min-width: 0 !important;
    max-width: 170px !important;
    display: flex !important;
    align-items: center !important;
  }

  .user-avatar-circle {
    width: 26px !important;
    height: 26px !important;
    min-width: 26px !important;
    font-size: 0.72rem !important;
    flex-shrink: 0 !important;
  }

  .user-info-text {
    display: flex !important;
    flex-direction: column !important;
    min-width: 0 !important;
    overflow: hidden !important;
    text-align: left !important;
  }

  .user-name-text {
    max-width: 105px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    font-size: 0.8rem !important;
    font-weight: 800 !important;
    color: #0c2035 !important;
    line-height: 1.1 !important;
  }

  .user-role-text {
    font-size: 0.64rem !important;
    color: var(--primary-600) !important;
    font-weight: 700 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    line-height: 1.1 !important;
  }

  .user-chevron {
    font-size: 0.6rem !important;
    color: var(--text-muted) !important;
    flex-shrink: 0 !important;
    margin-left: 0.1rem !important;
  }

  .content-body {
    padding: 0.85rem 0.75rem;
  }

  .hide-mobile {
    display: none !important;
  }

  /* Compact 2-column mobile stats grid */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.65rem;
  }

  .stat-card {
    padding: 0.85rem;
    gap: 0.6rem;
  }

  .stat-icon {
    width: 38px;
    height: 38px;
    font-size: 1rem;
  }

  .stat-val {
    font-size: 1.25rem;
  }

  .stat-label {
    font-size: 0.72rem;
  }

  /* Form & Input Touch Optimization (No iOS Auto-zoom) */
  input, select, textarea {
    font-size: 16px !important;
    min-height: 44px;
  }

  .form-grid {
    grid-template-columns: 1fr !important;
    gap: 0.85rem;
  }

  .form-group.full-width {
    grid-column: span 1;
  }

  /* Mobile Bottom Sheet Modals */
  .modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }

  .modal-dialog {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 90vh !important;
    max-height: 90dvh !important;
    border-radius: 20px 20px 0 0 !important;
    margin: 0;
    animation: slideUpMobile 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex !important;
    flex-direction: column !important;
  }

  .modal-dialog form {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
  }

  @keyframes slideUpMobile {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }

  .modal-header {
    flex-shrink: 0;
    padding: 1.1rem 1.25rem 0.85rem;
    position: sticky;
    top: 0;
    background: var(--bg-surface);
    z-index: 10;
    border-bottom: 1px solid var(--border-light);
  }

  .modal-body {
    flex: 1;
    min-height: 0;
    padding: 1rem 1.25rem;
    max-height: calc(90vh - 135px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .modal-footer {
    flex-shrink: 0;
    padding: 0.85rem 1.25rem calc(0.85rem + env(safe-area-inset-bottom, 0px));
    position: sticky;
    bottom: 0;
    background: var(--bg-surface);
    z-index: 10;
    border-top: 1px solid var(--border-light);
    gap: 0.65rem;
  }

  .modal-footer .btn {
    flex: 1;
    height: 46px;
    font-size: 0.95rem;
    justify-content: center;
  }

  /* Mobile Tables with Smooth Touch Scrolling */
  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-md);
  }

  .table-responsive table {
    min-width: 540px;
  }

  /* Quick Actions Grid on Mobile (Large Tap Cards) */
  .quick-actions {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.65rem !important;
    overflow-x: visible !important;
    padding-bottom: 0.5rem !important;
  }

  .action-card {
    min-width: 0 !important;
    height: 74px !important;
    background: var(--bg-surface) !important;
    border: 1px solid var(--border-light) !important;
    border-radius: var(--radius-md) !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 0.75rem !important;
    padding: 0.65rem 0.85rem !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
    transition: transform 0.12s ease !important;
  }

  .action-card:active {
    transform: scale(0.96) !important;
    background: var(--bg-subtle) !important;
  }

  .action-card .action-icon {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    border-radius: 12px !important;
    font-size: 1.15rem !important;
    margin-bottom: 0 !important;
  }

  .action-card span {
    font-size: 0.825rem !important;
    font-weight: 700 !important;
    text-align: left !important;
    line-height: 1.2 !important;
    color: var(--text-main) !important;
  }

  /* POS Layout on Mobile */
  .pos-layout {
    display: flex !important;
    flex-direction: column !important;
    gap: 1rem !important;
  }

  .product-selector-grid {
    grid-template-columns: 1fr !important;
    gap: 0.75rem !important;
  }

  .pos-product-card {
    padding: 1rem !important;
    border-radius: var(--radius-md) !important;
    min-height: 80px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
  }

  .pos-product-card:active {
    transform: scale(0.97) !important;
  }

  /* Mobile Workspace Layout */
  .app-main {
    margin-left: 0;
    padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px));
    background-color: #f8fafc;
  }

  .content-body {
    padding: 1rem 0.85rem;
    max-width: 100%;
  }

  /* Cards on Mobile */
  .card {
    background: #ffffff;
    border-radius: 20px;
    border: 1px solid var(--border-light);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
    padding: 1.15rem;
    margin-bottom: 1.15rem;
  }

  .card-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 1rem;
  }

  .card-header > div:first-child {
    width: 100%;
  }

  .card-header .btn,
  .card-header .card-actions {
    width: 100%;
    display: flex;
    justify-content: flex-start;
    gap: 0.5rem;
  }

  .card-header .btn {
    width: 100%;
    justify-content: center;
  }

  .card-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: #0c2035;
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }

  /* Stats Grid on Mobile (2 columns with large bold numbers) */
  .stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.15rem;
  }

  .stat-card {
    background: #ffffff;
    border-radius: 18px;
    border: 1px solid var(--border-light);
    padding: 1rem 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
  }

  .stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
  }

  .stat-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    line-height: 1.2;
  }

  .stat-value {
    font-size: 1.35rem;
    font-weight: 900;
    color: #0c2035;
    line-height: 1.1;
  }

  .stat-subtitle {
    font-size: 0.75rem;
    color: #64748b;
    font-weight: 500;
  }

  /* Mobile Tables with Smooth Touch Scrolling */
  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 16px;
    border: 1px solid var(--border-light);
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    margin-bottom: 0.75rem;
  }

  .data-table {
    min-width: 560px;
    width: 100%;
    border-collapse: collapse;
  }

  .data-table thead {
    display: table-header-group;
  }

  .data-table thead th {
    background: #f8fafc;
    color: #475569;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.85rem 1rem;
    border-bottom: 2px solid var(--border-light);
    white-space: nowrap;
  }

  .data-table tbody tr {
    display: table-row;
    background: #ffffff;
    border-bottom: 1px solid var(--border-light);
    transition: background 0.15s ease;
  }

  .data-table tbody tr:active {
    background: #f0f7fc;
  }

  .data-table tbody td {
    display: table-cell;
    padding: 0.85rem 1rem;
    font-size: 0.925rem;
    vertical-align: middle;
    white-space: nowrap;
    border: none;
    border-bottom: 1px solid var(--border-light);
  }

  .data-table tbody tr:last-child td {
    border-bottom: none;
  }

  /* User profile dropdown on mobile (Zero clipping / Perfect right alignment) */
  #userDropdownMenu {
    position: absolute !important;
    top: calc(100% + 8px) !important;
    right: 0 !important;
    left: auto !important;
    width: 240px !important;
    max-width: calc(100vw - 1.5rem) !important;
    border-radius: 16px !important;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.06) !important;
    border: 1px solid var(--border-light) !important;
    background: #ffffff !important;
    z-index: 1200 !important;
  }

  /* Landing Screen on Mobile (Clean, High Contrast & Spacious) */
  .landing-screen {
    padding: 2.5rem 1.1rem 3rem;
  }

  .landing-container {
    gap: 1.5rem;
  }

  .landing-app-title {
    font-size: 2.2rem;
  }

  .landing-app-tagline {
    font-size: 1.05rem;
  }

  .landing-actions-card {
    padding: 1.35rem 1.15rem;
    gap: 0.85rem;
  }

  .btn-landing-primary,
  .btn-landing-secondary {
    height: 54px;
    font-size: 1.1rem;
  }

  .landing-feature-item {
    padding: 0.75rem 1rem;
    font-size: 0.925rem;
  }
}
