/**
 * POSPRO Centralized Styling
 * Shopify Polaris Dark-Themed POS & Inventory Suite
 */

:root {
  --bg-app: #0e0f10;
  --bg-surface: #17181a;
  --bg-surface-secondary: #202225;
  --bg-input: #26282b;
  --border-subtle: #2d3035;
  --border-strong: #3e4249;
  
  --text-main: #f1f2f4;
  --text-muted: #9aa0a6;
  --text-faint: #636b75;
  
  --shopify-green: #008060;
  --shopify-green-hover: #006e52;
  --shopify-green-light: rgba(0, 128, 96, 0.15);
  
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --accent-gold: #f59e0b;
  --danger: #ef4444;
  --success: #10b981;
  
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.5);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.6);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

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

/* ----------------------------------------------------
   DEMO WATERMARK OVERLAY
   ---------------------------------------------------- */
.demo-top-banner {
  background: linear-gradient(90deg, #1e293b, #0f172a);
  border-bottom: 1px solid #334155;
  color: #cbd5e1;
  padding: 6px 16px;
  font-size: 11.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  z-index: 1000;
  font-weight: 500;
  letter-spacing: 0.3px;
}

.demo-top-banner .demo-tag {
  background: #f59e0b;
  color: #000;
  font-weight: 700;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 4px;
  text-transform: uppercase;
}

.demo-bg-watermark {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 999;
  opacity: 0.032;
  background-image: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 140px,
    rgba(255, 255, 255, 0.4) 140px,
    rgba(255, 255, 255, 0.4) 142px
  );
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.demo-bg-watermark-text {
  position: fixed;
  bottom: 14px;
  right: 18px;
  background: rgba(23, 24, 26, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 6px 14px;
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 900;
  pointer-events: auto;
  box-shadow: var(--shadow-sm);
}

.demo-bg-watermark-text .pulse-dot {
  width: 7px;
  height: 7px;
  background-color: var(--shopify-green);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(0, 128, 96, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(0, 128, 96, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(0, 128, 96, 0); }
}

/* ----------------------------------------------------
   NAVIGATION BAR
   ---------------------------------------------------- */
.app-header {
  height: 60px;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 500;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-main);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.3px;
}

.shopify-icon-badge {
  background: #004c3f;
  color: #95f1d5;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.app-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.15s ease;
}

.nav-link:hover {
  background-color: var(--bg-surface-secondary);
  color: var(--text-main);
}

.nav-link.active {
  background-color: var(--bg-surface-secondary);
  color: #fff;
  font-weight: 600;
  box-shadow: inset 0 0 0 1px var(--border-strong);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ----------------------------------------------------
   BUTTONS & CONTROLS
   ---------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  text-decoration: none;
  user-select: none;
}

.btn-primary {
  background-color: var(--shopify-green);
  color: #fff;
  border-color: #007054;
}

.btn-primary:hover {
  background-color: var(--shopify-green-hover);
}

.btn-secondary {
  background-color: var(--bg-surface-secondary);
  color: var(--text-main);
  border-color: var(--border-strong);
}

.btn-secondary:hover {
  background-color: #2b2e33;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}

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

.btn-danger {
  background-color: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background-color: rgba(239, 68, 68, 0.25);
  color: #fff;
}

.btn-touch {
  min-height: 48px;
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--radius-md);
}

/* ----------------------------------------------------
   FORM CONTROLS
   ---------------------------------------------------- */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  padding: 9px 12px;
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.15s ease;
  font-family: inherit;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--shopify-green);
  box-shadow: 0 0 0 2px var(--shopify-green-light);
}

.form-input::placeholder, .form-textarea::placeholder {
  color: var(--text-faint);
}

/* Checkbox and toggles */
.custom-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 13px;
  user-select: none;
  color: var(--text-main);
}

.custom-checkbox input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: var(--shopify-green);
  cursor: pointer;
}

/* ----------------------------------------------------
   CARDS & CONTAINERS (SHOPIFY POLARIS STYLE)
   ---------------------------------------------------- */
.polaris-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-title {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-main);
}

/* ----------------------------------------------------
   MODAL DIALOGS
   ---------------------------------------------------- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-container {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px);
  transition: transform 0.2s ease;
}

.modal-overlay.active .modal-container {
  transform: translateY(0);
}

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

.modal-title {
  font-size: 16px;
  font-weight: 600;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
}

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

/* ----------------------------------------------------
   TOAST NOTIFICATIONS
   ---------------------------------------------------- */
#toast-container {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background-color: var(--bg-surface-secondary);
  border: 1px solid var(--border-strong);
  color: var(--text-main);
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-md);
  animation: slideInToast 0.25s ease forwards;
  min-width: 260px;
  max-width: 400px;
}

.toast.success { border-left: 4px solid var(--shopify-green); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.info { border-left: 4px solid var(--primary); }

@keyframes slideInToast {
  from { transform: translateX(-40px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ----------------------------------------------------
   PRINT RECEIPT STYLING
   ---------------------------------------------------- */
@media print {
  body * {
    visibility: hidden;
  }
  
  .print-receipt-area, .print-receipt-area * {
    visibility: visible;
  }
  
  .print-receipt-area {
    position: absolute;
    left: 0;
    top: 0;
    width: 80mm;
    margin: 0;
    padding: 10px;
    background: #fff !important;
    color: #000 !important;
    font-family: 'Courier New', Courier, monospace;
    font-size: 12px;
  }

  .no-print {
    display: none !important;
  }
}
