/* =========================================================================
   shared-responsive.css - Universal Multi-Device Breakpoints for PARS Dashboards
   Supports: Submitter, Reviewer, and Admin portals across all screen sizes
   ========================================================================= */

/* ── Base Sidebar Drawer & Overlay Transitions ── */
.sidebar {
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
  will-change: transform;
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 95;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.sidebar-overlay.active,
.sidebar-overlay.open {
  opacity: 1;
  visibility: visible;
}

/* ── Responsive Table Wrappers ── */
.table-responsive,
.table-container,
.responsive-table,
.table-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 1rem;
  border-radius: 8px;
}

/* ── Large Desktop & Multi-Monitor (> 1440px) ── */
@media (min-width: 1440px) {
  .dashboard-body,
  .main-content__inner {
    max-width: 1600px;
    margin: 0 auto;
  }
}

/* ── Tablet & Medium Laptops (Max Width: 1024px) ── */
@media (max-width: 1024px) {
  .dashboard-grid,
  .admin-grid,
  .reviewer-grid {
    grid-template-columns: 1fr !important;
    gap: 1.5rem;
  }
  
  .quick-actions,
  .stats-row,
  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)) !important;
    gap: 1rem;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .page-header__actions {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
  }
}

/* ── Mobile Devices & Foldables (Max Width: 768px) ── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%) !important;
    box-shadow: none;
    z-index: 1000 !important;
    width: 260px !important;
    max-width: 85vw !important;
  }

  .sidebar.active,
  .sidebar.open {
    transform: translateX(0) !important;
    box-shadow: 0 0 35px rgba(0, 0, 0, 0.55) !important;
  }

  .sidebar-overlay {
    z-index: 999 !important;
  }

  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: hidden;
  }

  .topbar {
    padding: 0 12px;
    height: 60px;
    box-sizing: border-box;
  }

  .topbar__left {
    gap: 10px;
    min-width: 0;
  }

  .topbar__title-wrapper h1 {
    font-size: 16px;
    max-width: 130px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .menu-toggle,
  .topbar__hamburger {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    background: rgba(255, 255, 255, 0.12) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    cursor: pointer;
    font-size: 1.15rem;
    color: #ffffff !important;
    border-radius: 8px;
    flex-shrink: 0;
  }

  .menu-toggle:hover,
  .topbar__hamburger:hover {
    background: rgba(255, 255, 255, 0.2) !important;
    color: var(--secondary, #C9941A) !important;
  }

  .topbar__right {
    gap: 8px;
  }

  .topbar__logout-btn {
    padding: 7px 11px;
    font-size: 12px;
    gap: 5px;
  }

  .topbar__welcome,
  .topbar__search-box {
    display: none !important;
  }

  .dashboard-body {
    padding: 1.25rem 1rem calc(1.5rem + env(safe-area-inset-bottom, 0px));
  }

  .quick-actions {
    grid-template-columns: 1fr !important;
  }

  .action-card {
    padding: 1.25rem;
  }
  
  .action-card p {
    margin-bottom: 1rem;
  }

  /* Form & Card Stack Layouts */
  .form-row,
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr !important;
    gap: 1rem;
  }

  .panel-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
  }
}

/* ── Small Mobile Devices (Max Width: 480px) ── */
@media (max-width: 480px) {
  .dashboard-body {
    padding: 1rem 0.75rem;
  }

  .panel,
  .card {
    padding: 1rem;
    border-radius: 8px;
  }

  .notification-item {
    flex-direction: column;
    gap: 0.6rem;
    align-items: flex-start;
  }
  
  .sub-meta,
  .item-meta {
    flex-direction: column;
    gap: 0.4rem;
    align-items: flex-start;
  }

  .topbar__right {
    gap: 0.75rem;
  }
  
  .topbar__user-info {
    display: none;
  }

  .page-title {
    font-size: 1.25rem !important;
    margin-bottom: 1rem;
  }

  .btn {
    width: 100%;
    justify-content: center;
  }

  .btn-group {
    flex-direction: column;
    width: 100%;
  }

  .modal__content,
  .dialog-content {
    width: 95% !important;
    padding: 1.25rem !important;
    margin: 1rem auto;
  }
}

/* ── Tiny Mobile Screens (< 380px - iPhone SE, Galaxy Fold Cover) ── */
@media (max-width: 379px) {
  .topbar__role,
  .topbar__badge {
    display: none !important;
  }
  
  .sidebar {
    width: 240px;
  }

  .page-title {
    font-size: 1.15rem !important;
  }

  .stat-card__number {
    font-size: 1.5rem !important;
  }
}
