@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;700&display=swap');

:root {
  --bg-app: #f4f6fa;
  --bg-glass: rgba(255, 255, 255, 0.65);
  --bg-glass-heavy: rgba(255, 255, 255, 0.85);
  
  --text-main: #0B132B;
  --text-soft: #4a5568;
  --text-muted: #a0aec0;
  
  --border-glass: rgba(255, 255, 255, 0.8);
  --border-light: rgba(200, 210, 230, 0.3);
  
  --accent-1: #e06c75; /* Ultra Smooth Pastel Red */
  --accent-2: #f29886; /* Warm Soft Peach */
  --accent-3: #2c313c; /* Soft Deep Navy */
  
  --gradient-neon: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  --gradient-glow: linear-gradient(135deg, rgba(224, 108, 117, 0.1), rgba(242, 152, 134, 0.1));
  
  --shadow-float: 0 20px 40px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0,0,0,0.02), inset 0 1px 0 rgba(255,255,255,0.9);
  --shadow-neon: 0 8px 30px rgba(224, 108, 117, 0.1);
  
  --radius-xl: 28px;
  --radius-lg: 16px;
  --radius-md: 10px;
}

* {
  margin: 0; padding: 0; box-sizing: border-box;
  font-family: 'Outfit', sans-serif;
  scroll-behavior: smooth;
}

/* =======================================================================
   ANIMATED MESH BACKGROUND (THE MAGIC)
   ======================================================================= */
body {
  background-color: var(--bg-app);
  color: var(--text-main);
  position: relative;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Breathtaking animated glowing orbs behind everything */
body::before, body::after, .app-layout::before {
  content: ''; position: fixed; border-radius: 50%; filter: blur(140px); z-index: -1; opacity: 0.06;
  animation: floatOrb 25s infinite alternate ease-in-out;
}
body::before { top: -10%; left: -10%; width: 50vw; height: 50vw; background: var(--accent-1); }
body::after { bottom: -10%; right: -10%; width: 60vw; height: 60vw; background: var(--accent-3); animation-delay: -5s; }
.app-layout::before { top: 40%; left: 30%; width: 40vw; height: 40vw; background: var(--accent-2); animation-delay: -10s; }

@keyframes floatOrb {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(5%, 10%) scale(1.1); }
  100% { transform: translate(-5%, -5%) scale(0.9); }
}

.app-layout {
  display: flex; min-height: 100vh; overflow: hidden;
}

/* =======================================================================
   SIDEBAR (GLASSMORPHIC)
   ======================================================================= */
.sidebar {
  width: 250px;
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(30px) saturate(150%);
  -webkit-backdrop-filter: blur(30px) saturate(150%);
  border-right: 1px solid var(--border-glass);
  display: flex; flex-direction: column;
  z-index: 100;
}

.sidebar-header {
  height: 88px; display: flex; align-items: center; padding: 0 32px;
  border-bottom: 1px solid rgba(255,255,255,0.3);
}

.logo { display: flex; align-items: center; gap: 12px; font-size: 20px; font-weight: 800; letter-spacing: -0.5px; }
.logo-mark {
  background: var(--gradient-neon); color: white; width: 32px; height: 32px;
  border-radius: 10px; display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-neon); font-size: 16px; font-weight: 800;
}
.logo-bold { color: var(--text-main); }
.logo-accent { background: var(--gradient-neon); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }

.nav-links {
  padding: 32px 24px; display: flex; flex-direction: column; gap: 6px; overflow-y: auto;
}
.nav-group {
  margin: 16px 0 8px 12px; font-size: 11px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 2px; color: var(--text-muted);
}
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  border-radius: 14px; color: var(--text-soft); font-weight: 700; font-size: 14px;
  text-decoration: none; transition: 0.3s cubic-bezier(0.16,1,0.3,1);
  position: relative; overflow: hidden;
}
.nav-item svg { width: 18px; height: 18px; opacity: 0.5; transition: 0.3s; }
.nav-item:hover { color: var(--accent-1); background: rgba(255,255,255,0.6); transform: translateX(4px); }
.nav-item:hover svg { opacity: 1; transform: scale(1.1); }
.nav-item.active { background: white; color: var(--accent-1); box-shadow: 0 4px 12px rgba(0,0,0,0.03); }
.nav-item.active svg { opacity: 1; color: var(--accent-1); }
.nav-item.active::before {
  content: ''; position: absolute; left: 0; top: 10px; bottom: 10px; width: 4px;
  background: var(--gradient-neon); border-radius: 0 4px 4px 0;
}

/* =======================================================================
   MAIN WRAPPER & TOPBAR
   ======================================================================= */
.main-wrapper { flex: 1; display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

.topbar {
  height: 88px; display: flex; justify-content: space-between; align-items: center;
  padding: 0 48px; z-index: 90;
  border-bottom: 1px solid rgba(255,255,255,0.4);
}

.search-wrap { position: relative; }
.search-icon { position: absolute; left: 20px; top: 16px; width: 18px; height: 18px; color: var(--text-muted); }
.search-input {
  padding: 14px 20px 14px 48px; border-radius: 100px; background: rgba(255,255,255,0.6);
  border: 1px solid white; font-size: 14px; font-weight: 600;
  width: 400px; box-shadow: inset 0 2px 4px rgba(0,0,0,0.02); transition: 0.3s; color: var(--text-main);
}
.search-input:focus { outline: none; background: white; border-color: rgba(79,70,229,0.3); box-shadow: 0 4px 20px rgba(79,70,229,0.1); width: 450px; }
.search-input::placeholder { color: var(--text-muted); font-weight: 500;}

@keyframes apiPulse {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); transform: scale(0.95); }
  70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); transform: scale(1); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); transform: scale(0.95); }
}

/* Dropdown Menu Component */
.dropdown-wrapper { position: relative; }
.dropdown-menu {
  position: absolute; top: calc(100% + 12px); right: 0; min-width: 220px;
  background: white; border-radius: 16px; padding: 8px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.08), inset 0 2px 4px rgba(255,255,255,0.8);
  border: 1px solid var(--border-glass);
  opacity: 0; visibility: hidden; transform: translateY(-10px);
  transition: all 0.3s cubic-bezier(0.16,1,0.3,1); z-index: 1000;
}
.dropdown-menu.show { opacity: 1; visibility: visible; transform: translateY(0); }
.dropdown-header { font-size: 11px; font-weight: 800; text-transform: uppercase; color: var(--text-muted); padding: 8px 12px; letter-spacing: 1px; }
.dropdown-item {
  display: flex; align-items: center; gap: 12px; padding: 12px;
  border-radius: 10px; color: var(--text-main); font-size: 14px; font-weight: 600;
  text-decoration: none; transition: 0.2s; cursor: pointer;
}
.dropdown-item:hover { background: var(--bg-app); color: var(--accent-1); }
.di-icon { font-size: 16px; opacity: 0.8; }

.header-info { display: flex; align-items: center; gap: 24px; }
#serverTime {
  font-family: 'JetBrains Mono', monospace; font-size: 13px; font-weight: 700;
  color: var(--accent-1); background: rgba(255,255,255,0.6); border: 1px solid white;
  padding: 8px 16px; border-radius: 100px;
}
.user-pill {
  display: flex; align-items: center; gap: 12px; background: white;
  padding: 6px 20px 6px 6px; border-radius: 100px; font-weight: 700; font-size: 13px; color: var(--text-main);
  border: 1px solid var(--border-glass); box-shadow: 0 4px 12px rgba(0,0,0,0.03);
  cursor: pointer; transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.user-pill:hover { transform: translateY(-2px); box-shadow: 0 10px 20px rgba(0,0,0,0.05); }
.user-pill img { width: 36px; height: 36px; border-radius: 50%; }

/* =======================================================================
   PAGES
   ======================================================================= */
.pages-container { flex: 1; padding: 15px; overflow-y: auto; scroll-behavior: smooth; }
.page { display: none; animation: pageReveal 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards; opacity: 0; transform: translateY(30px); max-width: 1500px; margin: 0 auto; width: 100%; padding-bottom: 64px; }
.page.active { display: block; }
@keyframes pageReveal { to { opacity: 1; transform: translateY(0); } }

.page-header { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 48px; }
.page-title { font-size: 42px; font-weight: 800; letter-spacing: -2px; color: var(--text-main); line-height: 1; }
.page-subtitle { margin-top: 12px; font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.5px; color: var(--accent-1); background: rgba(79, 70, 229, 0.08); padding: 8px 20px; border-radius: 100px; display: inline-flex; }

/* Buttons */
.btn {
  padding: 14px 28px; border-radius: var(--radius-lg); font-weight: 700; font-size: 15px; cursor: pointer; border: none; transition: 0.4s cubic-bezier(0.16,1,0.3,1); position: relative; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; z-index: 1;
}
.btn-primary { background: var(--text-main); color: white; box-shadow: 0 10px 20px rgba(11,19,43,0.15); }
.btn-primary::before { content: ''; position: absolute; inset: 0; background: var(--gradient-neon); opacity: 0; transition: 0.4s; z-index: -1; border-radius: var(--radius-lg); }
.btn-primary:hover::before { opacity: 1; }
.btn-primary:hover { box-shadow: var(--shadow-neon); transform: translateY(-2px) scale(1.02); }

.btn-outline { background: var(--bg-glass-heavy); box-shadow: 0 2px 8px rgba(0,0,0,0.02); color: var(--text-main); border: 2px solid white; }
.btn-outline:hover { background: white; transform: translateY(-2px); color: var(--accent-1); }

/* =======================================================================
   CARDS (THE GLASS ENGINE)
   ======================================================================= */
.card, .kpi-card {
  background: var(--bg-glass);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid white;
  border-radius: var(--radius-xl);
  padding: 36px;
  box-shadow: var(--shadow-float);
  transition: 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}
.card:hover, .kpi-card:hover { transform: translateY(-4px); box-shadow: 0 30px 60px rgba(0,0,0,0.06), inset 0 1px 0 rgba(255,255,255,0.9); background: var(--bg-glass-heavy); }

.card h3 { font-size: 18px; font-weight: 800; color: var(--text-main); margin-bottom: 32px; display: flex; align-items: center; gap: 12px; }
.card h3::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--gradient-neon); box-shadow: 0 0 12px var(--accent-1); }

.kpi-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; margin-bottom: 40px; }
.kpi-card { display: flex; align-items: center; gap: 24px; padding: 32px 40px; }
.kpi-icon { width: 72px; height: 72px; border-radius: 20px; display: flex; justify-content: center; align-items: center; font-size: 32px; background: white; box-shadow: 0 12px 24px rgba(0,0,0,0.05); }
.kpi-label { color: var(--text-soft); font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: 2px; margin-bottom: 8px; }
.kpi-value { font-size: 40px; font-weight: 800; font-family: 'JetBrains Mono', monospace; color: var(--text-main); letter-spacing: -1.5px; line-height: 1; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }

/* =======================================================================
   TABLES (FUTURISTIC ROWS)
   ======================================================================= */
.table-wrap { overflow-x: auto; border-radius: var(--radius-xl); padding: 8px; }
.data-table { width: 100%; border-collapse: separate; border-spacing: 0 12px; }
.data-table th { padding: 0 24px 12px; font-size: 12px; font-weight: 800; text-transform: uppercase; color: var(--text-muted); letter-spacing: 1.5px; text-align: left; }
.data-table td { padding: 24px; background: var(--bg-glass-heavy); transition: 0.3s cubic-bezier(0.16,1,0.3,1); font-size: 15px; font-weight: 600; color: var(--text-main); }
.data-table td:first-child { border-top-left-radius: 16px; border-bottom-left-radius: 16px; border-left: 1px solid var(--border-glass); }
.data-table td:last-child { border-top-right-radius: 16px; border-bottom-right-radius: 16px; border-right: 1px solid var(--border-glass); }
.data-table td { border-top: 1px solid var(--border-glass); border-bottom: 1px solid var(--border-glass); }

.data-table tbody tr { transition: 0.3s; box-shadow: 0 4px 12px rgba(0,0,0,0.02); cursor: pointer; }
.data-table tbody tr:hover td { background: white; transform: scale(1.005); }
.data-table tbody tr:hover { box-shadow: 0 20px 40px rgba(0,0,0,0.06); }

.cell-multi { display: flex; flex-direction: column; gap: 8px; }
.cell-multi strong { font-weight: 800; font-size: 16px; }
.cell-secondary { font-family: 'JetBrains Mono', monospace; font-size: 13px; color: var(--text-muted); font-weight: 700; }
code { background: rgba(79, 70, 229, 0.05); padding: 8px 12px; border-radius: 8px; font-family: 'JetBrains Mono', monospace; font-size: 13px; color: var(--accent-1); font-weight: 600; }

.badge { padding: 8px 20px; border-radius: 100px; font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; display: inline-flex; align-items: center; justify-content: center; }
.badge-active { background: rgba(16, 185, 129, 0.1); color: #059669; }
.badge-pending { background: rgba(244, 63, 94, 0.1); color: #e11d48; }

.action-btn { background: white; border: 1px solid var(--border-glass); width: 44px; height: 44px; border-radius: 14px; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: 0.3s; box-shadow: 0 4px 10px rgba(0,0,0,0.03); font-size: 18px; }
.action-btn:hover { background: var(--text-main); color: white; transform: translateY(-4px); box-shadow: 0 12px 24px rgba(11,19,43,0.15); border-color: transparent; }

/* Toggles */
.tgl-switch { appearance: none; width: 52px; height: 28px; background: rgba(148, 163, 184, 0.3); border-radius: 20px; position: relative; cursor: pointer; outline: none; transition: 0.4s cubic-bezier(0.4, 0, 0.2, 1); border: 2px solid white; box-shadow: inset 0 2px 8px rgba(0,0,0,0.1); }
.tgl-switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; background: white; border-radius: 50%; box-shadow: 0 4px 8px rgba(0,0,0,0.15); transition: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.tgl-switch:checked { background: var(--accent-1); }
.tgl-switch:checked::after { left: 26px; }

/* =======================================================================
   FORM NEUMORPHISM (POINT OF SALE)
   ======================================================================= */
.pos-form { padding: 48px; border: none; }
.pos-section { margin-bottom: 24px; padding: 40px; background: rgba(255,255,255,0.4); border-radius: var(--radius-xl); border: 1px solid white; }
.pos-section h4 { font-size: 16px; font-weight: 800; text-transform: uppercase; letter-spacing: 2px; color: var(--accent-1); margin-bottom: 32px; display: flex; align-items: center; gap: 16px; }
.pos-section h4::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, var(--accent-1), transparent); opacity: 0.3; }

.floating-input { position: relative; display: flex; flex-direction: column; gap: 12px; }
.floating-input label { font-size: 13px; font-weight: 800; color: var(--text-main); margin-left: 12px; text-transform: uppercase; letter-spacing: 1px; }
.floating-input input, .floating-input select {
  width: 100%; padding: 20px 24px; background: white; border: none;
  border-radius: var(--radius-lg); color: var(--text-main); font-size: 16px; font-weight: 600;
  box-shadow: 0 4px 12px rgba(0,0,0,0.03), inset 0 0 0 2px transparent; transition: 0.3s;
}
.floating-input input::placeholder { color: var(--text-muted); font-weight: 400; }
.floating-input input:focus, .floating-input select:focus {
  outline: none; box-shadow: var(--shadow-neon), inset 0 0 0 2px var(--accent-1); transform: translateY(-2px);
}

/* =======================================================================
   ANIMATED DROPZONES
   ======================================================================= */
.dropzone {
  border: 2px dashed rgba(6, 182, 212, 0.4); border-radius: var(--radius-xl); padding: 80px 40px; text-align: center;
  background: rgba(255,255,255,0.6); cursor: pointer; transition: 0.4s; position: relative; overflow: hidden;
}
.dropzone::before {
  content: ''; position: absolute; inset: 0; background: var(--gradient-glow); opacity: 0; transition: 0.4s;
}
.dropzone:hover { transform: scale(1.02); border-color: transparent; }
.dropzone:hover::before { opacity: 1; }
.dropzone > * { position: relative; z-index: 2; color: var(--accent-1); font-weight: 800; font-size: 18px; }

/* Tabs */
.tabs { display: flex; gap: 48px; border-bottom: none; margin-bottom: 48px; position: relative; }
.tabs::after { content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 2px; background: rgba(0,0,0,0.05); border-radius: 2px; }
.tab-item {
  padding: 16px 0; font-size: 16px; font-weight: 800; color: var(--text-muted); cursor: pointer;
  position: relative; transition: 0.3s; text-transform: uppercase; letter-spacing: 1px;
}
.tab-item:hover { color: var(--text-main); }
.tab-item.active { color: var(--accent-1); }
.tab-item.active::after {
  content: ''; position: absolute; bottom: -2px; left: 0; width: 100%; height: 4px; z-index: 2;
  background: var(--gradient-neon); border-radius: 4px; box-shadow: 0 0 12px var(--accent-1);
}

/* Responsive Grid (Analytics/General) */
.grid-responsive {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
}

/* KPI Responsive Grid (Sales) */
.kpi-grid-responsive {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

/* Responsive Filter Bar */
.filter-bar-responsive {
  display: flex !important;
  gap: 16px;
  background: rgba(255,255,255,0.4);
  padding: 16px 24px;
  border-radius: 20px;
  border: 1px solid white;
  box-shadow: var(--shadow-float);
  align-items: center;
  transition: 0.3s;
}

.hide-on-mobile {
  display: table-cell;
}

/* =======================================================================
   RESPONSIVENESS (MOBILE-FIRST ADAPTATION)
   ======================================================================= */

/* Mobile Menu Toggle (Hidden on Desktop) */
.mobile-toggle {
  display: none; width: 44px; height: 44px; border-radius: 12px;
  background: white; border: 1px solid var(--border-glass);
  align-items: center; justify-content: center; cursor: pointer;
  box-shadow: var(--shadow-float); color: var(--text-main);
  transition: 0.3s; margin-right: 16px;
}

@media (max-width: 1100px) {
  .sidebar {
    position: fixed; left: -280px; top: 0; bottom: 0;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 20px 0 80px rgba(11, 19, 43, 0.15);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(40px) saturate(200%);
    -webkit-backdrop-filter: blur(40px) saturate(200%);
    border-right: 1px solid rgba(255, 255, 255, 0.5);
  }
  body.sidebar-open .sidebar { transform: translateX(280px); }
  
  .mobile-toggle { display: flex; }
  .topbar { padding: 0 24px; }
  .pages-container { padding: 32px 24px; }
  
  .search-input { width: 180px; } /* Slimmer search to ensure status fits in one line */
  .search-input:focus { width: 220px; }

  .kpi-grid, .kpi-grid-responsive { grid-template-columns: 1fr 1fr; }
  .grid-2, .grid-responsive { grid-template-columns: 1fr; }
}

@media (max-width: 850px) {
  .header-info { gap: 12px; flex-wrap: nowrap; }
  .header-info #serverTime, 
  .header-info .api-status { display: flex !important; transform-origin: right; font-size: 11px; padding: 6px 12px; white-space: nowrap; flex-shrink: 0; }
  
  #serverTime { max-width: 200px; }
  .search-wrap { display: none; }
  
  .page-header { flex-direction: column; align-items: flex-start; gap: 24px; }
  .page-title { font-size: 32px; }
  
  .filter-bar-responsive { flex-direction: column; align-items: stretch; padding: 24px; gap: 20px; }
  .filter-bar-responsive button { width: 100%; }
}

@media (max-width: 550px) {
  .header-info #serverTime, 
  .header-info .api-status { display: none !important; }
  .hide-on-mobile { display: none !important; }
}

@media (max-width: 480px) {
  .topbar { padding: 0 16px; height: 72px; }
  .sidebar-header { height: 72px; }
  .pages-container { padding: 24px 16px; }
  
  .card, .kpi-card { padding: 24px; }
  .kpi-value { font-size: 32px; }
  .kpi-grid-responsive { grid-template-columns: 1fr; }

  .user-pill span { display: none; }
  .user-pill { padding: 6px; }
  
  /* Horizontal scroll for small tables */
  .table-wrap { padding: 4px; margin: 0 -4px; border-radius: 16px; }
  .data-table td, .data-table th { padding: 16px; font-size: 13px; }
  
  .btn { width: 100%; }
  .page-header .btn { width: auto; align-self: stretch; }
  
  .dropdown-menu { right: -50px; width: calc(100vw - 32px); max-width: 280px; }
}

/* Sidebar Overlay for Mobile */
.sidebar-overlay {
  position: fixed; inset: 0; background: rgba(11, 19, 43, 0.4);
  backdrop-filter: blur(4px); z-index: 95; opacity: 0; visibility: hidden;
  transition: 0.3s;
}
body.sidebar-open .sidebar-overlay { opacity: 1; visibility: visible; }

