/* RESET & BASE STYLES */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  touch-action: manipulation;
}

body {
  background-color: #0f172a;
  color: #f8fafc;
  min-height: 100vh;
  padding: 12px;
  overflow-x: hidden;
}

.app-container {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}

/* TAB CONTENT DISPLAY CONTROL */
.tab-content {
  display: none;
  width: 100%;
  box-sizing: border-box;
}
.tab-content.active {
  display: block;
}

/* AUTH CONTAINER */
#auth-container {
  max-width: 380px;
  width: 100%;
  margin: 40px auto;
  background: rgba(30, 41, 59, 0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 24px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 20px 40px rgba(0,0,0,0.4);
  box-sizing: border-box;
}

#auth-container h2 {
  border-bottom: 2px solid #10b981;
  color: #f8fafc;
  margin-top: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding-bottom: 10px;
  font-size: 18px;
  margin-bottom: 16px;
}

/* FORMS & INPUTS */
.form-group {
  margin-bottom: 12px;
  width: 100%;
}

.form-group.checkbox-group {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  margin-top: 6px;
}

.form-group.checkbox-group input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-width: 18px;
  accent-color: #10b981;
  cursor: pointer;
  margin: 0;
}

.form-group.checkbox-group label {
  margin-bottom: 0;
  cursor: pointer;
  font-size: 12px;
  color: #cbd5e1;
  user-select: none;
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 12px;
  color: #cbd5e1;
}

input, select {
  width: 100%;
  padding: 10px 12px;
  background: #0f172a;
  color: #f8fafc;
  border: 1px solid #334155;
  border-radius: 8px;
  box-sizing: border-box;
  font-family: inherit;
  font-size: 13px;
  transition: all 0.2s;
}

input:focus, select:focus {
  outline: none;
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

/* BUTTONS */
button, .btn-primary {
  background: #10b981;
  color: white;
  border: none;
  padding: 10px 14px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  width: 100%;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

button:hover, .btn-primary:hover {
  background: #059669;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

button:disabled {
  background: #334155 !important;
  color: #64748b !important;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.btn-secondary {
  background: transparent;
  color: #10b981;
  margin-top: 8px;
  border: 1px solid #334155;
}

.btn-secondary:hover {
  background: rgba(16, 185, 129, 0.1);
}

.btn-danger {
  background: #ef4444;
  color: white;
}
.btn-danger:hover {
  background: #dc2626;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-warning {
  background: #f59e0b;
  color: white;
}
.btn-warning:hover {
  background: #d97706;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

/* DRAWER OVERLAY & SIDEBAR MENU */
.drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 998;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: all 0.3s ease;
}

.drawer-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.menu-drawer {
  position: fixed;
  top: 0;
  left: -280px;
  width: 280px;
  height: 100vh;
  background: #1e293b;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 999;
  padding: 20px;
  box-shadow: 8px 0 24px rgba(0, 0, 0, 0.5);
  transition: left 0.3s ease;
  display: flex;
  flex-direction: column;
}

.menu-drawer.active {
  left: 0;
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.drawer-title {
  font-size: 15px;
  font-weight: 700;
  color: #f8fafc;
}

.btn-close-drawer {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
  width: auto;
}

.drawer-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  color: #94a3b8;
  text-decoration: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.nav-item:hover, .nav-item.active {
  background: #10b981;
  color: #ffffff;
}

/* TOP HEADER */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  color: #ffffff;
  padding: 8px 12px;
  border-radius: 12px;
  margin-bottom: 16px;
  box-shadow: 0 6px 16px rgba(5, 150, 105, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.1);
  min-height: 48px;
  width: 100%;
  box-sizing: border-box;
}

.header-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-group {
  display: flex;
  flex-direction: column;
  justify-content: center;
  line-height: 1.1;
}

.brand-title {
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.5px;
  color: #ffffff;
}

.user-badge-sub {
  font-size: 10px;
  color: #a7f3d0;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 1px;
}

#current-role {
  color: #fde047;
  font-weight: bold;
}

.btn-hamburger {
  width: 34px !important;
  height: 34px !important;
  padding: 0 !important;
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.btn-logout-icon {
  width: auto !important;
  padding: 5px 10px !important;
  background: #ef4444;
  color: #ffffff;
  border: none;
  font-size: 11px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-logout-icon svg {
  width: 14px;
  height: 14px;
}

/* MAIN CONTENT & CARDS */
.main-content {
  width: 100%;
  box-sizing: border-box;
}

.section-header {
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 2px solid #10b981;
}

.section-header h2 {
  font-size: 15px;
  font-weight: 700;
  color: #f8fafc;
  display: flex;
  align-items: center;
  gap: 6px;
}

.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
  width: 100%;
}

.stat-card {
  background: rgba(30, 41, 59, 0.7);
  backdrop-filter: blur(12px);
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-left: 4px solid #10b981;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
  box-sizing: border-box;
}

.stat-card h3 {
  margin: 0 0 4px 0;
  font-size: 12px;
  color: #94a3b8;
  font-weight: 500;
}

.stat-card .value {
  font-size: 18px;
  font-weight: 800;
  color: #f8fafc;
}

.card-section {
  background: rgba(30, 41, 59, 0.7);
  backdrop-filter: blur(12px);
  padding: 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
  margin-bottom: 16px;
  width: 100%;
  box-sizing: border-box;
}

.card-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 12px;
  color: #f1f5f9;
  display: flex;
  align-items: center;
  gap: 6px;
}

.sub-title {
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}
.sub-title.success { color: #10b981; }
.sub-title.danger { color: #ef4444; }

/* TABLES */
.table-container {
  overflow-x: auto;
  border: 1px solid #334155;
  border-radius: 8px;
  background: #0f172a;
  width: 100%;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 12px;
}

.data-table th {
  background: #1e293b;
  color: #94a3b8;
  padding: 10px 12px;
  font-size: 11px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: #e2e8f0;
}

.text-center { text-align: center; color: #64748b; }

/* POS GRID & PRODUCT CARDS */
.grid-pos, .grid-form {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 16px;
  width: 100%;
  box-sizing: border-box;
}

.grid-pos > *, .grid-form > * {
  min-width: 0;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
  max-height: 420px;
  overflow-y: auto;
  padding-right: 4px;
}

.product-card {
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 8px;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s ease;
  user-select: none;
}

.product-card:hover {
  border-color: #10b981;
  transform: translateY(-2px);
  box-shadow: 0 6px 12px -3px rgba(16, 185, 129, 0.25);
  background: #1e293b;
}

.product-img {
  width: 100%;
  height: 70px;
  object-fit: cover;
  border-radius: 6px;
  background: #1e293b;
}

.product-title {
  font-size: 11px;
  font-weight: 600;
  margin: 4px 0 2px 0;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-price { color: #10b981; font-weight: 700; font-size: 11px; }
.product-stock { font-size: 10px; color: #94a3b8; margin-top: 1px; }

/* POS CART & PAYMENT PANEL */
.btn-qty {
  background: #334155;
  color: #f8fafc;
  border: none;
  padding: 3px 6px;
  border-radius: 4px;
  cursor: pointer;
  width: auto;
  font-size: 11px;
  font-weight: bold;
}

.qty-input {
  width: 48px;
  text-align: center;
  padding: 3px;
  border: 1px solid #334155;
  border-radius: 6px;
  font-weight: bold;
  background: #0f172a;
  color: #f8fafc;
}

.alert-danger {
  background-color: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 10px;
  border-radius: 8px;
  font-size: 12px;
  margin-top: 10px;
  font-weight: 600;
}

.total-box {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  padding: 12px;
  border-radius: 8px;
  margin-top: 12px;
  text-align: right;
}

.total-label { font-size: 11px; color: #94a3b8; }
.total-amount { font-size: 20px; font-weight: 800; color: #10b981; }

.metode-group { display: flex; gap: 8px; margin-top: 4px; }
.btn-metode {
  flex: 1;
  padding: 8px;
  border: 1px solid #334155;
  background: #0f172a;
  color: #94a3b8;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
}
.btn-metode.active { border-color: #10b981; background: rgba(16, 185, 129, 0.15); color: #10b981; }

.panel-cash {
  background: #0f172a;
  border: 1px solid #334155;
  padding: 10px;
  border-radius: 8px;
  margin-top: 8px;
}
.cash-label { font-size: 10px; text-transform: uppercase; color: #94a3b8; font-weight: bold; margin-bottom: 6px; }
.cash-options-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 8px; }

.btn-cash-option {
  padding: 6px 4px;
  border: 1px solid #334155;
  background: #0f172a;
  color: #cbd5e1;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  font-size: 11px;
}
.btn-cash-option:hover { background: #1e293b; color: #f8fafc; }
.btn-uang-pas { background: #10b981; color: white; border: none; }

.cash-calc-box { border-top: 1px solid #334155; padding-top: 8px; }
.cash-row { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: #cbd5e1; }
.input-bayar { font-weight: bold; font-size: 14px; text-align: right; }
.btn-text-danger { background: transparent; border: none; color: #ef4444; text-decoration: underline; font-size: 10px; cursor: pointer; width: auto; padding: 0; }
.kembalian-row { font-weight: bold; font-size: 13px; border-top: 1px dashed #334155; padding-top: 6px; margin-top: 6px; }

@media (max-width: 768px) {
  body { padding: 8px; }
  .grid-pos, .grid-form { grid-template-columns: 1fr; }
}