/* Custom styles for the Flask UI */
:root {
  --logo-primary: #c09030;
  --logo-primary-light: #e0b050;
  --logo-primary-dark: #a07020;
  --logo-accent: #f0c060;
  --logo-dark: #403020;
  --logo-light: #fff8eb;
}

html, body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  scroll-behavior: smooth;
}

::selection {
  background-color: rgba(192, 144, 48, 0.25);
  color: inherit;
}

*:focus-visible {
  outline: 2px solid var(--logo-primary);
  outline-offset: 2px;
}

.logo-gradient {
  background: linear-gradient(90deg, var(--logo-primary) 0%, var(--logo-primary-light) 100%);
}

.logo-text {
  color: var(--logo-primary);
}

.logo-bg {
  background-color: var(--logo-primary);
}

.logo-border {
  border-color: var(--logo-primary);
}

.fade-in {
  animation: fadeIn 0.4s ease-out both;
}

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

/* Hide scrollbar for clean sidebar but keep functionality */
.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Mobile bottom navigation */
.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 0.5rem;
  color: #64748b;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.mobile-nav-item.active,
.mobile-nav-item:active {
  color: #c09030;
}
.mobile-nav-item i {
  font-size: 1.25rem;
}

.safe-area-bottom {
  padding-bottom: env(safe-area-inset-bottom);
}

/* Mobile "More" sheet grid items */
.mobile-sheet-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 0.75rem 0.25rem;
  border-radius: 0.75rem;
  color: #475569;
  background-color: #f8fafc;
  text-align: center;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.mobile-sheet-item:active,
.mobile-sheet-item.active,
.mobile-sheet-item.text-sky-600 {
  color: #c09030;
  background-color: #fff8eb;
}

/* Increase touch target size on mobile */
.mobile button,
.mobile a,
.mobile input,
.mobile select,
.mobile textarea {
  min-height: 44px;
}
.mobile nav a,
.mobile .mobile-nav-item {
  min-height: 48px;
}

/* Prevent elastic scrolling / overscroll on mobile web app */
html.mobile,
html.mobile body {
  overscroll-behavior: none;
}

/* Modern, visually rich UI enhancements */

/* Smooth page-wide typography */
body {
  font-feature-settings: "tnum";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* KPI cards with subtle glow and lift */
.kpi-card {
  background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid rgba(226, 232, 240, 0.8);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 12px rgba(15, 23, 42, 0.04);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.kpi-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08), 0 2px 6px rgba(192, 144, 48, 0.08);
}

.kpi-card .icon-wrap {
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.kpi-card:hover .icon-wrap {
  transform: scale(1.1) rotate(-3deg);
}

/* Chart cards */
.chart-card {
  background: #ffffff;
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 1.25rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.04);
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.chart-card:hover {
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.1), 0 4px 8px rgba(15, 23, 42, 0.04);
  transform: translateY(-2px);
}

.chart-container {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 14rem;
}

/* Header gradient text */
.gradient-text {
  background: linear-gradient(90deg, var(--logo-primary-dark) 0%, var(--logo-primary) 50%, var(--logo-accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Section/page headers */
.page-header {
  background: linear-gradient(135deg, #ffffff 0%, #fff8eb 100%);
  border: 1px solid rgba(226, 232, 240, 0.8);
  border-radius: 1.25rem;
  padding: 1.5rem;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.03);
}

/* Glass buttons */
.btn-glass {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* Tables */
.datatable {
  border-radius: 0.75rem;
  overflow: hidden;
}

.datatable thead {
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
}

.datatable tbody tr {
  transition: background-color 0.15s ease;
}

.datatable tbody tr:hover {
  background-color: rgba(14, 165, 233, 0.04);
}

/* Custom scrollbar for tables/chart panels on webkit */
.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.4);
  border-radius: 3px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: rgba(100, 116, 139, 0.6);
}

/* Shimmer loading placeholder */
.shimmer {
  position: relative;
  overflow: hidden;
  background: #f1f5f9;
}

.shimmer::after {
  content: '';
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
  animation: shimmer 1.6s infinite;
}

@keyframes shimmer {
  100% { transform: translateX(100%); }
}

/* Subtle entrance animation for page content */
.animate-rise {
  animation: riseIn 0.5s ease-out both;
}

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

/* Chart tooltip polish is handled by Chart.js global config in charts.js */

/* Sidebar active link glow */
.sidebar-link.active {
  background: linear-gradient(90deg, rgba(192, 144, 48, 0.15) 0%, transparent 100%);
  border-right: 3px solid var(--logo-primary);
  box-shadow: inset 4px 0 12px rgba(192, 144, 48, 0.08);
}

/* Mobile bottom nav active glow */
.mobile-nav-item.active {
  color: var(--logo-primary);
  text-shadow: 0 0 12px rgba(192, 144, 48, 0.25);
}
