/* INTEL Custom Web App Styles */

/* Smooth custom scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

/* Hide scrollbar utility for clean mobile scrolling */
.no-scrollbar::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}
.no-scrollbar {
  -ms-overflow-style: none !important;
  scrollbar-width: none !important;
}

::-webkit-scrollbar-track {
  background: #f1f5f9;
}

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

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

/* Monospace logs formatting */
#tally-live-logs::-webkit-scrollbar-track {
  background: #0f172a;
}
#tally-live-logs::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 4px;
}

/* Table row interactive hover */
tbody tr {
  transition: background-color 0.15s ease-in-out;
}
tbody tr:hover {
  background-color: #f8fafc;
}

/* Active navigation tab */
.nav-tab.active {
  color: #0155da !important;
  background-color: #eef4fd !important;
  border-color: #bad4fb !important;
}

/* Custom text selection matching Intel Pro Electric Blue */
::selection {
  background-color: #bad4fb;
  color: #062054;
}

/* Spinner animation */
.spin {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Toast Notifications */
.toast-enter {
  animation: toastSlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.toast-exit {
  animation: toastSlideOut 0.2s ease-in forwards;
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateY(1rem) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toastSlideOut {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(0.5rem) scale(0.95);
  }
}

/* ==================== PINNED APPLICATION SHELL & SIDEBAR ==================== */
/* Prevent double-tap zoom across the entire app */
*, *::before, *::after {
  touch-action: manipulation;
}

html, body {
  height: 100%;
  height: 100dvh;
  margin: 0;
  padding: 0;
  overflow: hidden;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
  -webkit-touch-callout: none;
}

#app-shell {
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  overflow: hidden;
}

#desktop-sidebar {
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  flex-shrink: 0;
  z-index: 30;
  transition: width 0.2s cubic-bezier(0.16, 1, 0.3, 1), padding 0.2s ease-in-out;
}

#main-canvas {
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Pinned Header: Responsive safe area calculation */
#top-app-header {
  padding-top: calc(0.375rem + env(safe-area-inset-top, 0px)) !important;
  padding-bottom: 0.375rem !important;
  min-height: calc(3.25rem + env(safe-area-inset-top, 0px)) !important;
  height: auto !important;
  box-sizing: border-box !important;
  flex-shrink: 0;
  position: relative;
  z-index: 30;
}

/* Tall Modern Notch & Dynamic Island phones (iPhone 14/15/16 Pro, aspect ratio ~19.5:9, height >= 780px) */
@media (max-width: 768px) and (min-height: 780px) {
  #top-app-header {
    padding-top: max(3rem, calc(0.5rem + env(safe-area-inset-top, 0px))) !important;
    min-height: max(5.75rem, calc(3.5rem + env(safe-area-inset-top, 0px))) !important;
  }
}

/* 16:9 Standard Mobile Aspect Ratio Optimization (Portrait: e.g. 360x640, 375x667, 414x736) */
@media (max-width: 768px) and (max-height: 779px) {
  #top-app-header {
    padding-top: max(0.375rem, calc(0.25rem + env(safe-area-inset-top, 0px))) !important;
    padding-bottom: 0.375rem !important;
    min-height: 3.25rem !important;
  }
  
  #main-content-scroll {
    padding-bottom: calc(4.5rem + env(safe-area-inset-bottom, 0px)) !important;
  }
}

/* 16:9 Landscape Mobile Optimization (e.g. 640x360, 667x375, height <= 500px) */
@media (max-height: 500px) and (orientation: landscape) {
  #top-app-header {
    padding-top: 0.25rem !important;
    padding-bottom: 0.25rem !important;
    min-height: 2.75rem !important;
    height: 2.75rem !important;
  }
  
  #mobile-bottom-nav {
    min-height: 2.75rem !important;
    padding-top: 0.125rem !important;
    padding-bottom: 0.125rem !important;
  }

  #main-content-scroll {
    padding-bottom: 3.25rem !important;
    padding-top: 0.75rem !important;
  }
}

/* Desktop View: Clean standard header padding */
@media (min-width: 769px) {
  #top-app-header {
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
    min-height: 4.25rem !important;
    height: 4.25rem !important;
  }
}

#main-content-scroll {
  flex: 1 1 0%;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(6rem + env(safe-area-inset-bottom, 0px));
}

/* Mobile Bottom Navigation Bar with iOS Home Indicator Safe Area */
#mobile-bottom-nav {
  padding-bottom: calc(0.375rem + constant(safe-area-inset-bottom));
  padding-bottom: calc(0.375rem + env(safe-area-inset-bottom, 0px));
  min-height: calc(3.75rem + constant(safe-area-inset-bottom));
  min-height: calc(3.75rem + env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
}

/* Slide-over Mobile Drawer Header Safe Area */
#mobile-drawer-header {
  padding-top: max(1rem, env(safe-area-inset-top, 0px));
}

/* ==================== MOBILE OPTIMIZATION & ZOOM LOCK ==================== */
@media (max-width: 768px) {
  /* Prevent iOS automatic zoom on focus (<16px triggers zoom) */
  input, select, textarea {
    font-size: 16px !important;
  }

  /* Eliminate 300ms tap delay and double-tap zoom */
  button, a, input, select, textarea, .nav-tab {
    touch-action: manipulation;
  }
}

/* ==================== DESKTOP SIDEBAR COLLAPSED STATE ==================== */

#desktop-sidebar.sidebar-collapsed {
  width: 72px !important;
}

#desktop-sidebar.sidebar-collapsed .sidebar-text,
#desktop-sidebar.sidebar-collapsed .sidebar-heading,
#desktop-sidebar.sidebar-collapsed .sidebar-badge {
  display: none !important;
}

#desktop-sidebar.sidebar-collapsed .sidebar-icon-only {
  display: flex !important;
}

#desktop-sidebar.sidebar-collapsed .nav-tab {
  justify-content: center !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

#desktop-sidebar.sidebar-collapsed .nav-tab div {
  gap: 0 !important;
  justify-content: center !important;
}

#desktop-sidebar.sidebar-collapsed #sidebar-user-card {
  padding: 0.5rem !important;
  margin: 0.5rem !important;
  align-items: center !important;
}


