/* ==========================================================================
   DreamIT ImpactOS - Responsive Breakpoints & Mobile System
   ========================================================================== */

/* ---------------------------------------------------------
   Large Desktops & 4K Displays (>= 1920px, 2560px)
   --------------------------------------------------------- */
@media (min-width: 1920px) {
  :root {
    --container-max: 1480px;
    --container-wide: 1680px;
  }
  body {
    font-size: 17px;
  }
}

/* ---------------------------------------------------------
   Desktops & Laptops (<= 1280px)
   --------------------------------------------------------- */
@media (max-width: 1280px) {
  .hero-title {
    font-size: clamp(2.25rem, 4vw, 3.25rem);
  }
  .mega-menu {
    min-width: 480px;
    padding: var(--space-4);
  }
}

/* ---------------------------------------------------------
   Tablets & Medium Screens (<= 1024px)
   --------------------------------------------------------- */
@media (max-width: 1024px) {
  .nav-menu, .cmd-trigger {
    display: none;
  }

  .mobile-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Mobile Navigation Drawer */
  .mobile-drawer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(243, 242, 244, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 1500;
    display: flex;
    flex-direction: column;
    padding: var(--space-6);
    transform: translateX(-100%);
    transition: transform var(--transition-smooth);
    overflow-y: auto;
  }

  .mobile-drawer.open {
    transform: translateX(0);
  }

  .mobile-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-8);
  }

  .mobile-nav-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
  }

  .mobile-nav-link {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
    padding: 10px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-subtle);
  }

  .mobile-sub-menu {
    padding-left: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 6px;
    margin-bottom: 12px;
  }

  .mobile-sub-menu a {
    color: var(--text-muted);
    font-size: 0.9rem;
  }

  .mobile-drawer-footer {
    margin-top: auto;
    padding-top: var(--space-8);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
  }

  .footer-top {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-8);
  }
}

/* ---------------------------------------------------------
   Tablets Portrait & Large Mobiles (<= 768px)
   --------------------------------------------------------- */
@media (max-width: 768px) {
  :root {
    --header-height: 64px;
  }

  .section {
    padding-top: var(--space-12);
    padding-bottom: var(--space-12);
  }

  .section-header {
    margin-bottom: var(--space-10);
  }

  .master-transform-grid {
    grid-template-columns: 1fr;
  }

  .transform-box::after {
    content: '↓';
    right: 50%;
    bottom: -18px;
    top: auto;
    transform: translateX(50%);
  }

  .pipeline-track {
    grid-template-columns: repeat(2, 1fr);
  }

  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .footer-top {
    grid-template-columns: 1fr;
    gap: var(--space-8);
  }

  .footer-legal-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  /* Responsive Table to Cards conversion */
  .table-responsive-cards table, 
  .table-responsive-cards thead, 
  .table-responsive-cards tbody, 
  .table-responsive-cards th, 
  .table-responsive-cards td, 
  .table-responsive-cards tr {
    display: block;
  }

  .table-responsive-cards thead tr {
    position: absolute;
    top: -9999px;
    left: -9999px;
  }

  .table-responsive-cards tr {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-4);
    background: var(--surface);
    padding: var(--space-3);
  }

  .table-responsive-cards td {
    border: none;
    position: relative;
    padding-left: 45%;
    text-align: right;
    border-bottom: 1px solid var(--border-subtle);
  }

  .table-responsive-cards td:last-child {
    border-bottom: none;
  }

  .table-responsive-cards td::before {
    content: attr(data-label);
    position: absolute;
    left: 12px;
    width: 40%;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
  }

  /* Split deck stack */
  .split-deck {
    grid-template-columns: 1fr;
  }

  .split-center-hub {
    margin: var(--space-4) 0;
  }

  .report-meta-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .dash-middle-row {
    grid-template-columns: 1fr;
  }

  .dash-kpi-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ---------------------------------------------------------
   Small Phones (320px - 430px)
   --------------------------------------------------------- */
@media (max-width: 430px) {
  .hero-title {
    font-size: 2rem;
  }

  .hero-desc {
    font-size: 1rem;
  }

  .btn {
    padding: 10px 16px;
    font-size: 0.875rem;
  }

  .hero-cta-group .btn {
    width: 100%;
  }

  .hero-dashboard-card {
    padding: 14px;
    border-radius: 18px;
  }

  .dash-topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .dash-kpi-row {
    grid-template-columns: 1fr;
  }

  .mini-kpi-val {
    font-size: 1.15rem;
  }

  .modal-content {
    padding: var(--space-5);
  }

  .report-paper {
    padding: var(--space-4);
  }

  .report-meta-grid {
    grid-template-columns: 1fr;
  }

  .demo-header-bar {
    padding: var(--space-3);
  }

  .demo-tab-btn {
    padding: 6px 10px;
    font-size: 0.775rem;
  }

  .chat-bubble {
    max-width: 95%;
  }
}
