/* ==========================================================================
   CSS Design System & Global Styles (Gaya Premium Perpustakaan)
   ========================================================================== */
:root {
  /* Font Family */
  --font-title: 'Outfit', 'Inter', sans-serif;
  --font-body: 'Inter', sans-serif;

  /* Theme Tokens - Dark Mode Premium */
  --bg-primary: #0b0f19;      /* Deep midnight blue */
  --bg-secondary: #111827;    /* Slate-900 */
  --bg-card: rgba(30, 41, 59, 0.7); /* Transparan glass */
  --bg-card-hover: rgba(51, 65, 85, 0.85);
  --border-color: rgba(51, 65, 85, 0.5);
  
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #64748b;
  
  --primary: #6366f1;         /* Indigo Neon */
  --primary-hover: #4f46e5;
  --primary-light: rgba(99, 102, 241, 0.15);
  --primary-light-hover: rgba(99, 102, 241, 0.3);
  
  --secondary: #a78bfa;       /* Purple Neon */
  --secondary-light: rgba(167, 139, 250, 0.15);
  
  --accent-rose: #f43f5e;     /* Rose Neon */
  --accent-rose-light: rgba(244, 63, 94, 0.15);

  --color-success: #10b981;
  --color-info: #0ea5e9;
  --color-warning: #f59e0b;
  
  /* Shadows & Glows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.4);
  --shadow-premium: 0 20px 25px -5px rgba(99, 102, 241, 0.25), 0 10px 10px -5px rgba(99, 102, 241, 0.1);
  --glow-primary: 0 0 15px rgba(99, 102, 241, 0.6);
  --glow-rose: 0 0 15px rgba(244, 63, 94, 0.6);
  
  /* Radii */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   CSS Resets & Base Styles
   ========================================================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-title);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #ffffff;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  outline: none;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  transition: all var(--transition-fast);
}

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

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* Utility Classes */
.hidden { display: none !important; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-success { color: var(--color-success) !important; }
.text-info { color: var(--color-info) !important; }
.text-warning { color: var(--color-warning) !important; }
.highlight { font-weight: 700; color: #ffffff !important; }

/* ==========================================================================
   UI Components (Buttons, Spinnners, Toasts, Install Banner)
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-md);
  gap: 8px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
}
.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--glow-primary);
}

.btn-secondary {
  background: var(--primary-light);
  color: var(--secondary);
  border: 1px solid var(--border-color);
}
.btn-secondary:hover {
  background: var(--primary-light-hover);
  color: #ffffff;
}

.btn-block {
  display: flex;
  width: 100%;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

.btn-text {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
}
.btn-text:hover {
  color: #ffffff;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--border-color);
  color: var(--text-secondary);
}
.btn-icon:hover {
  background: var(--bg-card-hover);
  color: #ffffff;
  transform: scale(1.05);
}

/* Spinner loading */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11, 15, 25, 0.8);
  backdrop-filter: blur(12px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid var(--border-color);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Toast Notifications */
.toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  align-items: center;
  padding: 14px 28px;
  background: var(--bg-secondary);
  border: 1px solid var(--primary);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg), var(--glow-primary);
  font-size: 14px;
  font-weight: 500;
  color: #ffffff;
  max-width: 90%;
  animation: slideDown 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
  transition: opacity 0.3s ease;
}
@keyframes slideDown {
  from { top: -50px; opacity: 0; }
  to { top: 24px; opacity: 1; }
}

/* PWA Install Banner */
.install-banner {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9990;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: rgba(30, 41, 59, 0.9);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-premium);
  width: 90%;
  max-width: 500px;
  gap: 16px;
  animation: slideUp 0.4s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}
@keyframes slideUp {
  from { bottom: -100px; opacity: 0; }
  to { bottom: 24px; opacity: 1; }
}
.banner-content {
  display: flex;
  align-items: center;
  gap: 12px;
}
.banner-logo {
  width: 44px;
  height: 44px;
  border-radius: 50%;
}
.banner-content h4 {
  font-size: 14px;
  margin-bottom: 2px;
}
.banner-content p {
  font-size: 12px;
  color: var(--text-secondary);
}
.banner-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ==========================================================================
   Login Form Layout
   ========================================================================== */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.15) 0%, transparent 40%),
              radial-gradient(circle at 90% 80%, rgba(167, 139, 250, 0.12) 0%, transparent 45%),
              var(--bg-primary);
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 40px 32px;
  animation: fadeIn 0.5s ease-out;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}
.login-header {
  text-align: center;
  margin-bottom: 32px;
}
.logo-box {
  display: inline-flex;
  padding: 12px;
  background: var(--primary-light);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}
.login-logo {
  width: 48px;
  height: 48px;
  border-radius: 50%;
}
.login-header h2 {
  font-size: 24px;
  margin-bottom: 8px;
}
.login-header p {
  font-size: 14px;
  color: var(--text-secondary);
}

.form-group {
  margin-bottom: 24px;
}
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.form-group input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: #ffffff;
  font-size: 14px;
  transition: all var(--transition-fast);
}
.form-group input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light);
}

.login-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 12px;
  color: var(--text-muted);
}
.login-footer strong {
  color: var(--secondary);
}

/* ==========================================================================
   Dashboard Wrapper Layout
   ========================================================================== */
.dashboard-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 16px;
  gap: 20px;
}

/* Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.header-logo {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}
.header-brand h1 {
  font-size: 18px;
  line-height: 1.2;
}
.status-badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 700;
  background: rgba(16, 185, 129, 0.15);
  color: var(--color-success);
  border-radius: var(--radius-full);
}
.status-badge.offline {
  background: rgba(239, 68, 68, 0.15);
  color: var(--color-absen);
}

.header-profile {
  display: flex;
  align-items: center;
  gap: 16px;
}
.user-info {
  text-align: right;
}
.user-info p {
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
}
.user-info span {
  font-size: 11px;
  color: var(--text-muted);
}

/* App Main Content */
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Metrics Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}
.metric-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast);
}
.metric-card:hover {
  transform: translateY(-2px);
  border-color: rgba(99, 102, 241, 0.3);
}
.card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  color: #ffffff;
}
.gradient-blue {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  box-shadow: 0 4px 10px rgba(59, 130, 246, 0.3);
}
.gradient-purple {
  background: linear-gradient(135deg, #a78bfa, #6d28d9);
  box-shadow: 0 4px 10px rgba(109, 40, 217, 0.3);
}
.gradient-rose {
  background: linear-gradient(135deg, #f43f5e, #be123c);
  box-shadow: 0 4px 10px rgba(244, 63, 94, 0.3);
}
.card-body span {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}
.card-body h3 {
  font-size: 22px;
  font-weight: 700;
  margin-top: 2px;
}

/* ==========================================================================
   Navigation Tabs (Fixed Bottom Mobile-First Navigation)
   ========================================================================== */
.tab-navigation {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  background: rgba(17, 24, 39, 0.92);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-bottom: none;
  padding: 8px 12px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  gap: 8px;
  z-index: 999;
  width: 100%;
  max-width: 600px;
  box-shadow: var(--shadow-premium);
}
.tab-button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  background: none;
}
.tab-button svg {
  margin-bottom: 2px;
  opacity: 0.8;
  transition: opacity var(--transition-fast);
}
.tab-button:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.03);
}
.tab-button:hover svg {
  opacity: 1;
}
.tab-button.active {
  background: var(--primary-light);
  color: var(--secondary);
  font-weight: 600;
  border: 1px solid rgba(167, 139, 250, 0.25);
}
.tab-button.active svg {
  color: var(--secondary);
  opacity: 1;
}

/* ==========================================================================
   Top Filter Bar
   ========================================================================== */
.top-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  padding: 16px 24px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
.filter-group {
  display: flex;
  align-items: center;
  gap: 12px;
}
.filter-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}
.filter-group select {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  color: #ffffff;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.filter-group select:focus {
  border-color: var(--primary);
  box-shadow: var(--glow-primary);
}

/* Tab Panel Styles */
.tab-panel {
  display: none;
  animation: fadeInPanel 0.35s ease-out;
}
.tab-panel.active {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
@keyframes fadeInPanel {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.panel-header h3 {
  font-size: 16px;
  font-weight: 600;
}

/* ==========================================================================
   SVG Charts Styles
   ========================================================================== */
.chart-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
}
.chart-header {
  display: flex;
  justify-content: flex-end;
  gap: 16px;
  margin-bottom: 16px;
}
.chart-legend {
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.dot.sales { background-color: #3b82f6; }
.dot.service { background-color: #a78bfa; }
.dot.total { background-color: #f43f5e; }

#chart-svg-wrapper {
  width: 100%;
  overflow-x: auto;
  padding-bottom: 10px;
}
#omset-svg-chart {
  display: block;
}

/* SVG Chart Elements styling */
.chart-grid-line {
  stroke: var(--border-color);
  stroke-width: 1;
  stroke-dasharray: 4,4;
}
.chart-axis-line {
  stroke: var(--border-color);
  stroke-width: 1;
}
.chart-axis-text {
  fill: var(--text-muted);
  font-size: 11px;
}
.chart-line {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke-width var(--transition-fast);
}
.chart-line.sales {
  stroke: #3b82f6;
}
.chart-line.service {
  stroke: #a78bfa;
}
.chart-line.total {
  stroke: #f43f5e;
}
.chart-area {
  opacity: 0.05;
}
.chart-point {
  stroke-width: 3;
  cursor: pointer;
  transition: r var(--transition-fast), stroke-width var(--transition-fast);
}
.chart-point:hover {
  r: 7;
  stroke-width: 4;
}
.chart-point.sales { fill: #0b0f19; stroke: #3b82f6; }
.chart-point.service { fill: #0b0f19; stroke: #a78bfa; }
.chart-point.total { fill: #0b0f19; stroke: #f43f5e; }

.chart-tooltip-bg {
  fill: #111827;
  stroke: var(--border-color);
  stroke-width: 1;
  rx: 8;
  ry: 8;
}
.chart-tooltip-text {
  font-size: 11px;
  fill: #ffffff;
  font-weight: 500;
}

/* ==========================================================================
   Tabel Styles
   ========================================================================== */
.table-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.table-responsive {
  width: 100%;
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}
th, td {
  padding: 14px 20px;
  font-size: 14px;
  border-bottom: 1px solid var(--border-color);
}
th {
  background: rgba(255, 255, 255, 0.02);
  font-weight: 600;
  color: var(--text-secondary);
}
tr:last-child td {
  border-bottom: none;
}
tr:hover td {
  background: rgba(255, 255, 255, 0.01);
}

/* ==========================================================================
   Service Grid & Card Items
   ========================================================================== */
.search-bar-box {
  width: 100%;
}
.search-bar-box input {
  width: 100%;
  padding: 14px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: #ffffff;
  font-size: 14px;
  transition: all var(--transition-fast);
}
.search-bar-box input:focus {
  border-color: var(--primary);
  box-shadow: var(--glow-primary);
}

.service-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.service-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}
.service-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
}
.service-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.service-card-header h4 {
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
}
.service-card-header span {
  font-size: 11px;
  color: var(--text-muted);
}
.service-card-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}
.body-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.body-row.total-row {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--border-color);
  font-weight: 700;
  color: #ffffff;
}

.no-data {
  text-align: center;
  padding: 40px;
  font-size: 14px;
  color: var(--text-muted);
  width: 100%;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.app-footer {
  text-align: center;
  padding: 20px;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 20px;
  border-top: 1px solid var(--border-color);
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */
@media (max-width: 768px) {
  .dashboard-wrapper {
    padding: 8px;
    gap: 16px;
  }
  .app-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    padding: 14px;
  }
  .header-profile {
    align-self: stretch;
    justify-content: space-between;
  }
  .user-info {
    text-align: left;
  }
  .tab-navigation {
    border-radius: var(--radius-sm);
  }
  .tab-button {
    font-size: 12px;
    padding: 8px;
  }
  th, td {
    padding: 10px 14px;
    font-size: 12px;
  }
}

/* Mini Dashboard Grid & Cards */
.mini-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}
.mini-card {
  padding: 14px 18px !important;
  border-radius: var(--radius-md) !important;
  border: 1px dashed rgba(255, 255, 255, 0.08) !important;
}
.mini-card .card-body span {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.mini-card .card-body h4 {
  font-size: 16px;
  font-weight: 700;
  margin-top: 4px;
  color: #ffffff;
}

/* Section Dividers */
.section-title-box {
  margin-top: 24px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.section-title-box h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Color Utilities */
.text-success {
  color: #10b981 !important;
}
.text-warning {
  color: #f59e0b !important;
}
.text-info {
  color: #0ea5e9 !important;
}
.text-danger {
  color: #ef4444 !important;
}
