/* ==========================================================================
   MOVO POS & MULTI-STORE PLATFORM - STYLESHEET
   ========================================================================== */

:root {
  --bg-dark: #0A0A0D;
  --bg-surface: #151519;
  --bg-surface-elevated: #1C1C22;
  --bg-input: #23232B;
  --border-color: #2D2D38;
  --border-accent: rgba(224, 21, 156, 0.3);
  
  --text-main: #FFFFFF;
  --text-muted: #9E9EA9;
  --text-sub: #6C6C7D;

  --accent-magenta: #E0159C;
  --accent-violet: #6C3CF0;
  --accent-gradient: linear-gradient(135deg, #E0159C 0%, #6C3CF0 100%);
  --accent-gradient-hover: linear-gradient(135deg, #F025AC 0%, #7C4CF0 100%);
  --glow-magenta: rgba(224, 21, 156, 0.25);
  --glow-violet: rgba(108, 60, 240, 0.25);

  --status-success-bg: rgba(16, 185, 129, 0.15);
  --status-success-text: #10B981;
  --status-danger-bg: rgba(239, 68, 68, 0.15);
  --status-danger-text: #EF4444;
  --status-warning-bg: rgba(245, 158, 11, 0.15);
  --status-warning-text: #F59E0B;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;

  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

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

/* Utility Helpers */
.hidden { display: none !important; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.between { display: flex; align-items: center; justify-content: space-between; }
.gap-10 { gap: 10px; }
.gap-15 { gap: 15px; }
.gap-20 { gap: 20px; }

/* ==========================================================================
   TOPBAR & HEADER
   ========================================================================== */
.topbar {
  height: 70px;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  user-select: none;
}

.logo-mark {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 1px;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.badge-tag {
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.badge-owner {
  background: rgba(224, 21, 156, 0.15);
  color: var(--accent-magenta);
  border: 1px solid rgba(224, 21, 156, 0.3);
}
.badge-store {
  background: rgba(108, 60, 240, 0.15);
  color: var(--accent-violet);
  border: 1px solid rgba(108, 60, 240, 0.3);
}

.nav-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--bg-dark);
  padding: 5px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 8px;
}

.tab-btn:hover {
  color: var(--text-main);
  background-color: var(--bg-surface-elevated);
}

.tab-btn.active {
  background: var(--accent-gradient);
  color: #fff;
  box-shadow: 0 4px 15px var(--glow-violet);
}

.btn-logout {
  background: rgba(239, 68, 68, 0.1);
  color: #EF4444;
  border: 1px solid rgba(239, 68, 68, 0.2);
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-logout:hover {
  background: #EF4444;
  color: #fff;
}

/* ==========================================================================
   BUTTONS & FORM INPUTS
   ========================================================================== */
.btn-primary {
  background: var(--accent-gradient);
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 15px var(--glow-magenta);
}

.btn-primary:hover {
  background: var(--accent-gradient-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--glow-magenta);
}

.btn-secondary {
  background: var(--bg-surface-elevated);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-secondary:hover {
  background: var(--border-color);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.form-control {
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  outline: none;
  transition: var(--transition-fast);
}

.form-control:focus {
  border-color: var(--accent-violet);
  box-shadow: 0 0 0 3px var(--glow-violet);
}

/* ==========================================================================
   LOGIN GATE SCREEN
   ========================================================================== */
.login-container {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at center, rgba(108, 60, 240, 0.15) 0%, rgba(10, 10, 13, 0.95) 100%);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.login-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-accent);
  width: 100%;
  max-width: 420px;
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.6), 0 0 30px var(--glow-magenta);
  animation: fadeIn 0.3s ease;
}

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

.login-header {
  text-align: center;
  margin-bottom: 24px;
}

.login-header .logo-mark {
  margin: 0 auto 12px;
  width: 48px;
  height: 48px;
}

.login-header h2 {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 6px;
}

.login-header p {
  color: var(--text-muted);
  font-size: 13px;
}

.alert-banner {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #EF4444;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Security Badge Indicator */
.security-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 15px;
  font-size: 11px;
  color: var(--text-sub);
}

/* ==========================================================================
   APP BODY & CARDS
   ========================================================================== */
.app-body {
  flex: 1;
  padding: 24px;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

.card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 20px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.card-title {
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Stat Cards Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: rgba(108, 60, 240, 0.1);
  color: var(--accent-violet);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.stat-info h4 {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.stat-info .stat-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-main);
}

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

.custom-table {
  width: 100%;
  border-collapse: collapse;
  text-align: right;
}

.custom-table th {
  background-color: var(--bg-dark);
  color: var(--text-muted);
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 700;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.custom-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  font-size: 14px;
  color: var(--text-main);
  vertical-align: middle;
}

.custom-table tbody tr:hover {
  background-color: rgba(255,255,255,0.02);
}

.store-thumb {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
}

/* Status Badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
}
.status-active {
  background-color: var(--status-success-bg);
  color: var(--status-success-text);
}
.status-locked {
  background-color: var(--status-danger-bg);
  color: var(--status-danger-text);
}

/* ==========================================================================
   MODALS
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px;
}

.modal-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  width: 100%;
  max-width: 520px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0,0,0,0.5);
  animation: fadeIn 0.2s ease;
}

.modal-header {
  padding: 18px 24px;
  background-color: var(--bg-surface-elevated);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-body {
  padding: 24px;
  max-height: 75vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 16px 24px;
  background-color: var(--bg-surface-elevated);
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
}
.close-btn:hover { color: var(--text-main); }

/* Switch Toggle */
.switch-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-input);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  cursor: pointer;
}

.switch-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-magenta);
  cursor: pointer;
}

/* ==========================================================================
   POS TERMINAL LAYOUT
   ========================================================================== */
.pos-grid {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 20px;
}

@media (max-width: 992px) {
  .pos-grid {
    grid-template-columns: 1fr;
  }
}

.cart-summary-box {
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-top: 16px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  margin-bottom: 8px;
  color: var(--text-muted);
}

.summary-row.total {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-main);
  border-top: 1px dashed var(--border-color);
  padding-top: 10px;
  margin-top: 10px;
}

/* Qty Control Buttons */
.qty-btn {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  font-weight: bold;
  cursor: pointer;
}
.qty-btn:hover { background: var(--border-color); }

/* ==========================================================================
   LOCKED STORE CONTAINER
   ========================================================================== */
.locked-container {
  max-width: 500px;
  margin: 80px auto;
  text-align: center;
  background: var(--bg-surface);
  border: 1px solid var(--status-danger-text);
  padding: 40px 24px;
  border-radius: var(--radius-lg);
  box-shadow: 0 0 30px var(--status-danger-bg);
}
.locked-icon {
  font-size: 56px;
  margin-bottom: 16px;
  display: block;
}

/* ==========================================================================
   PRINT RECEIPT VIEW (@media print)
   ========================================================================== */
#receiptPrintArea {
  display: none;
}

@media print {
  body * {
    visibility: hidden;
  }
  #receiptPrintArea, #receiptPrintArea * {
    visibility: visible;
  }
  #receiptPrintArea {
    display: block !important;
    position: absolute;
    left: 0;
    top: 0;
    width: 80mm;
    padding: 10px;
    background: #fff !important;
    color: #000 !important;
    font-family: monospace, sans-serif;
    font-size: 12px;
  }
  .receipt-header {
    text-align: center;
    border-bottom: 1px dashed #000;
    padding-bottom: 10px;
    margin-bottom: 10px;
  }
  .receipt-logo {
    max-width: 60px;
    max-height: 60px;
    margin: 0 auto 5px;
  }
  .receipt-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 10px;
  }
  .receipt-table th, .receipt-table td {
    text-align: right;
    padding: 4px 0;
  }
  .receipt-divider {
    border-top: 1px dashed #000;
    margin: 8px 0;
  }
  .receipt-total {
    font-size: 14px;
    font-weight: bold;
  }
}
