/* Chama Pro Dual-Theme Architecture (Light & Dark) */
:root {
  --color-page-bg: #f8fafc;
  --color-card-bg: #ffffff;
  --color-card-elevated: #f1f5f9;
  --color-border: #e2e8f0;
  --color-border-subtle: #f1f5f9;
  --color-text-main: #0f172a;
  --color-text-muted: #64748b;
  --color-text-secondary: #334155;
  --color-input-bg: #ffffff;
  --color-input-border: #cbd5e1;
  --color-primary-rgb: 5, 150, 105;
  --color-primary: rgb(5, 150, 105);
  --color-light-blue: #38bdf8;
  --color-light-blue-surface: #f0f9ff;
}

html.dark {
  --color-page-bg: #090d16;
  --color-card-bg: #0f172a;
  --color-card-elevated: #1e293b;
  --color-border: #1e293b;
  --color-border-subtle: #172033;
  --color-text-main: #f8fafc;
  --color-text-muted: #94a3b8;
  --color-text-secondary: #cbd5e1;
  --color-input-bg: #131c2e;
  --color-input-border: #2e3d57;
  --color-primary-rgb: 5, 150, 105;
  --color-primary: rgb(16, 185, 129);
  --color-light-blue: #38bdf8;
  --color-light-blue-surface: rgba(14, 165, 233, 0.12);
}

/* Smooth transition for theme switches */
html, body, header, aside, main, footer, .theme-transition {
  transition: background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1),
              border-color 0.2s cubic-bezier(0.4, 0, 0.2, 1),
              color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Crisp Fintech Typography Baseline */
body {
  font-size: 0.8125rem; /* 13px base for professional high-density dashboards */
  line-height: 1.25rem;
  letter-spacing: -0.011em;
}

/* Smooth Momentum Touch Scrolling for Data Tables on Mobile */
.table-responsive,
.overflow-x-auto {
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}

/* Responsive tap ergonomics */
@media (max-width: 640px) {
  button, input, select, textarea, a.button {
    touch-action: manipulation;
  }
}

/* Universal Dark Mode Form Enhancements */
html.dark input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="reset"]),
html.dark select,
html.dark textarea {
  background-color: #131c2e !important;
  border-color: #2e3d57 !important;
  color: #f8fafc !important;
}

html.dark input::placeholder,
html.dark textarea::placeholder {
  color: #64748b !important;
}

html.dark input:focus,
html.dark select:focus,
html.dark textarea:focus {
  border-color: #10b981 !important;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.25) !important;
}

/* Checkbox and Radio styling */
html.dark input[type="checkbox"],
html.dark input[type="radio"] {
  background-color: #131c2e !important;
  border-color: #334155 !important;
}

/* Universal Dark Mode Table Enhancements */
html.dark table {
  border-color: #1e293b;
}

html.dark thead th {
  background-color: rgba(19, 28, 46, 0.95);
  color: #94a3b8 !important;
  border-color: #1e293b !important;
}

html.dark tbody tr {
  border-color: #1e293b !important;
}

html.dark tbody tr:hover {
  background-color: rgba(30, 41, 59, 0.5) !important;
}

html.dark td {
  border-color: #1e293b !important;
}

/* Card surfaces */
.theme-card {
  background-color: var(--color-card-bg);
  border: 1px solid var(--color-border);
}

/* Global Hidden Scrollbars - Clean Modern Finish */
html, body {
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}

::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

/* Mutual Exclusivity for Theme Icons - Guarantees strictly ONE icon is visible at any given moment */
html:not(.dark) .themeIconSun,
html:not(.dark) .theme-icon-sun,
html:not(.dark) [data-theme-icon="sun"] {
  display: none !important;
}

html:not(.dark) .themeIconMoon,
html:not(.dark) .theme-icon-moon,
html:not(.dark) [data-theme-icon="moon"] {
  display: inline-block !important;
}

html.dark .themeIconMoon,
html.dark .theme-icon-moon,
html.dark [data-theme-icon="moon"] {
  display: none !important;
}

html.dark .themeIconSun,
html.dark .theme-icon-sun,
html.dark [data-theme-icon="sun"] {
  display: inline-block !important;
}

/* Hide all scrollbars across browsers while preserving full scrollability */
* {
  scrollbar-width: none !important; /* Firefox */
  -ms-overflow-style: none !important; /* IE and Edge */
}

*::-webkit-scrollbar {
  display: none !important; /* Chrome, Safari, Opera */
  width: 0 !important;
  height: 0 !important;
}

/* Custom Scrollbar utility (hidden) */
.custom-scrollbar {
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}

.custom-scrollbar::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

/* ================================================================
   MOBILE NAVIGATION DRAWER & SIDEBAR ARCHITECTURE
   Direction: Left -> Right (translateX)
   Height: 100dvh
   Width: Responsive <= 85dvw, max 320px
   Internal vertical navigation scrolling
   ================================================================ */
@media (max-width: 767.98px) {
  .app-sidebar-drawer,
  aside#appSidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    height: 100dvh !important;
    width: min(85dvw, 320px) !important;
    max-width: 85dvw !important;
    z-index: 50 !important;
    margin: 0 !important;
    border-radius: 0 1.25rem 1.25rem 0 !important;
    border-left: none !important;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1) !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5) !important;
    padding-top: max(1rem, env(safe-area-inset-top, 0px)) !important;
    padding-bottom: max(1rem, env(safe-area-inset-bottom, 0px)) !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
  }

  .app-sidebar-drawer.drawer-open,
  aside#appSidebar.drawer-open {
    transform: translateX(0) !important;
  }
}

/* ================================================================
   MOBILE CONTENT MODAL (BOTTOM-SHEET) ARCHITECTURE
   Direction: Bottom -> Top (translateY)
   Max Height: 75dvh
   Width: 100dvw
   Internal vertical content scrolling
   ================================================================ */
@media (max-width: 767.98px) {
  .modal-overlay,
  div[id$="Modal"]:not(#userMenuDropdown),
  div[id$="-modal"]:not(#userMenuDropdown) {
    align-items: flex-end !important;
    padding: 0 !important;
    overflow: hidden !important;
  }

  .modal-dialog,
  div[id$="Modal"]:not(#userMenuDropdown) > div,
  div[id$="-modal"]:not(#userMenuDropdown) > div {
    width: 100dvw !important;
    max-width: 100dvw !important;
    max-height: 75dvh !important;
    border-bottom-left-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
    border-top-left-radius: 1.5rem !important;
    border-top-right-radius: 1.5rem !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    padding-bottom: max(1rem, env(safe-area-inset-bottom, 0px)) !important;
    box-shadow: 0 -10px 40px -10px rgba(0, 0, 0, 0.35) !important;
    animation: modalSlideUp 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
  }

  @keyframes modalSlideUp {
    from {
      transform: translateY(100%);
    }
    to {
      transform: translateY(0);
    }
  }

  /* Internal scrolling inside bottom sheets when content exceeds 75dvh */
  div[id$="Modal"]:not(#userMenuDropdown) > div > form,
  div[id$="-modal"]:not(#userMenuDropdown) > div > form {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 0% !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  div[id$="Modal"]:not(#userMenuDropdown) > div > form > div:not([class*="shrink-0"]):not([class*="border-t"]),
  div[id$="Modal"]:not(#userMenuDropdown) > div > .overflow-y-auto,
  div[id$="-modal"]:not(#userMenuDropdown) > div > .overflow-y-auto,
  div[id$="Modal"]:not(#userMenuDropdown) > div .modal-scroll-area,
  div[id$="-modal"]:not(#userMenuDropdown) > div .modal-scroll-area {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch;
  }
}

/* User Profile Modal Desktop Bottom Emergence */
@media (min-width: 768px) {
  #userProfileModal .modal-dialog {
    animation: profileModalSlideUpDesktop 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
  }

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



