/* UniMate Mobile Styles */

/* =========================================
   Base Layout & Sidebar Hiding
   ========================================= */
@media (max-width: 768px) {
  /* Hide sidebar completely or move it off-screen */
  .sidebar {
    display: none !important;
    /* If we wanted a slide-out menu, we'd use transform, but we have the bottom nav now */
  }

  /* Reset main wrapper margins */
  .layout-with-sidebar .main-wrapper {
    margin-left: 0 !important;
    width: 100%;
  }

  /* Adjust container padding */
  .container {
    padding: 0 16px;
  }
  
  .layout-with-sidebar .main .container {
    margin: 0;
    padding: 16px 16px 20px; /* Extra bottom padding for mobile nav */
    max-width: 100%;
  }

  /* Header Adjustments */
  .header {
    margin: 8px 12px;
    border-radius: 16px;
    position: sticky;
    top: 8px;
    z-index: 100;
  }

  .header .header-content {
    padding: 8px 12px;
  }

  /* Hide desktop-specific header elements if needed */
  .header .header-title .btn-premium span {
    display: none; /* Hide text, show only icon if space is tight */
  }
  
  .header .header-title .badge-premium span {
    font-size: 12px;
  }

  /* Adjust footer */
  .compact-footer {
    margin: 0 12px 100px 12px; /* Bottom margin for nav */
    border-radius: 16px;
  }
  
  .footer-content {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  
  .footer-links {
    flex-wrap: wrap;
  }
}

/* =========================================
   Mobile Navigation Island (Bottom)
   ========================================= */
@media (max-width: 768px) {
  .mobile-nav {
    display: flex !important; /* Override display: none from main css if present */
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1100;
    
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    
    padding: 6px;
    border-radius: 24px;
    gap: 8px;
    align-items: center;
    width: auto;
    max-width: calc(100% - 32px);
  }

  /* Dark mode for nav */
  .theme-dark .mobile-nav {
    background: rgba(15, 23, 42, 0.85);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  }

  .mobile-nav-items {
    display: flex;
    align-items: center;
    gap: 4px;
  }

  .mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 56px;
    border-radius: 18px;
    color: var(--muted);
    text-decoration: none;
    transition: all 0.2s ease;
    background: transparent;
    border: none;
    cursor: pointer;
  }

  .mobile-nav-item i {
    font-size: 20px;
    margin-bottom: 4px;
    transition: transform 0.2s ease;
  }

  .mobile-nav-item span {
    font-size: 10px;
    font-weight: 500;
    line-height: 1;
  }

  /* Active State */
  .mobile-nav-item.active {
    background: #fff;
    color: var(--primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  }
  
  .theme-dark .mobile-nav-item.active {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
  }

  .mobile-nav-item.active i {
    transform: translateY(-2px);
  }

  /* Secondary items hidden by default in the bar */
  .mobile-nav-item[data-tier="secondary"] {
    display: none;
  }

  /* "More" button */
  .mobile-nav-more {
    background: rgba(0, 0, 0, 0.03);
  }
  
  .theme-dark .mobile-nav-more {
    background: rgba(255, 255, 255, 0.05);
  }

  /* =========================================
     Expanded Menu Panel
     ========================================= */
  .mobile-nav-panel {
    display: none; /* Hidden by default */
    position: absolute;
    bottom: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%) scale(0.95);
    width: calc(100vw - 32px);
    max-width: 400px;
    max-height: 70vh;
    overflow-y: auto;
    
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    
    padding: 16px;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1090;
  }

  .theme-dark .mobile-nav-panel {
    background: rgba(15, 23, 42, 0.95);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  }

  /* State when open */
  .mobile-nav.expanded .mobile-nav-panel {
    display: block;
    opacity: 1;
    transform: translateX(-50%) scale(1);
  }
  
  .mobile-nav.expanded .mobile-nav-more {
    background: var(--primary);
    color: #fff;
  }

  /* Groups in Panel */
  .mobile-group {
    margin-bottom: 16px;
  }
  
  .mobile-group:last-child {
    margin-bottom: 0;
  }

  .mobile-group-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
    color: var(--muted);
    margin-bottom: 10px;
    padding-left: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }
  
  .mobile-group-title i {
    font-size: 14px;
    opacity: 0.7;
  }

  .mobile-group-items {
    display: grid;
    grid-template-columns: 1fr 1fr; /* Two columns */
    gap: 8px;
  }

  .mobile-group-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 16px;
    color: var(--text);
    font-weight: 500;
    font-size: 14px;
    text-decoration: none;
    transition: background 0.2s;
  }
  
  .theme-dark .mobile-group-item {
    background: rgba(255, 255, 255, 0.03);
  }

  .mobile-group-item:hover {
    background: rgba(0, 0, 0, 0.05);
  }
  
  .theme-dark .mobile-group-item:hover {
    background: rgba(255, 255, 255, 0.08);
  }

  .mobile-group-item.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
  }

  .mobile-group-item i {
    font-size: 18px;
    width: 24px;
    text-align: center;
  }

  /* Scrim/Overlay behind panel */
  .mobile-nav-scrim {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(2px);
    z-index: 1080;
    opacity: 0;
    transition: opacity 0.3s;
  }

  .mobile-nav.expanded + .mobile-nav-scrim {
    display: block;
    opacity: 1;
  }
}

/* =========================================
   Dashboard Specific Mobile Styles
   ========================================= */
@media (max-width: 768px) {
  .dashboard-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }
  
  .welcome-banner {
    padding: 20px;
    background-image: none !important; /* Remove complex bg images on mobile if needed */
    text-align: center;
  }
  
  .welcome-banner h1 {
    font-size: 24px;
  }
  
  .stats-row {
    grid-template-columns: 1fr; /* Stack stats */
  }
  
  .news-card {
    margin-bottom: 16px;
  }
}
