/* ChasMartz – Global Styles (Android App-like) */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  --primary: #6C63FF;
  --primary-dark: #4A42CC;
  --primary-light: #EEF0FF;
  --secondary: #FF6584;
  --accent: #43D9AD;
  --bg: #0F0F1A;
  --surface: #1A1A2E;
  --surface2: #16213E;
  --card: #1E2140;
  --border: #2A2D4E;
  --text: #E8E8F0;
  --text-muted: #8B8DAA;
  --text-light: #FFFFFF;
  --success: #43D9AD;
  --error: #FF4757;
  --warning: #FFA502;
  --info: #54A0FF;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --shadow: 0 8px 32px rgba(0,0,0,0.4);
  --shadow-sm: 0 4px 12px rgba(0,0,0,0.2);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --nav-height: 64px;
  --bottom-nav-height: 64px;
  --header-height: 60px;
}

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

html {
  background-color: #07070F !important;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  display: flex !important;
  justify-content: center !important;
  min-height: 100vh !important;
  width: 100% !important;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg) !important;
  color: var(--text);
  min-height: 100vh;
  width: 100% !important;
  max-width: 480px !important;
  margin: 0 auto !important;
  position: relative;
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  overflow-x: hidden;
}

/* ── Scrollbar ─────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 4px; }

/* ── App Shell ─────────────────────────────── */
.app-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  min-width: 0;
  width: 100%;
}

/* ── Top Header ────────────────────────────── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  height: var(--header-height);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.app-header .logo {
  font-size: 1.3rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  flex: 1;
}
.app-header .header-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-light);
  flex: 1;
  text-align: center;
}
.icon-btn {
  width: 40px; height: 40px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text);
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}
.icon-btn:hover { background: var(--primary); color: white; transform: scale(1.05); }

/* ── Bottom Nav ────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px;
  height: var(--bottom-nav-height);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 100;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.bottom-nav .nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.65rem;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  min-width: 56px;
}
.bottom-nav .nav-item.active,
.bottom-nav .nav-item:hover { color: var(--primary); }
.bottom-nav .nav-item.active svg { transform: scale(1.1); }

/* ── Side Menu / Drawer ────────────────────── */
.overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 200;
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s;
}
.overlay.open { opacity: 1; pointer-events: all; }
.side-menu {
  position: absolute;
  top: 0; left: 0;
  height: 100%;
  min-height: 100vh;
  width: 280px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  z-index: 201;
  transform: translateX(-100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex; flex-direction: column;
  overflow-y: auto;
}
.side-menu.open { transform: translateX(0); }
.side-menu-header {
  padding: 48px 20px 20px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}
.side-menu-header .avatar {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem; margin-bottom: 12px;
  border: 2px solid rgba(255,255,255,0.3);
}
.side-menu-header .name { font-size: 1.1rem; font-weight: 700; color: white; }
.side-menu-header .role { font-size: 0.75rem; color: rgba(255,255,255,0.7); }
.side-menu-body { padding: 12px 0; flex: 1; }
.menu-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 20px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--transition);
  border-left: 3px solid transparent;
}
.menu-item:hover, .menu-item.active {
  background: var(--primary-light);
  color: var(--primary);
  border-left-color: var(--primary);
}
.menu-item svg { flex-shrink: 0; }
.menu-divider { height: 1px; background: var(--border); margin: 8px 16px; }

/* ── Cards ─────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: var(--transition);
}
.card:hover { border-color: var(--primary); transform: translateY(-2px); }
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 16px;
  display: flex; align-items: center; gap: 14px;
}
.stat-card .stat-icon {
  width: 52px; height: 52px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-card .stat-num { font-size: 1.6rem; font-weight: 800; color: var(--text-light); }
.stat-card .stat-label { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }

/* ── List Cards ────────────────────────────── */
.card-list { display: flex; flex-direction: column; gap: 12px; }
.list-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px;
  display: flex; gap: 14px; align-items: center;
  transition: var(--transition);
}
.list-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.list-card-left { flex-shrink: 0; }
.shop-logo-sm {
  width: 80px; height: 80px; border-radius: var(--radius-sm);
  object-fit: cover; background: var(--surface); border: 1px solid var(--border);
}
.list-card-body {
  flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0;
}
.list-card-title {
  font-size: 1.05rem; font-weight: 700; color: var(--text-light);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.list-card-meta {
  display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; color: var(--text-muted);
}
.list-card-meta span { display: flex; align-items: center; gap: 6px; }
.list-card-actions {
  flex-shrink: 0; display: flex; flex-direction: column; gap: 8px; min-width: 100px;
}

/* ── Buttons ───────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem; font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: 0 4px 15px rgba(108, 99, 255, 0.4);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(108, 99, 255, 0.5); }
.btn-secondary {
  background: var(--card); color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }
.btn-success { background: var(--success); color: #0F1A15; }
.btn-danger { background: var(--error); color: white; }
.btn-warning { background: var(--warning); color: #1A1000; }
.btn-sm { padding: 8px 14px; font-size: 0.8rem; border-radius: var(--radius-xs); }
.btn-block { width: 100%; }
.btn-icon { width: 36px; height: 36px; padding: 0; border-radius: 50%; }
.btn-whatsapp { background: #25D366; color: white; }
.btn-whatsapp:hover { background: #128C7E; }

/* ── Inputs ────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block; margin-bottom: 6px;
  font-size: 0.82rem; font-weight: 600;
  color: var(--text-muted);
}
.form-control {
  width: 100%;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--text);
  font-size: 0.9rem;
  font-family: 'Inter', sans-serif;
  transition: var(--transition);
  outline: none;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(108,99,255,0.15); }
.form-control::placeholder { color: var(--text-muted); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }
.input-group, .input-icon-wrap { position: relative; }
.input-group .input-icon, .input-icon-wrap .input-icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); pointer-events: none;
}
.input-group .form-control, .input-icon-wrap .form-control { padding-left: 42px; }
.input-group .input-suffix, .input-icon-wrap .input-suffix {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); cursor: pointer;
}

/* ── Flash Messages ────────────────────────── */
.flash-msg {
  padding: 12px 16px; border-radius: var(--radius-sm);
  margin: 12px 16px; font-size: 0.88rem; font-weight: 500;
  display: flex; align-items: center; gap: 8px;
  animation: slideDown 0.3s ease;
}
.flash-success { background: rgba(67,217,173,0.15); border: 1px solid var(--success); color: var(--success); }
.flash-error   { background: rgba(255,71,87,0.15);  border: 1px solid var(--error);   color: var(--error); }
.flash-warning { background: rgba(255,165,2,0.15);  border: 1px solid var(--warning); color: var(--warning); }
.flash-info    { background: rgba(84,160,255,0.15); border: 1px solid var(--info);    color: var(--info); }

/* ── Tables ────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
.table {
  width: 100%; border-collapse: collapse;
  font-size: 0.82rem; min-width: 480px;
}
.table th {
  background: var(--surface2);
  padding: 12px 10px;
  text-align: left;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
.table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: rgba(108,99,255,0.05); }

/* ── Badges ────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 0.72rem; font-weight: 600;
}
.badge-success { background: rgba(67,217,173,0.15); color: var(--success); }
.badge-error   { background: rgba(255,71,87,0.15);  color: var(--error); }
.badge-warning { background: rgba(255,165,2,0.15);  color: var(--warning); }
.badge-info    { background: rgba(84,160,255,0.15); color: var(--info); }
.badge-primary { background: rgba(108,99,255,0.15); color: var(--primary); }

/* ── Page Content ──────────────────────────── */
.page-content {
  padding: 16px;
  padding-bottom: calc(var(--bottom-nav-height) + 20px);
  flex: 1;
  min-width: 0;
  width: 100%;
}
.page-title { font-size: 1.2rem; font-weight: 700; color: var(--text-light); margin-bottom: 16px; }
.section-title {
  font-size: 0.85rem; font-weight: 700;
  color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 0.8px; margin-bottom: 12px;
}

/* ── Auth Pages ────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex; flex-direction: column; justify-content: center;
  padding: 24px;
  background: linear-gradient(160deg, var(--surface) 0%, var(--bg) 100%);
}
.auth-logo {
  text-align: center;
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.logo-icon {
  color: var(--primary);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.logo-text {
  font-size: 2.2rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin: 0;
  line-height: 1.2;
}
.logo-sub {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 4px;
}
.auth-subtitle { text-align: center; color: var(--text-muted); font-size: 0.9rem; margin-bottom: 32px; }
.auth-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 28px 24px;
  box-shadow: var(--shadow);
}
.auth-card h2 { font-size: 1.3rem; font-weight: 700; color: var(--text-light); margin-bottom: 4px; }
.auth-card p { font-size: 0.83rem; color: var(--text-muted); margin-bottom: 24px; }

/* ── Product Card ──────────────────────────── */
.product-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: var(--transition);
}
.product-card:hover { transform: translateY(-4px); border-color: var(--primary); box-shadow: var(--shadow); }
.product-img {
  width: 100%; height: 160px; object-fit: cover;
  background: var(--surface);
}
.product-img-placeholder {
  width: 100%; height: 160px;
  background: var(--surface);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
}
.product-info { padding: 12px; }
.product-name { font-size: 0.88rem; font-weight: 600; color: var(--text-light); margin-bottom: 4px; }
.product-price { font-size: 1rem; font-weight: 700; color: var(--primary); }
.product-original { font-size: 0.78rem; color: var(--text-muted); text-decoration: line-through; }
.product-discount-badge {
  display: inline-block; background: var(--error);
  color: white; font-size: 0.7rem; font-weight: 700;
  padding: 2px 8px; border-radius: 20px; margin-left: 6px;
}

/* ── Grid Helpers ──────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

/* ── Slideshow ─────────────────────────────── */
.slideshow {
  position: relative; overflow: hidden;
  border-radius: var(--radius); height: 200px;
  background: var(--card);
}
.slide { display: none; animation: fadeSlide 0.5s ease; }
.slide.active { display: block; }
.slide img { width: 100%; height: 200px; object-fit: cover; }
.slide-dots {
  position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 6px;
}
.dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: rgba(255,255,255,0.4); cursor: pointer; transition: var(--transition);
}
.dot.active { background: white; width: 20px; border-radius: 4px; }
.slide-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(0,0,0,0.5); color: white;
  border: none; cursor: pointer; padding: 8px 10px;
  border-radius: 50%; font-size: 1rem;
}
.slide-nav.prev { left: 8px; }
.slide-nav.next { right: 8px; }

/* ── Search Bar ────────────────────────────── */
.search-bar {
  position: relative; margin-bottom: 16px;
}
.search-bar input {
  width: 100%;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 50px;
  padding: 11px 16px 11px 42px;
  color: var(--text); font-size: 0.9rem;
  outline: none; transition: var(--transition);
}
.search-bar input:focus { border-color: var(--primary); }
.search-bar .search-icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted);
}

/* ── Empty State ───────────────────────────── */
.empty-state {
  text-align: center; padding: 48px 24px;
  color: var(--text-muted);
}
.empty-state svg { margin-bottom: 16px; opacity: 0.4; }
.empty-state h3 { font-size: 1rem; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.empty-state p { font-size: 0.82rem; }

/* ── Chip / Tag ────────────────────────────── */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 20px;
  font-size: 0.78rem; font-weight: 500;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); cursor: pointer; transition: var(--transition);
}
.chip.selected { background: var(--primary); border-color: var(--primary); color: white; }

/* ── Prescription Table ────────────────────── */
.rx-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.rx-table th {
  background: var(--primary); color: white;
  padding: 10px 8px; text-align: center; font-weight: 600;
}
.rx-table td { padding: 8px; border: 1px solid var(--border); }
.rx-table input {
  width: 100%; background: transparent; border: none;
  color: var(--text); font-size: 0.85rem; text-align: center;
  outline: none; padding: 4px;
}

/* ── Avatar ────────────────────────────────── */
.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem; font-weight: 700; color: white;
  flex-shrink: 0;
}
.avatar-lg { width: 80px; height: 80px; font-size: 1.8rem; }

/* ── FAB ───────────────────────────────────── */
.fab {
  position: absolute; bottom: calc(var(--bottom-nav-height) + 16px); right: 16px;
  width: 56px; height: 56px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 20px rgba(108,99,255,0.5);
  transition: var(--transition); z-index: 50;
}
.fab:hover { transform: scale(1.1) rotate(90deg); }

/* ── Animations ────────────────────────────── */
@keyframes fadeSlide {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}
.blink { animation: blink 1.5s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.animate-pulse { animation: pulse 2s ease infinite; }
.animate-spin { animation: spin 1s linear infinite; }

/* ── Loader ────────────────────────────────── */
.loader {
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  animation: spin 0.8s linear infinite;
  margin: auto;
}

/* ── Modal ─────────────────────────────────── */
.modal-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 300; display: none;
  align-items: flex-end; justify-content: center;
}
.modal-overlay.open { display: flex; animation: fadeIn 0.2s ease; }
.modal-sheet {
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  padding: 20px;
  width: 100%; max-width: 480px;
  max-height: 90vh; overflow-y: auto;
  animation: slideUp 0.3s ease;
}
.modal-handle {
  width: 40px; height: 4px; background: var(--border);
  border-radius: 2px; margin: 0 auto 16px;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ── Pagination ────────────────────────────── */
.pagination {
  display: flex; justify-content: center; gap: 6px; margin-top: 20px;
}
.page-btn {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--card); border: 1px solid var(--border);
  color: var(--text); text-decoration: none; font-size: 0.85rem;
  transition: var(--transition);
}
.page-btn.active, .page-btn:hover { background: var(--primary); color: white; border-color: var(--primary); }

/* ── Utility ───────────────────────────────── */
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-error { color: var(--error); }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.mt-auto { margin-top: auto; }
.mb-0 { margin-bottom: 0; }
.gap-8 { gap: 8px; }
.flex { display: flex; align-items: center; }
.justify-between { justify-content: space-between; }
.fw-700 { font-weight: 700; }
.w-full { width: 100%; }
.hidden { display: none !important; }

/* ── No bottom nav pages ───────────────────── */
.no-nav .page-content { padding-bottom: 24px; }

/* ── Image preview ─────────────────────────── */
.img-preview {
  width: 80px; height: 80px; object-fit: cover;
  border-radius: var(--radius-sm); border: 2px solid var(--border);
}
.logo-preview {
  width: 64px; height: 64px; object-fit: contain;
  border-radius: var(--radius-sm); background: var(--surface);
  border: 1px solid var(--border);
}
