/* =============================================
   Lazo Dashboard — Custom Styles
   ============================================= */

/* ===== Base ===== */
html {
  scroll-behavior: smooth;
}

body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== Transitions ===== */
.sidebar,
.nav-link,
.kpi-card,
.period-pill,
.chart-container {
  transition: all 0.2s ease;
}

/* Fade-in for dashboard content */
#dashboard-container {
  animation: fadeIn 0.3s ease-out;
}

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

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

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

::-webkit-scrollbar-thumb {
  background: #CBD5E1;
  border-radius: 3px;
}

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

/* Sidebar scrollbar */
.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: #CBD5E1 transparent;
}

.sidebar {
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

/* ===== Chart Containers ===== */
.chart-container {
  position: relative;
  background: #FFFFFF;
  border: 1px solid #F3F4F6;
  border-radius: 0.75rem;
  padding: 1rem;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.03);
}

.chart-container .chart-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: #1E3A5F;
  margin-bottom: 0.75rem;
}

/* Responsive chart heights */
.chart-container [id^="chart-"] {
  width: 100%;
  min-height: 300px;
}

@media (min-width: 768px) {
  .chart-container [id^="chart-"] {
    min-height: 400px;
  }
}

/* ===== Table Styles ===== */
.data-table {
  width: 100%;
  font-size: 0.8125rem;
  border-collapse: separate;
  border-spacing: 0;
}

.data-table thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #F9FAFB;
  padding: 0.625rem 0.75rem;
  font-weight: 600;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6B7280;
  text-align: left;
  border-bottom: 1px solid #E5E7EB;
}

.data-table tbody td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #F3F4F6;
  color: #374151;
  white-space: nowrap;
}

.data-table tbody tr:hover td {
  background: #F9FAFB;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

/* Numeric columns */
.data-table td.num,
.data-table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ===== Period Pill Active State ===== */
.period-pill.active {
  background-color: #1E3A5F;
  color: #FFFFFF;
}

.period-pill:not(.active) {
  color: #4B5563;
}

.period-pill:not(.active):hover {
  background-color: #E5E7EB;
}

/* ===== KPI Cards ===== */
.kpi-card {
  will-change: box-shadow;
}

/* ===== Dashboard Grid Sections ===== */
.dashboard-section {
  margin-bottom: 1.5rem;
}

.dashboard-section:last-child {
  margin-bottom: 0;
}

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

.skeleton {
  background: linear-gradient(90deg, #F3F4F6 25%, #E5E7EB 50%, #F3F4F6 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 0.375rem;
}

/* ===== Tabular Numbers for Data Tables ===== */
.tabular-nums,
table td.text-right,
table th.text-right,
.data-table td.num {
  font-variant-numeric: tabular-nums;
}

/* ===== Store Links ===== */
a.store-link {
  color: #1E3A5F;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.15s, text-decoration 0.15s;
}

a.store-link:hover {
  text-decoration: underline;
  color: #2A4A73;
}

/* ===== Budget Status Dots ===== */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  flex-shrink: 0;
}

.status-dot.status-green { background-color: #10B981; }
.status-dot.status-yellow { background-color: #F59E0B; }
.status-dot.status-red { background-color: #EF4444; }

/* ===== Positive / Negative Values ===== */
.val-positive {
  color: #059669;
}

.val-negative {
  color: #DC2626;
}

/* ===== Sidebar Mobile Toggle ===== */
@media (max-width: 1023px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar:not(.-translate-x-full) {
    transform: translateX(0);
  }
}

/* ===== Print Styles ===== */
@media print {
  .no-print,
  #sidebar,
  #sidebar-overlay,
  #filter-bar,
  header {
    display: none !important;
  }

  body {
    background: white !important;
    color: black !important;
    font-size: 10pt;
  }

  #main-content {
    overflow: visible !important;
  }

  #dashboard-container {
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .kpi-card {
    border: 1px solid #ccc !important;
    box-shadow: none !important;
    break-inside: avoid;
  }

  .chart-container {
    break-inside: avoid;
    box-shadow: none !important;
    border: 1px solid #ccc !important;
    page-break-inside: avoid;
  }

  [id^="chart-"] {
    max-height: 300px !important;
  }

  .data-table {
    font-size: 8pt;
  }

  .data-table thead th {
    background: #f0f0f0 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}
