/* ============================================================
   RESPONSIVE & MOBILE OPTIMIZATIONS
   Université Adelphos d'Haïti (UNADH)
   ============================================================ */

/* Mobile Bottom Navigation Bar (App Experience on iOS / Android) */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background-color: #ffffff;
  border-top: 1px solid var(--color-border);
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.06);
  z-index: 999;
  justify-content: space-around;
  align-items: center;
  padding: 0 0.5rem;
}

.mobile-bottom-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--color-text-muted);
  font-size: 0.68rem;
  font-weight: 600;
  flex: 1;
  padding: 0.35rem 0;
  transition: all var(--transition-fast);
}

.mobile-bottom-btn svg {
  width: 20px;
  height: 20px;
}

.mobile-bottom-btn.active, .mobile-bottom-btn:hover {
  color: var(--color-primary);
}

/* Mobile Hamburger Menu */
.mobile-menu-btn {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  align-items: center;
  justify-content: center;
  color: var(--color-text-primary);
  background: var(--color-surface-secondary);
  border: 1px solid var(--color-border);
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.mobile-menu-btn:hover {
  background: #f1f5f9;
  border-color: #86efac;
  color: var(--color-primary);
}

.dark-theme .mobile-menu-btn {
  background: var(--dark-card);
  border-color: var(--dark-border);
  color: #ffffff;
}

.dark-theme .mobile-menu-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(52, 211, 153, 0.5);
  color: #6ee7b7;
}

/* ============================================================
   MOBILE SLIDE-OVER DRAWER (TABLET & PHONE)
   ============================================================ */
.mobile-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11, 23, 16, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.mobile-drawer-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.mobile-drawer-content {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 320px;
  max-width: 88vw;
  background-color: #004724;
  color: #ffffff;
  z-index: 1210;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  padding: 1.25rem 1.25rem 1.5rem;
  box-shadow: 10px 0 35px rgba(0, 0, 0, 0.45);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.mobile-drawer-overlay.active .mobile-drawer-content {
  transform: translateX(0);
}

.mobile-drawer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  margin-bottom: 1.25rem;
}

.mobile-drawer-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.mobile-drawer-logo {
  width: 38px;
  height: 44px;
  object-fit: contain;
  filter: drop-shadow(0 2px 5px rgba(0,0,0,0.3));
}

.mobile-drawer-univ {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 0.95rem;
  color: #ffffff;
  line-height: 1.2;
}

.mobile-drawer-motto {
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  color: #86efac;
}

.mobile-drawer-close {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.15);
  font-size: 1.35rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.mobile-drawer-close:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* User Profile card in mobile drawer */
.mobile-drawer-user-box {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  padding: 1rem;
  margin-bottom: 1.25rem;
}

.mobile-drawer-user-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.mobile-drawer-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #10b981;
  color: #ffffff;
  font-weight: 800;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.mobile-drawer-user-info {
  display: flex;
  flex-direction: column;
}

.mob-user-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: #ffffff;
}

.mob-user-sub {
  font-size: 0.72rem;
  color: #a7f3d0;
}

.mobile-drawer-user-actions button {
  width: 100%;
}

/* Drawer navigation groups */
.mobile-drawer-nav-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1.25rem;
}

.mobile-drawer-nav-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #86efac;
  font-weight: 700;
  padding: 0 0.5rem 0.35rem;
}

.mobile-drawer-link {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-md);
  color: #d1fae5;
  font-size: 0.925rem;
  font-weight: 600;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.mobile-drawer-link:hover, .mobile-drawer-link.active {
  background-color: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  transform: translateX(4px);
}

.mobile-drawer-link svg {
  color: #6ee7b7;
}

.mobile-drawer-action-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.85rem;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font-size: 0.875rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: all var(--transition-fast);
  width: 100%;
}

.mobile-drawer-action-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: #86efac;
  transform: translateX(3px);
}

.mobile-drawer-util-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  font-size: 0.825rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  width: 100%;
}

.mobile-drawer-util-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.mobile-drawer-footer {
  margin-top: auto;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.75rem;
  color: #a7f3d0;
  line-height: 1.5;
}

/* Sync status badge in topbar */
.sync-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
}

.sync-online {
  background-color: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.sync-offline {
  background-color: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}

.sync-syncing {
  background-color: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}

/* ============================================================
   RESPONSIVE BREAKPOINTS (TABLETS & PHONES)
   ============================================================ */

/* Tablet & Mobile Screens (<= 992px) */
@media (max-width: 992px) {
  .mobile-menu-btn {
    display: inline-flex !important;
  }

  .nav-menu, .nav-center-wrapper {
    display: none !important;
  }

  .portals-dropdown-wrapper {
    display: none !important;
  }

  .btn-nav-auth {
    display: none !important;
  }

  /* Admin Sidebar on tablet/mobile behaves as slide-out drawer */
  .admin-sidebar {
    display: flex !important;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1200;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    width: 280px;
    box-shadow: 10px 0 35px rgba(0, 0, 0, 0.45);
  }

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

  .admin-sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(11, 23, 16, 0.65);
    backdrop-filter: blur(5px);
    z-index: 1150;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }

  .admin-sidebar-backdrop.active {
    opacity: 1;
    pointer-events: auto;
  }

  .admin-sidebar-close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    font-size: 1.25rem;
    cursor: pointer;
    border: none;
    margin-left: auto;
  }

  .admin-main {
    margin-left: 0;
    width: 100%;
  }

  .mobile-bottom-nav {
    display: flex;
  }

  .admin-main, .student-portal-layout, .public-page {
    padding-bottom: 74px;
  }

  .hero-container {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 2rem;
  }

  .hero-content {
    align-items: center;
  }

  .hero-title {
    font-size: 2.75rem;
  }

  .emblem-wrapper {
    width: 280px;
    height: 320px;
  }

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

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

@media (min-width: 993px) {
  .admin-sidebar-backdrop, .admin-sidebar-close-btn, .admin-mobile-toggle-btn {
    display: none !important;
  }
}

/* Small Smartphone Screens (<= 640px) */
@media (max-width: 640px) {
  .public-navbar {
    height: 66px;
  }

  .public-nav-container {
    padding: 0 1rem;
  }

  .brand-group {
    gap: 0.6rem;
  }

  .brand-emblem-img {
    width: 36px;
    height: 42px;
  }

  .brand-title {
    font-size: 1.15rem;
  }

  .brand-subtitle, .brand-motto {
    display: none !important;
  }

  .portal-pill-btn {
    display: none !important;
  }

  .btn-nav-cta {
    height: 35px;
    padding: 0 0.85rem;
    font-size: 0.78rem;
  }

  .nav-icon-btn, .mobile-menu-btn {
    width: 36px;
    height: 36px;
  }

  .hero-title {
    font-size: 2.15rem;
  }

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

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

  .hero-cta-group .btn-primary, .hero-cta-group .btn-outline-green {
    width: 100%;
  }

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

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

  .admin-topbar {
    padding: 0 1rem;
    height: 60px;
  }

  .user-pill .user-meta {
    display: none;
  }

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

  .filter-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-select-group {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-select {
    width: 100%;
  }

  /* Student Detail Drawer behaves as full overlay on mobile */
  .students-view-layout {
    grid-template-columns: 1fr;
  }

  .student-detail-drawer {
    position: fixed;
    inset: 0;
    top: 60px;
    z-index: 1000;
    border-radius: 0;
    overflow-y: auto;
    margin: 0;
  }

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

  .charts-grid-2 {
    grid-template-columns: 1fr;
  }

  .auth-body {
    padding: 1.25rem 1rem;
  }

  .receipt-paper {
    padding: 1.25rem;
  }

  .receipt-details-grid {
    grid-template-columns: 1fr;
  }
}
