/* Custom properties for scrollbars and themes */
:root {
  --scrollbar-thumb: #cbd5e1;
  --scrollbar-track: #f8fafc;
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  color-scheme: light dark;
}

.dark {
  --scrollbar-thumb: #334155;
  --scrollbar-track: #0f172a;
}

body {
  font-family: var(--font-sans);
}

/* Disable all number input spin-buttons (up/down arrows) across the entire application */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none !important;
  margin: 0 !important;
}

input[type="number"] {
  -moz-appearance: textfield !important;
  appearance: textfield !important;
}

/* Precise vertical text alignment and styling */
.font-mono {
  font-family: var(--font-mono);
}

/* Custom Scrollbars applied globally to overflow containers */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}

::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 3px;
}

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

.dark ::webkit-scrollbar-thumb:hover {
  background: #475569;
}

/* For modern browsers supporting standard scrollbar control */
@supports (scrollbar-color: auto) {
  * {
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
    scrollbar-width: thin;
  }
}

/* SVG Shape Visualizer styling */
.shape-svg {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.shape-svg path,
.shape-svg line,
.shape-svg polygon {
  transition: stroke 0.25s ease, stroke-width 0.25s ease, fill 0.25s ease, filter 0.25s ease;
}

/* Dimension group formatting */
.group-dim {
  transition: opacity 0.25s ease;
}

.group-dim line,
.group-dim path {
  stroke-width: 1.5px;
}

.group-dim text {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  transition: fill 0.2s ease, font-weight 0.2s ease;
}

/* Active Highlight Class when form fields are focused */
.dim-highlight line,
.dim-highlight path {
  stroke: #FF6600 !important; /* Industrial Orange */
  stroke-width: 2.5px !important;
  filter: drop-shadow(0 2px 4px rgba(255, 102, 0, 0.4));
}

.dark .dim-highlight line,
.dark .dim-highlight path {
  stroke: #FF6600 !important; /* Industrial Orange */
  filter: drop-shadow(0 0 6px rgba(255, 102, 0, 0.6));
}

.dim-highlight text {
  fill: #FF6600 !important;
  font-weight: 800 !important;
}

.dark .dim-highlight text {
  fill: #FF6600 !important;
  font-weight: 800 !important;
}

/* Shape visual select grid button animations */
.shape-btn {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.shape-btn:hover {
  transform: translateY(-2px);
}

.shape-btn-active {
  border-color: #FF6600 !important;
  background-color: #FF6600 !important;
  color: #ffffff !important;
  box-shadow: 0 4px 10px -1px rgba(255, 102, 0, 0.35), 0 2px 4px -1px rgba(255, 102, 0, 0.2);
}

.shape-btn-active span,
.shape-btn-active svg,
.shape-btn-active i {
  color: #ffffff !important;
  stroke: #ffffff !important;
}

.dark .shape-btn-active {
  border-color: #FF6600 !important;
  background-color: #FF6600 !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(255, 102, 0, 0.35);
}

/* Auth overlay transition backdrop */
#auth-overlay {
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* Spreadsheet-style table inputs for clean corporate layout */
input.table-input {
  background-color: transparent;
  border: 1px solid transparent;
  padding: 0.25rem 0.5rem;
  font-weight: 600;
  font-size: 0.75rem;
  border-radius: 0.375rem;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
}

input.table-input:hover {
  background-color: #f1f5f9;
  border-color: #cbd5e1;
}

.dark input.table-input:hover {
  background-color: #1e293b;
  border-color: #334155;
}

input.table-input:focus {
  background-color: #ffffff;
  border-color: #FF6600;
  box-shadow: 0 0 0 2.5px rgba(255, 102, 0, 0.2);
}

.dark input.table-input:focus {
  background-color: #0f172a;
  border-color: #FF6600;
  box-shadow: 0 0 0 2.5px rgba(255, 102, 0, 0.2);
}

/* ==========================================================================
   Light-Theme Only Enhancements (Scoped strictly to html:not(.dark))
   ========================================================================== */
html:not(.dark) body {
  background-color: #f8fafc;
  background-image: none;
}

html:not(.dark) .bg-white {
  background-color: #ffffff !important;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
  border-color: #e2e8f0;
}

html:not(.dark) header {
  background-color: #ffffff !important;
  border-bottom-color: #e2e8f0;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.03);
}

html:not(.dark) .shape-btn {
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
}

html:not(.dark) .shape-btn:hover {
  transform: translateY(-2px);
  border-color: #fdba74;
  background: #fff7ed;
  box-shadow: 0 4px 12px -2px rgba(255, 102, 0, 0.15);
}

html:not(.dark) .shape-btn-active {
  border-color: #FF6600 !important;
  background: #FF6600 !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px -2px rgba(255, 102, 0, 0.35) !important;
}

html:not(.dark) .shape-btn-active span,
html:not(.dark) .shape-btn-active svg,
html:not(.dark) .shape-btn-active i {
  color: #ffffff !important;
  stroke: #ffffff !important;
}

/* ==========================================================================
   Mobile Touch & Viewport Responsiveness
   ========================================================================== */
.scroller, .overflow-x-auto, .overflow-y-auto {
  -webkit-overflow-scrolling: touch;
}

#mobile-bottom-nav {
  padding-bottom: max(0.25rem, env(safe-area-inset-bottom));
}

@media (max-width: 640px) {
  body {
    -webkit-tap-highlight-color: transparent;
  }
  
  /* Ensure modals do not exceed screen height */
  .modal-dialog, [id$="-modal"] > div {
    max-height: calc(100dvh - 2rem) !important;
  }
}

/* ==========================================================================
   Full-Screen Authentication Slideshow
   ========================================================================== */
.auth-bg-slide {
  transition: opacity 1.2s cubic-bezier(0.4, 0, 0.2, 1), transform 8s ease-out;
  transform: scale(1.04);
}

.auth-bg-slide.opacity-100 {
  transform: scale(1);
}

.auth-topic-card {
  transition: opacity 0.5s ease, transform 0.5s ease;
}

/* ==========================================================================
   Global Light Placeholder Text Styling
   ========================================================================== */
::placeholder {
  color: #94a3b8 !important; /* Tailwind slate-400 */
  opacity: 0.8 !important;
  font-weight: 400 !important;
}

input::placeholder,
textarea::placeholder,
select::placeholder {
  color: #94a3b8 !important;
  opacity: 0.8 !important;
  font-weight: 400 !important;
}

input::-webkit-input-placeholder,
textarea::-webkit-input-placeholder {
  color: #94a3b8 !important;
  opacity: 0.8 !important;
  font-weight: 400 !important;
}

input::-moz-placeholder,
textarea::-moz-placeholder {
  color: #94a3b8 !important;
  opacity: 0.8 !important;
  font-weight: 400 !important;
}

input:-ms-input-placeholder,
textarea:-ms-input-placeholder {
  color: #94a3b8 !important;
  opacity: 0.8 !important;
  font-weight: 400 !important;
}

/* Dark Mode Placeholders */
.dark ::placeholder,
html.dark ::placeholder {
  color: #64748b !important; /* Tailwind slate-500 */
  opacity: 0.85 !important;
  font-weight: 400 !important;
}

.dark input::placeholder,
.dark textarea::placeholder,
.dark select::placeholder,
html.dark input::placeholder,
html.dark textarea::placeholder,
html.dark select::placeholder {
  color: #64748b !important;
  opacity: 0.85 !important;
  font-weight: 400 !important;
}

.dark input::-webkit-input-placeholder,
.dark textarea::-webkit-input-placeholder,
html.dark input::-webkit-input-placeholder,
html.dark textarea::-webkit-input-placeholder {
  color: #64748b !important;
  opacity: 0.85 !important;
  font-weight: 400 !important;
}

.dark input::-moz-placeholder,
.dark textarea::-moz-placeholder,
html.dark input::-moz-placeholder,
html.dark textarea::-moz-placeholder {
  color: #64748b !important;
  opacity: 0.85 !important;
  font-weight: 400 !important;
}

/* ==========================================================================
   Harmonized Typography for Metal Calculator & Product Workings Views
   (Clean, balanced font sizes; preserves compact form factors; avoids forced bolding)
   ========================================================================== */

/* Keep prominent calculated metric values clearly legible across both views */
#result-weight-primary,
#workings-result-weight-primary {
  font-size: 1.75rem !important; /* 28px */
}

#result-cost,
#workings-result-cost {
  font-size: 1.35rem !important; /* ~22px */
}

#calc-total-cost {
  font-size: 1.15rem !important; /* ~18.5px */
}

/* Normal/medium font weights for field labels so they are clean and not overly bold */
#tab-calculator-content label,
#org-calc-workings-view label {
  font-weight: 500;
}

/* ==========================================================================
   Mobile Responsive Sidebar Drawer & Viewport Adjustments
   ========================================================================== */

/* Mobile Off-Canvas Drawer (< 768px) */
@media (max-width: 767.98px) {
  #org-sidebar {
    position: fixed !important;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 50 !important;
    max-height: 100vh !important;
    max-height: 100dvh !important;
    transform: translateX(-100%) !important;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
    box-shadow: none;
  }

  #org-sidebar.mobile-open {
    transform: translateX(0) !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.08) !important;
  }

  #org-sidebar-backdrop.backdrop-active {
    display: block !important;
    opacity: 1 !important;
  }
}

/* Desktop Collapsed Sidebar (>= 768px) */
@media (min-width: 768px) {
  #org-sidebar.collapsed {
    width: 4.5rem !important;
  }

  #org-sidebar.collapsed .truncate,
  #org-sidebar.collapsed p.text-\[10px\],
  #org-sidebar.collapsed span:not(.sr-only) {
    display: none !important;
  }

  #org-sidebar.collapsed .sidebar-nav-btn {
    justify-content: center !important;
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
  }

  #org-sidebar.collapsed #sidebar-logout-btn {
    justify-content: center !important;
  }
}

/* Ensure date input calendar icon is sharp, dark, and clearly visible in light theme */
input[type="date"] {
  color-scheme: light;
  position: relative;
}

.dark input[type="date"] {
  color-scheme: dark;
}

input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 1 !important;
  filter: brightness(0.2) contrast(1.5) !important;
  transition: opacity 0.2s ease, transform 0.15s ease;
}

input[type="date"]::-webkit-calendar-picker-indicator:hover {
  opacity: 1 !important;
  transform: scale(1.1);
}

.dark input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.9) brightness(1) !important;
}

/* ==========================================================================
   Engineering Charcoal Sidebar Navigation & Active States (#293033 & #FF6600)
   ========================================================================== */
#org-sidebar {
  background-color: #293033 !important;
  border-right-color: #1f2527 !important;
  max-height: 100vh !important;
  max-height: 100dvh !important;
}

.sidebar-nav-btn.sidebar-active {
  background-color: #FF6600 !important;
  color: #ffffff !important;
  box-shadow: 0 4px 14px -2px rgba(0, 0, 0, 0.35) !important;
  border-color: transparent !important;
}

.sidebar-nav-btn.sidebar-active > div:first-child,
.sidebar-nav-btn.sidebar-active .sidebar-nav-icon {
  background-color: rgba(255, 255, 255, 0.2) !important;
  color: #ffffff !important;
}

.sidebar-nav-btn:not(.sidebar-active) {
  color: #cbd5e1 !important;
}

.sidebar-nav-btn:not(.sidebar-active) > div:first-child,
.sidebar-nav-btn:not(.sidebar-active) .sidebar-nav-icon {
  background-color: rgba(255, 255, 255, 0.06) !important;
  color: #94a3b8 !important;
}

.sidebar-nav-btn:not(.sidebar-active):hover {
  background-color: rgba(255, 255, 255, 0.08) !important;
  color: #ffffff !important;
}

.sidebar-nav-btn:not(.sidebar-active):hover > div:first-child,
.sidebar-nav-btn:not(.sidebar-active):hover .sidebar-nav-icon {
  background-color: rgba(255, 255, 255, 0.14) !important;
  color: #ffffff !important;
}

/* ==========================================================================
   Global Typographic Hierarchy (Topographical Order: Tier 1 to Tier 10)
   ========================================================================== */
.typography-h1 {
  font-size: 1.5rem !important; /* 24px */
  line-height: 2rem !important; /* 32px */
  font-weight: 900 !important;
  letter-spacing: -0.025em !important;
}
@media (min-width: 640px) {
  .typography-h1 {
    font-size: 1.625rem !important; /* 26px */
  }
}

.typography-lead {
  font-size: 0.8125rem !important; /* 13px */
  line-height: 1.25rem !important;
  font-weight: 400 !important;
  color: #64748b;
}
.dark .typography-lead {
  color: #94a3b8;
}

.typography-card-title {
  font-size: 0.9375rem !important; /* 15px */
  line-height: 1.375rem !important; /* 22px */
  font-weight: 700 !important;
  letter-spacing: -0.01em !important;
}

.typography-label {
  font-size: 0.6875rem !important; /* 11px */
  line-height: 1rem !important;
  font-weight: 600 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.05em !important;
  color: #475569;
}
.dark .typography-label {
  color: #94a3b8;
}

.typography-th {
  font-size: 0.6875rem !important; /* 11px */
  line-height: 1rem !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.05em !important;
  color: #64748b !important;
}

.typography-hero-total {
  font-family: var(--font-mono) !important;
  font-size: 1.25rem !important; /* 20px */
  line-height: 1.75rem !important;
  font-weight: 900 !important;
  color: #FF6600 !important;
  white-space: nowrap !important;
}
@media (min-width: 640px) {
  .typography-hero-total {
    font-size: 1.375rem !important; /* 22px */
    white-space: nowrap !important;
  }
}

