/**
 * Portal 2.0 – Responsive styles
 * Mobile menu and page header styling
 */

/* ============================================
   MOBILE MENU - Custom slide-in panel
   ============================================ */

/* Hamburger button */
.mobile-menu-btn {
  display: none;
  width: 44px;
  height: 44px;
  padding: 10px;
  border: none;
  background: transparent;
  cursor: pointer;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  z-index: 1001;
}

.mobile-menu-btn .bar {
  display: block;
  width: 22px;
  height: 2px;
  background-color: #333;
  border-radius: 2px;
  transition: all 0.3s ease;
}

.mobile-menu-btn.active .bar:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-btn.active .bar:nth-child(2) {
  opacity: 0;
}

.mobile-menu-btn.active .bar:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* Mobile menu panel */
.mobile-menu-panel {
  display: none;
  position: fixed;
  top: 0;
  right: 0;
  width: 300px;
  max-width: 85vw;
  height: 100%;
  background: #fff;
  z-index: 1060;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  flex-direction: column;
  box-shadow: -2px 0 10px rgba(0,0,0,0.15);
}

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

/* Mobile menu overlay */
.mobile-menu-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1055;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.mobile-menu-backdrop.show {
  opacity: 1;
}

/* Mobile menu header */
.mobile-menu-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: #0d6efd;
  color: #fff;
  flex-shrink: 0;
}

.mobile-menu-panel-header .user-info {
  display: flex;
  flex-direction: column;
}

.mobile-menu-panel-header .user-name {
  font-weight: 600;
  font-size: 15px;
}

.mobile-menu-panel-header .user-role {
  font-size: 12px;
  opacity: 0.85;
  text-transform: capitalize;
}

.mobile-menu-panel-header .close-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.mobile-menu-panel-header .close-btn:hover {
  background: rgba(255,255,255,0.3);
}

/* Mobile menu nav */
.mobile-menu-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.mobile-menu-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.mobile-menu-nav .menu-item {
  border-bottom: 1px solid #eee;
}

.mobile-menu-nav .menu-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  color: #333;
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  transition: background 0.15s;
}

.mobile-menu-nav .menu-link:hover {
  background: #f5f5f5;
  color: #0d6efd;
}

.mobile-menu-nav .menu-link.active {
  color: #0d6efd;
  background: #e7f1ff;
}

.mobile-menu-nav .menu-link .arrow {
  font-size: 18px;
  color: #999;
  transition: transform 0.2s;
}

.mobile-menu-nav .menu-item.open .menu-link .arrow {
  transform: rotate(90deg);
}

/* Submenu */
.mobile-menu-nav .submenu {
  display: none;
  background: #f8f9fa;
}

.mobile-menu-nav .menu-item.open .submenu {
  display: block;
}

.mobile-menu-nav .submenu .submenu-link {
  display: block;
  padding: 12px 20px 12px 36px;
  color: #555;
  text-decoration: none;
  font-size: 14px;
  border-bottom: 1px solid #eee;
  transition: background 0.15s;
}

.mobile-menu-nav .submenu .submenu-link:last-child {
  border-bottom: none;
}

.mobile-menu-nav .submenu .submenu-link:hover {
  background: #e9ecef;
  color: #0d6efd;
}

.mobile-menu-nav .submenu .submenu-link.active {
  color: #0d6efd;
  font-weight: 500;
}

/* Mobile menu footer */
.mobile-menu-panel-footer {
  padding: 16px 20px;
  border-top: 1px solid #eee;
  background: #f8f9fa;
  flex-shrink: 0;
}

.mobile-menu-panel-footer .logout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #dc3545;
  background: #fff;
  color: #dc3545;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.mobile-menu-panel-footer .logout-btn:hover {
  background: #dc3545;
  color: #fff;
}

.mobile-menu-panel-footer .logout-btn i {
  margin-right: 8px;
}

/* Body scroll lock */
body.mobile-menu-open {
  overflow: hidden;
}

/* ============================================
   DESKTOP NAVBAR - Compact styling for many items
   ============================================ */
.navbar .navbar-nav .nav-link {
  font-size: 0.82rem;
  padding: 0.4rem 0.5rem;
  white-space: nowrap;
}

.navbar .navbar-nav .dropdown-menu {
  font-size: 0.82rem;
}

.navbar .navbar-nav .dropdown-item {
  padding: 0.35rem 1rem;
}

.navbar .navbar-nav {
  flex-wrap: nowrap;
}

/* Slightly larger on wide screens */
@media (min-width: 1400px) {
  .navbar .navbar-nav .nav-link {
    font-size: 0.875rem;
    padding: 0.5rem 0.65rem;
  }
  
  .navbar .navbar-nav .dropdown-menu {
    font-size: 0.875rem;
  }
}

/* ============================================
   RESPONSIVE BREAKPOINTS
   ============================================ */
@media (max-width: 1199.98px) {
  /* Show mobile menu elements */
  #shared-header .mobile-menu-btn,
  .mobile-menu-btn {
    display: flex !important;
  }
  
  #shared-header .mobile-menu-panel,
  .mobile-menu-panel {
    display: flex !important;
  }
  
  #shared-header .mobile-menu-backdrop,
  .mobile-menu-backdrop {
    display: block !important;
  }
  
  /* Hide Bootstrap navbar collapse on mobile */
  #shared-header .navbar-collapse,
  .navbar-collapse {
    display: none !important;
  }
  
  /* Navbar adjustments */
  #shared-header .navbar {
    padding: 8px 16px;
  }
  
  #shared-header .navbar-brand {
    font-size: 18px;
  }
  
  /* Reduce body padding */
  body {
    padding-top: 56px !important;
  }
}

/* ============================================
   AGENT DASHBOARD - Responsive layout
   ============================================ */
@media (max-width: 991px) {
  .agent-welcome .d-flex.justify-content-between {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.75rem;
    padding-right: 2.5rem;
  }

  #agent-selector {
    min-width: 0 !important;
    width: 100% !important;
  }
}

@media (max-width: 575px) {
  .agent-welcome {
    padding: 1rem 1.25rem !important;
  }

  .agent-welcome h4 {
    font-size: 1.1rem !important;
  }

  .agent-dashboard-panel {
    padding: 0.75rem;
  }

  #agent-dashboard-settings {
    top: 0.75rem !important;
    right: 0.75rem !important;
  }
}

/* ============================================
   MOBILE - Page Headers (smaller screens)
   ============================================ */
@media (max-width: 767px) {
  .page-header {
    padding: 12px 16px !important;
    margin-bottom: 16px !important;
    border-radius: 8px !important;
  }

  .page-header h1 {
    font-size: 1.2rem !important;
    font-weight: 600;
    margin: 0 !important;
  }

  .page-header .subtitle,
  .page-header .header-subtitle {
    font-size: 0.8rem !important;
    margin-top: 4px !important;
    opacity: 0.95;
  }

  .page-header.d-flex {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 12px;
  }

  .page-header .d-flex.gap-2,
  .page-header .btn,
  .page-header .nav-item.dropdown {
    width: 100%;
    max-width: 100%;
  }

  .page-header .btn-group {
    flex-wrap: wrap;
  }
}
