/* ==========================================================================
   Atmeeya Investment Sync Hub - Responsive Design System
   Mobile-First & Large/Ultrawide Screen Adaptations
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Base & Global Viewport Defaults
   -------------------------------------------------------------------------- */
html {
  -webkit-text-size-adjust: 100%;
  box-sizing: border-box;
}

*, *::before, *::after {
  box-sizing: inherit;
}

/* Ergonomic custom scrollbars (thin, non-obtrusive, theme-aware) */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--mud-palette-lines-default, rgba(0, 0, 0, 0.15));
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--mud-palette-primary, #1f4e78);
}

/* --------------------------------------------------------------------------
   2. Fluid Typography (Smooth scaling from 360px phones to 4K monitors)
   -------------------------------------------------------------------------- */
.mud-typography-h4, h4 {
  font-size: clamp(1.35rem, 2.5vw, 2.125rem) !important;
  line-height: 1.25 !important;
}

.mud-typography-h5, h5 {
  font-size: clamp(1.15rem, 2vw, 1.5rem) !important;
  line-height: 1.3 !important;
}

.mud-typography-h6, h6 {
  font-size: clamp(1rem, 1.5vw, 1.25rem) !important;
  line-height: 1.35 !important;
}

.app-title {
  font-size: clamp(1rem, 2.2vw, 1.35rem) !important;
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   3. Card Transitions & Interactive States (Existing Preserved)
   -------------------------------------------------------------------------- */
.item-card {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-investor-card {
  background-color: var(--mud-palette-surface) !important;
  border: 1px solid var(--mud-palette-lines-default) !important;
  color: var(--mud-palette-text-primary) !important;
}
.hover-investor-card:hover {
  background-color: var(--mud-palette-action-default-hover) !important;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.active-investor-card {
  background-color: var(--mud-palette-primary) !important;
  color: var(--mud-palette-primary-text) !important;
  border: 1px solid var(--mud-palette-primary) !important;
  box-shadow: 0 4px 12px rgba(var(--mud-palette-primary-rgb), 0.2);
}

/* --------------------------------------------------------------------------
   4. Text & Utility Helpers
   -------------------------------------------------------------------------- */
.text-muted {
  color: var(--mud-palette-text-secondary);
}
.text-white-muted {
  color: rgba(255, 255, 255, 0.7);
}
.font-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}
.border-b {
  border-bottom: 1px solid var(--mud-palette-lines-default);
}
.text-success {
  color: var(--mud-palette-success) !important;
}
.text-danger {
  color: var(--mud-palette-error) !important;
}

/* --------------------------------------------------------------------------
   5. Tables & DataGrids: Horizontal Touch-Scrolling & Compact Cells
   -------------------------------------------------------------------------- */
.mud-table-root,
.mud-data-grid,
.table-scroll-container {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.mud-table-container {
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}

/* Sticky Header Utility */
.table-sticky-header th {
  position: sticky;
  top: 0;
  z-index: 2;
  background-color: var(--mud-palette-surface) !important;
}

/* Mobile compact table cells */
@media (max-width: 599.98px) {
  .mud-table-cell {
    padding: 6px 10px !important;
    font-size: 0.8125rem !important;
    white-space: nowrap;
  }
  .mud-table-cell:first-child {
    padding-left: 12px !important;
  }
  .mud-table-cell:last-child {
    padding-right: 12px !important;
  }
}

/* --------------------------------------------------------------------------
   6. Touch Target Ergonomics on Mobile & Tablets (< 960px)
   -------------------------------------------------------------------------- */
@media (max-width: 959.98px) {
  .mud-button-root:not(.mud-icon-button) {
    min-height: 40px;
  }
  .mud-icon-button {
    min-width: 42px;
    min-height: 42px;
  }
  .mud-chip {
    min-height: 28px;
  }
  .mud-input-control {
    margin-bottom: 0.5rem;
  }
}

/* --------------------------------------------------------------------------
   7. Folio Manager Mobile Card System (Existing Preserved & Enhanced)
   -------------------------------------------------------------------------- */
.folio-mobile-list {
  display: none;
}

.folio-mobile-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

@media (max-width: 959.98px) {
  .folio-table {
    display: none;
  }

  .folio-mobile-list {
    display: grid;
    gap: 0.75rem;
  }
}

@media (max-width: 599.98px) {
  .folio-mobile-fields {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
}

/* --------------------------------------------------------------------------
   8. Dashboard Workstation Layout Responsiveness
   -------------------------------------------------------------------------- */
@media (max-width: 959.98px) {
  .style-dashboard-wrapper {
    flex-direction: column !important;
    height: auto !important;
    min-height: auto !important;
    overflow: visible !important;
  }

  .style-dashboard-wrapper > div:first-child {
    width: 100% !important;
    min-width: 100% !important;
    max-height: 380px;
    border-right: none !important;
    border-bottom: 1px solid var(--mud-palette-lines-default) !important;
  }

  .style-dashboard-wrapper > div:last-child {
    width: 100% !important;
    overflow: visible !important;
  }
}

/* --------------------------------------------------------------------------
   9. Responsive Flex & Action Bar Utilities
   -------------------------------------------------------------------------- */
.responsive-filter-bar {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
}
@media (min-width: 960px) {
  .responsive-filter-bar {
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
  }
}

.responsive-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
}
@media (min-width: 600px) {
  .responsive-actions {
    flex-direction: row;
    justify-content: flex-end;
    align-items: center;
    width: auto;
  }
}

.mobile-full-width {
  width: 100%;
}
@media (min-width: 600px) {
  .mobile-full-width {
    width: auto;
  }
}

.hide-on-mobile {
  display: initial;
}
@media (max-width: 599.98px) {
  .hide-on-mobile {
    display: none !important;
  }
}

.hide-on-desktop {
  display: none;
}
@media (max-width: 959.98px) {
  .hide-on-desktop {
    display: initial;
  }
}

/* --------------------------------------------------------------------------
   10. Card-Stacking Table Utility (.card-stack-table)
   -------------------------------------------------------------------------- */
@media (max-width: 599.98px) {
  .card-stack-table thead {
    display: none !important;
  }
  .card-stack-table tr {
    display: block !important;
    margin-bottom: 0.75rem !important;
    border: 1px solid var(--mud-palette-lines-default) !important;
    border-radius: 8px !important;
    padding: 0.5rem !important;
    background: var(--mud-palette-surface) !important;
  }
  .card-stack-table td {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 0.4rem 0.5rem !important;
    border: none !important;
    text-align: right !important;
  }
  .card-stack-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--mud-palette-text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    text-align: left;
    margin-right: 0.75rem;
  }
}

/* --------------------------------------------------------------------------
   11. Large Screens (1080p, 1440p, 4K & Ultrawide)
   -------------------------------------------------------------------------- */
@media (min-width: 1920px) {
  .mud-container-maxwidth-xl {
    max-width: 1920px !important;
    padding-left: 2rem !important;
    padding-right: 2rem !important;
  }
  .large-screen-card-grid {
    grid-template-columns: repeat(4, 1fr) !important;
  }
}

@media (min-width: 2560px) {
  .mud-container-maxwidth-xl {
    max-width: 2400px !important;
    padding-left: 3rem !important;
    padding-right: 3rem !important;
  }
}
