/* ==========================================================================
   MOVO POS & MULTI-STORE PLATFORM - BESPOKE DESIGN SYSTEM
   ========================================================================== */

:root, [data-theme="dark"] {
  --bg-dark: #0A0A0E;
  --bg-surface: #121218;
  --bg-surface-elevated: #1A1A24;
  --bg-input: #0A0A0E;
  --border-color: rgba(255, 255, 255, 0.10);
  --border-accent: rgba(255, 46, 147, 0.3);
  
  --text-main: #F4F4F6;
  --text-muted: #A1A1AA;
  --text-sub: #71717A;

  --accent-pink: #FF2E93;
  --accent-purple: #6C2BFF;
  --accent-gradient: linear-gradient(135deg, #FF2E93 0%, #6C2BFF 100%);
  --accent-gradient-hover: linear-gradient(135deg, #FF1A85 0%, #5B1FE6 100%);
  --glow-pink: rgba(255, 46, 147, 0.25);
  --glow-purple: rgba(108, 43, 255, 0.25);

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

  --card-bg: #121218;
  --table-stripe: rgba(255, 255, 255, 0.02);
  --table-hover: rgba(255, 255, 255, 0.05);

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

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

[data-theme="light"] {
  --bg-dark: #F6F5F0;
  --bg-surface: #FFFFFF;
  --bg-surface-elevated: #F0EFEA;
  --bg-input: #FFFFFF;
  --border-color: rgba(15, 15, 20, 0.12);
  --border-accent: rgba(255, 46, 147, 0.3);
  
  --text-main: #0F0F14;
  --text-muted: #52525B;
  --text-sub: #71717A;

  --accent-pink: #FF2E93;
  --accent-purple: #6C2BFF;
  --accent-gradient: linear-gradient(135deg, #FF2E93 0%, #6C2BFF 100%);
  --accent-gradient-hover: linear-gradient(135deg, #FF1A85 0%, #5B1FE6 100%);
  --glow-pink: rgba(255, 46, 147, 0.15);
  --glow-purple: rgba(108, 43, 255, 0.15);

  --status-success-bg: rgba(16, 185, 129, 0.12);
  --status-success-text: #059669;
  --status-danger-bg: rgba(245, 57, 57, 0.12);
  --status-danger-text: #DC2626;
  --status-warning-bg: rgba(245, 158, 11, 0.12);
  --status-warning-text: #D97706;

  --card-bg: #FFFFFF;
  --table-stripe: rgba(15, 15, 20, 0.02);
  --table-hover: rgba(15, 15, 20, 0.04);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Plus Jakarta Sans', 'Cairo', system-ui, -apple-system, 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;
  direction: rtl;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

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

/* 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-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.cursor-pointer { cursor: pointer; }

/* Text Utilities */
.text-green { color: var(--status-success-text) !important; }
.text-red { color: var(--status-danger-text) !important; }
.text-pink { color: var(--accent-pink) !important; }
.text-purple { color: var(--accent-purple) !important; }

/* ==========================================================================
   HEADER & NAVBAR
   ========================================================================== */
.app-header {
  height: 76px;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

.header-content {
  max-width: 1440px;
  height: 100%;
  margin: 0 auto;
}

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

.logo-box {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-title {
  font-size: 18px;
  font-weight: 900;
  letter-spacing: -0.5px;
  color: var(--text-main);
}

.brand-subtitle {
  font-family: monospace, sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--accent-pink);
  text-transform: uppercase;
}

.theme-toggle-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
}

.theme-toggle-btn:hover {
  border-color: var(--accent-pink);
  transform: scale(1.05);
}

.badge-tag {
  padding: 6px 14px;
  border-radius: var(--radius-md);
  font-family: monospace, sans-serif;
  font-size: 11px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
}
.badge-owner {
  background: rgba(255, 46, 147, 0.12);
  color: var(--accent-pink);
  border: 1px solid rgba(255, 46, 147, 0.25);
}
.badge-store {
  background: rgba(108, 43, 255, 0.12);
  color: var(--accent-purple);
  border: 1px solid rgba(108, 43, 255, 0.25);
}

.logout-btn-header {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(245, 57, 57, 0.1);
  color: var(--status-danger-text);
  border: 1px solid rgba(245, 57, 57, 0.25);
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-fast);
}

.logout-btn-header:hover {
  background: rgba(245, 57, 57, 0.2);
  border-color: var(--status-danger-text);
}

/* Subtle Accent Dots Bar & Hidden Double-Click Password Reset Trigger */
.login-accent-dots-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 6px 4px 6px;
  margin-top: 8px;
}

.login-accent-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--border-color);
  opacity: 0.4;
  transition: opacity 0.2s ease;
  cursor: default;
  user-select: none;
}

.login-accent-dot:hover {
  opacity: 0.6;
}

.login-accent-dot.functional-dot {
  cursor: pointer;
}

.nav-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  background-color: var(--bg-surface-elevated);
  padding: 4px;
  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: 13px;
  font-weight: 700;
  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);
}

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

.user-menu-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-fast);
}

.user-menu-btn:hover {
  border-color: var(--accent-pink);
}

.user-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 8px;
  width: 240px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  padding: 8px;
  z-index: 200;
}

.user-dropdown-header {
  padding: 8px 12px;
}
.dropdown-user-title { font-size: 12px; font-weight: 800; color: var(--text-main); }
.dropdown-user-email { font-size: 10px; color: var(--text-muted); font-family: monospace; }
.user-dropdown-divider { height: 1px; background: var(--border-color); margin: 6px 0; }

.user-dropdown-item {
  width: 100%;
  text-align: right;
  background: transparent;
  border: none;
  color: var(--text-main);
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 700;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
}
.user-dropdown-item:hover {
  background: var(--bg-surface-elevated);
}

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

/* Login Screen */
.login-container {
  min-height: calc(100vh - 76px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
  position: relative;
  overflow: hidden;
}

.login-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: var(--accent-gradient);
}

.login-header {
  text-align: center;
  margin-bottom: 24px;
}
.login-header h2 { font-size: 24px; font-weight: 900; color: var(--text-main); }
.login-header p { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* Forms & Inputs */
.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
}

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

.form-control:focus {
  border-color: var(--accent-pink);
  box-shadow: 0 0 0 3px rgba(255, 46, 147, 0.15);
}

/* Buttons */
.btn-primary {
  background: var(--accent-gradient);
  color: #ffffff;
  border: none;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 15px var(--glow-pink);
}

.btn-primary:hover {
  background: var(--accent-gradient-hover);
  transform: translateY(-1px);
}

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

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

/* KPI Grid & Cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  position: relative;
  overflow: hidden;
  transition: var(--transition-normal);
}

.kpi-card:hover {
  border-color: var(--accent-pink);
  transform: translateY(-2px);
}

.kpi-title { font-size: 12px; font-weight: 800; color: var(--text-muted); }
.kpi-value { font-size: 28px; font-weight: 900; color: var(--text-main); margin-top: 8px; block; }
.kpi-icon-box {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}
.icon-purple { background: rgba(108, 43, 255, 0.12); }
.icon-green { background: rgba(16, 185, 129, 0.12); }
.icon-red { background: rgba(245, 57, 57, 0.12); }
.icon-pink { background: rgba(255, 46, 147, 0.12); }

/* Tables */
.table-container {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

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

.data-table th {
  background: var(--bg-surface-elevated);
  color: var(--accent-pink);
  font-family: monospace, sans-serif;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
}

.data-table td {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}

.data-table tbody tr:hover {
  background-color: var(--table-hover);
}

/* POS Terminal Layout */
.pos-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 24px;
  height: calc(100vh - 124px);
}

@media (max-width: 1024px) {
  .pos-layout {
    grid-template-columns: 1fr;
    height: auto;
  }
}

.pos-products {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  overflow-y: auto;
  padding-bottom: 16px;
}

.product-card {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.product-card:hover {
  border-color: var(--accent-pink);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(255, 46, 147, 0.15);
}

.product-code-tag {
  font-family: monospace, sans-serif;
  font-size: 10px;
  font-weight: 800;
  color: var(--accent-pink);
  background: rgba(255, 46, 147, 0.1);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  display: inline-block;
}

.product-name {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.3;
}

.product-price {
  font-size: 18px;
  font-weight: 900;
  color: var(--accent-pink);
}

.product-stock-badge {
  font-size: 11px;
  font-weight: 700;
}

.pos-cart {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  padding: 20px;
}

.modal-card {
  width: 100%;
  max-width: 520px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

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

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

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

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

/* Alert Banner */
.alert-banner {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 16px;
  background: var(--status-danger-bg);
  color: var(--status-danger-text);
  border: 1px solid var(--status-danger-text);
}

/* Security Badge */
.security-badge {
  font-family: monospace, sans-serif;
  font-size: 10px;
  text-align: center;
  color: var(--text-muted);
  margin-top: 20px;
}

/* Print Areas Hidden in Screen View */
#receiptPrintArea, #barcodePrintArea {
  display: none !important;
}

/* Sticker Thermal Barcode Print Mode */
@media print {
  body.printing-label-mode {
    background: #ffffff !important;
    color: #000000 !important;
  }

  body.printing-label-mode * {
    visibility: hidden !important;
  }

  body.printing-label-mode #barcodePrintArea,
  body.printing-label-mode #barcodePrintArea * {
    visibility: visible !important;
  }

  body.printing-label-mode #barcodePrintArea {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 40mm !important;
    height: 30mm !important;
    margin: 0 !important;
    padding: 2mm !important;
    box-sizing: border-box !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    background: #ffffff !important;
  }

  @page {
    size: 40mm 30mm;
    margin: 0;
  }
}
