@import "tailwindcss";

@theme {
  --color-primary: #003830;
  --color-primary-hover: #004840;
  --color-accent: #F08028;
  --color-background: #F7F9F8;
  --color-surface: #FFFFFF;
  --color-text: #202B29;
  --color-text-muted: #687773;
  --color-border: #E5EBE8;
  --color-success: #267653;
  --color-danger: #C63D3D;
  --color-warning: #D97706;
  --radius-card: 12px;
  --radius-button: 8px;
  --shadow-card: 0 2px 8px rgba(0, 56, 48, 0.05);
}

:root {
  --color-primary: #003830;
  --color-primary-hover: #004840;
  --color-accent: #F08028;
  --color-background: #F7F9F8;
  --color-surface: #FFFFFF;
  --color-text: #202B29;
  --color-text-muted: #687773;
  --color-border: #E5EBE8;
  --color-success: #267653;
  --color-danger: #C63D3D;
  --color-warning: #D97706;
}

/* Global viewport lock to prevent body scrolling and layout drops */
html, body {
  margin: 0;
  padding: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background-color: var(--color-background);
  color: var(--color-text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  color: var(--color-text);
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Micro-interactions & Transitions */
button, a, input, select, textarea {
  transition: all 0.2s ease-in-out;
}

/* Toast Notifications */
.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  box-shadow: 0 10px 15px -3px rgba(0, 56, 48, 0.08);
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text);
  pointer-events: auto;
  animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  max-width: 380px;
}

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

@keyframes toastSlideIn {
  from { opacity: 0; transform: translateX(100%) scale(0.95); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes toastFadeOut {
  from { opacity: 1; transform: translateX(0) scale(1); }
  to { opacity: 0; transform: translateX(100%) scale(0.95); }
}

.toast.hiding {
  animation: toastFadeOut 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Modals */
#modal-container:not(.hidden) {
  display: flex;
  animation: fadeIn 0.2s ease-out forwards;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Print Support */
@media print {
  body * { visibility: hidden; }
  #printable-receipt, #printable-receipt * { visibility: visible; }
  #printable-receipt {
    position: absolute; left: 0; top: 0; width: 100%; margin: 0; padding: 0; box-shadow: none; border: none;
  }
}

/* Ensure POS product scroll area adapts to mobile and desktop screens */
#pos-products-grid {
  min-height: 250px;
  max-height: calc(100vh - 350px);
}
@media (min-width: 1024px) {
  #pos-products-grid {
    max-height: none;
  }
}

/* ==================== PRINT STYLING & RECEIPT FIX ==================== */
@media print {
  /* Hide all app navigation, sidebars, headers, and views */
  body * {
    visibility: hidden !important;
  }

  /* Make only the printable receipt container visible and active */
  #printable-receipt, #printable-receipt * {
    visibility: visible !important;
  }

  #printable-receipt {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    max-width: 80mm !important; /* Standard thermal printer paper width */
    margin: 0 auto !important;
    padding: 10px !important;
    background: #ffffff !important;
    color: #000000 !important;
    box-shadow: none !important;
    border: none !important;
    font-family: 'Courier New', Courier, monospace !important;
  }

  /* Force background graphics to print correctly */
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
}

/* ==================== RESSTERA AI ECOSYSTEM STYLES ==================== */
.ai-typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.ai-typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 9999px;
  background-color: #003830;
  animation: aiBounce 1.2s infinite ease-in-out both;
}

.ai-typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.ai-typing-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes aiBounce {
  0%, 80%, 100% { transform: scale(0.4); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

.ai-msg-bubble {
  animation: aiFadeUp 0.2s ease-out forwards;
}

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