@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

/* =========================================================
   ATLAS DESIGN SYSTEM & TOKENS - PREMIUM B2B FLEET INTELLIGENCE
   ========================================================= */

:root {
  --font-sans: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Brand Palette - Minimalist Monochromatic (Pure Black & Titanium Slate) */
  --brand-50: #f8fafc;
  --brand-100: #f1f5f9;
  --brand-200: #e2e8f0;
  --brand-300: #cbd5e1;
  --brand-400: #94a3b8;
  --brand-500: #0f172a; /* Pure Black / Obsidian Primary */
  --brand-600: #020617;
  --brand-700: #000000;
  --brand-800: #090d16;
  --brand-900: #05070c;
  --brand-surface: rgba(255, 255, 255, 0.05);
  --brand-border: rgba(255, 255, 255, 0.15);
  --brand-glow: 0 0 24px rgba(255, 255, 255, 0.08);

  /* Status Colors */
  --status-pending: #94a3b8;
  --status-pending-bg: rgba(148, 163, 184, 0.12);
  --status-pending-border: rgba(148, 163, 184, 0.28);

  --status-processing: #64748b;
  --status-processing-bg: rgba(100, 116, 139, 0.12);
  --status-processing-border: rgba(100, 116, 139, 0.28);

  --status-invoiced: #334155;
  --status-invoiced-bg: rgba(51, 65, 85, 0.12);
  --status-invoiced-border: rgba(51, 65, 85, 0.28);

  --status-transit: #475569;
  --status-transit-bg: rgba(71, 85, 105, 0.12);
  --status-transit-border: rgba(71, 85, 105, 0.28);

  --status-delivered: #1e293b;
  --status-delivered-bg: rgba(30, 41, 59, 0.12);
  --status-delivered-border: rgba(30, 41, 59, 0.28);

  --status-loss: #fb7185;
  --status-loss-bg: rgba(251, 113, 133, 0.1);
  --status-loss-border: rgba(251, 113, 133, 0.25);
}

/* Light Theme Variables */
html:not(.dark) {
  --bg-app: #f8fafc;
  --bg-card: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-input: #ffffff;
  --border-subtle: #e2e8f0;
  --border-card: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-soft: #94a3b8;
  --card-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.04), 0 4px 12px -2px rgba(0, 0, 0, 0.03);
  --modal-bg: rgba(15, 23, 42, 0.6);
}

/* Dark Theme Variables (Deep Obsidian & Graphite) */
html.dark {
  --bg-app: #070a0f;
  --bg-card: #0e1420;
  --bg-subtle: #161f30;
  --bg-input: #0a0e17;
  --border-subtle: #1e293b;
  --border-card: #1e293b;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-soft: #64748b;
  --card-shadow: 0 4px 24px -2px rgba(0, 0, 0, 0.6);
  --modal-bg: rgba(3, 7, 18, 0.75);
}

/* Base Scaling & Typography */
html {
  font-size: 15.5px;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.55;
  letter-spacing: -0.012em;
}

.font-mono {
  font-family: var(--font-mono);
}

/* =========================================================
   ATLAS PREMIUM COMPONENT UTILITIES
   ========================================================= */

.atlas-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 1rem;
  box-shadow: var(--card-shadow);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.atlas-card:hover {
  border-color: rgba(255, 255, 255, 0.25);
}

.atlas-input {
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 0.75rem;
  font-size: 0.875rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.atlas-input:focus {
  outline: none;
  border-color: #38bdf8;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
}

/* =========================================================
   INTERACTIVE CALENDAR & ACTIVITY ENGINE
   ========================================================= */
.cal-day-cell {
  min-height: 84px;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
}

.cal-day-cell:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.25);
  box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.2);
}

.cal-day-cell.is-selected {
  border-color: #f59e0b !important;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.5) !important;
  background-color: rgba(245, 158, 11, 0.06);
}

.cal-day-cell.is-today {
  background-color: rgba(16, 185, 129, 0.04);
  border-color: rgba(16, 185, 129, 0.4);
}

.cal-day-cell.is-other-month {
  opacity: 0.35;
}

/* =========================================================
   CUSTOM SCROLLBARS
   ========================================================= */
.custom-scrollbar::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

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

.custom-scrollbar::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.25);
  border-radius: 999px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.45);
}

/* =========================================================
   INTERACTIONS, BUTTONS & KANBAN
   ========================================================= */
.btn-press {
  transition: transform 0.12s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
  will-change: transform;
}

.btn-press:active {
  transform: scale(0.97);
}

.kanban-col {
  min-height: 140px;
  border-radius: 0.75rem;
}

.kanban-card {
  transition: transform 0.16s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.16s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.15s ease;
  padding: 0.85rem;
  border-radius: 0.75rem;
}

.kanban-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 0 8px 20px -3px rgba(0, 0, 0, 0.45);
}

.kanban-card.dragging {
  opacity: 0.25;
  transform: scale(0.97);
}

.kanban-col.drag-over {
  background-color: var(--brand-surface);
  border-color: var(--brand-border);
}

/* =========================================================
   STATUS BADGES & INDICATORS
   ========================================================= */
.badge-pending {
  background-color: var(--status-pending-bg);
  color: var(--status-pending);
  border: 1px solid var(--status-pending-border);
}

.badge-processing {
  background-color: var(--status-processing-bg);
  color: var(--status-processing);
  border: 1px solid var(--status-processing-border);
}

.badge-invoiced {
  background-color: var(--status-invoiced-bg);
  color: var(--status-invoiced);
  border: 1px solid var(--status-invoiced-border);
}

.badge-transit {
  background-color: var(--status-transit-bg);
  color: var(--status-transit);
  border: 1px solid var(--status-transit-border);
}

.badge-delivered {
  background-color: var(--status-delivered-bg);
  color: var(--status-delivered);
  border: 1px solid var(--status-delivered-border);
}

.badge-loss {
  background-color: var(--status-loss-bg);
  color: var(--status-loss);
  border: 1px solid var(--status-loss-border);
}

/* =========================================================
   MODALS & OVERLAYS
   ========================================================= */
.modal-overlay {
  background-color: var(--modal-bg);
  backdrop-filter: blur(6px);
  transition: opacity 0.2s ease;
}

.modal-card {
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
}

/* Skeleton Loading Shimmer */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton-shimmer {
  background: linear-gradient(90deg, rgba(148, 163, 184, 0.08) 25%, rgba(148, 163, 184, 0.18) 50%, rgba(148, 163, 184, 0.08) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

/* Accordion Smooth Rotation & Interactive Pulse */
#historyCallsChevron,
#historyEmailsChevron,
#copilotObjectionChevron,
#copilotRoiChevron {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}

.rotate-180 {
  transform: rotate(180deg) !important;
}

/* =========================================================
   PRINT STYLES FOR FISCAL DANFE
   ========================================================= */
@media print {
  body * {
    visibility: hidden;
  }
  #danfePrintArea, #danfePrintArea * {
    visibility: visible;
  }
  #danfePrintArea {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
  }
}

html.dark .badge-processing {
  color: #94a3b8;
  background-color: rgba(148, 163, 184, 0.12);
  border-color: rgba(148, 163, 184, 0.25);
}
html.dark .badge-invoiced {
  color: #f1f5f9;
  background-color: rgba(241, 245, 249, 0.1);
  border-color: rgba(241, 245, 249, 0.2);
}
html.dark .badge-transit {
  color: #cbd5e1;
  background-color: rgba(203, 213, 225, 0.1);
  border-color: rgba(203, 213, 225, 0.2);
}
html.dark .badge-delivered {
  color: #f8fafc;
  background-color: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
}

/* =========================================================
   MOBILE RESPONSIVENESS & TOUCH OPTIMIZATIONS (360px - 768px)
   ========================================================= */

/* Smooth horizontal touch scroll with non-intrusive scrollbar */
.mobile-scroll-x {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  overscroll-behavior-x: contain;
}

.mobile-scroll-x::-webkit-scrollbar {
  height: 4px;
}

.mobile-scroll-x::-webkit-scrollbar-track {
  background: transparent;
}

.mobile-scroll-x::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.25);
  border-radius: 999px;
}

/* Modal responsive container */
.modal-responsive {
  max-height: 90vh;
  max-height: 90dvh;
  overflow-y: auto;
  margin: auto;
  width: 100%;
}

@media (max-width: 640px) {
  /* Dynamic scale on small screens */
  html {
    font-size: 14px;
  }

  .modal-card {
    padding: 1.1rem !important;
    border-radius: 1.25rem !important;
    max-height: 92vh !important;
    max-height: 92dvh !important;
    margin: 0.5rem !important;
  }

  /* Safe tap target size */
  .btn-press {
    min-height: 38px;
  }

  .nav-tab {
    min-height: 38px;
    padding-left: 0.85rem !important;
    padding-right: 0.85rem !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
  }

  /* Calendar cells scaled for mobile viewports */
  .cal-day-cell {
    min-height: 58px;
    padding: 0.35rem !important;
    border-radius: 0.6rem !important;
  }

  .cal-day-cell span {
    font-size: 0.75rem;
  }

  .cal-day-cell .inline-flex {
    font-size: 8px !important;
    padding: 1px 3px !important;
    gap: 2px !important;
  }
}

/* =========================================================
   BRAND OLHO DE GATO THEME & COLOR STANDARDIZATION
   ========================================================= */
.text-brand-amber {
  color: #f59e0b;
}

.bg-brand-amber {
  background-color: #f59e0b;
  color: #0f172a;
}

.border-brand-amber {
  border-color: #f59e0b;
}

.badge-brand-amber {
  background-color: rgba(245, 158, 11, 0.15);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

html.dark .badge-brand-amber {
  color: #fbbf24;
  background-color: rgba(245, 158, 11, 0.2);
  border-color: rgba(245, 158, 11, 0.35);
}

/* High contrast active navigation tab in Light Mode */
html:not(.dark) .nav-tab.bg-slate-900 {
  background-color: #0f172a !important;
  color: #ffffff !important;
  box-shadow: 0 2px 8px -1px rgba(15, 23, 42, 0.25) !important;
}

/* High contrast active navigation tab in Dark Mode */
html.dark .nav-tab.dark\:bg-white {
  background-color: #ffffff !important;
  color: #090d16 !important;
  box-shadow: 0 2px 10px -1px rgba(255, 255, 255, 0.15) !important;
}
