/* ========================================
   MOBILE RESPONSIVE FIXES
   ======================================== */

/* ========================================
   MOBILE NAVIGATION BAR FIXES
   ======================================== */

/* Mobile: Keep navigation bar visible and compact */
@media (max-width: 768px) {
  /* Top app bar - transparent and floating on mobile */
  .top-app-bar {
    justify-content: space-between !important;
    padding: 16px !important;
    height: auto !important;
    background-color: transparent !important;
    box-shadow: none !important;
    pointer-events: none !important; /* Let clicks pass through empty space */
  }

  /* When scrolled - keep transparent */
  .top-app-bar.scrolled {
    top: 0 !important;
    background-color: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    height: auto !important;
    padding: 16px !important;
    box-shadow: none !important;
  }

  /* App bar start - contains the menu button */
  .app-bar-start {
    display: block !important;
    opacity: 1 !important;
    transform: none !important;
    pointer-events: auto !important;
    max-width: none !important;
    overflow: visible !important;
  }

  .top-app-bar.scrolled .app-bar-start {
    opacity: 1 !important;
    transform: none !important;
  }

  /* Mobile menu button - floating top left circular button */
  .nav-mobile-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 48px !important;
    height: 48px !important;
    background-color: rgba(255, 255, 255, 0.1) !important; /* Transparent white */
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    border-radius: 50% !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
    color: var(--md-sys-color-on-surface) !important;
  }
  
  /* Dark mode adjustment for glass effect */
  [data-theme="dark"] .nav-mobile-btn {
    background-color: rgba(0, 0, 0, 0.2) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
  }
  
  /* Ensure the icon inside is centered */
  .nav-mobile-btn .material-symbols-outlined {
    font-size: 24px !important;
  }

  /* Dock container - contains theme button */
  .dock-container {
    display: flex !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
    height: auto !important;
    pointer-events: auto !important;
    backdrop-filter: none !important;
  }

  .top-app-bar.scrolled .dock-container {
    display: flex !important;
    background: transparent !important;
    box-shadow: none !important;
    height: auto !important;
    padding: 0 !important;
    border-radius: 0 !important;
  }

  /* Hide desktop navigation inside dock */
  .nav-desktop {
    display: none !important;
  }

  /* Theme button - floating top right */
  #theme-toggle {
    display: flex !important;
    width: 48px !important;
    height: 48px !important;
    min-width: 48px !important;
    background-color: rgba(255, 255, 255, 0.1) !important; /* Transparent white */
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    border-radius: 50% !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
    align-items: center;
    justify-content: center;
    color: var(--md-sys-color-on-surface) !important;
  }

  /* Dark mode adjustment for glass effect */
  [data-theme="dark"] #theme-toggle {
    background-color: rgba(0, 0, 0, 0.2) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
  }

  /* Navigation drawer - Floating glass effect */
  .nav-drawer {
    position: fixed;
    top: 16px !important; /* Spacing from top */
    left: 16px !important; /* Spacing from left */
    bottom: auto !important; /* Remove bottom constraint */
    width: fit-content !important; /* Width fits content */
    min-width: auto !important; /* Remove min-width constraint */
    max-width: calc(100vw - 32px) !important; /* Prevent overflow */
    height: auto !important; /* Auto height to fit content */
    
    /* Glass morphism effect like desktop collapsed menu */
    background-color: rgba(255, 255, 255, 0.1) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    
    /* Rounded corners */
    border-radius: 24px !important;
    
    /* Shadow for depth */
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12) !important;
    
    /* Padding to fit content */
    padding: 16px !important;
    
    /* Transform for slide-in animation */
    transform: translateX(-120%) !important;
    transition: transform 0.3s var(--md-sys-motion-easing-emphasized) !important;
    
    z-index: 1100;
  }
  
  /* Transparent overlay - no darkening effect */
  .drawer-overlay {
    background: transparent !important; /* Fully transparent, no darkening */
    opacity: 0 !important; /* Hidden by default */
    pointer-events: none !important; /* Not clickable when closed */
  }
  
  /* When menu is open, make overlay visible and clickable */
  .drawer-overlay.open {
    opacity: 1 !important; /* Show overlay (but still transparent) */
    pointer-events: auto !important; /* Enable clicking to close menu */
  }
  
  /* Dark mode adjustment for glass effect */
  [data-theme="dark"] .nav-drawer {
    background-color: rgba(0, 0, 0, 0.3) !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3) !important;
  }
  
  /* Open state */
  .nav-drawer.open {
    transform: translateX(0) !important;
  }

  /* Drawer links - compact and modern */
  .drawer-link {
    display: block !important;
    padding: 12px 20px !important; /* Increased horizontal padding for better spacing */
    font-size: 14px !important;
    font-weight: 500 !important;
    color: var(--md-sys-color-on-surface) !important;
    text-decoration: none !important;
    border-radius: 16px !important;
    margin-bottom: 4px !important;
    transition: all 0.2s var(--md-sys-motion-easing-standard) !important;
    white-space: nowrap !important; /* Prevent text wrapping */
    width: 100% !important; /* Full width of container */
    
    /* Subtle background on items */
    background-color: rgba(255, 255, 255, 0.05) !important;
  }
  
  /* Dark mode drawer link */
  [data-theme="dark"] .drawer-link {
    background-color: rgba(0, 0, 0, 0.1) !important;
  }
  
  /* Last link - no margin */
  .drawer-link:last-child {
    margin-bottom: 0 !important;
  }
  
  /* Hover and active states */
  .drawer-link:hover {
    background-color: rgba(255, 255, 255, 0.15) !important;
    transform: translateX(4px) !important;
  }
  
  [data-theme="dark"] .drawer-link:hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
  }
  
  .drawer-link.active {
    background-color: var(--md-sys-color-primary-container) !important;
    color: var(--md-sys-color-on-primary-container) !important;
  }
}

/* Mobile: 320px - 480px (Small phones) */
@media (max-width: 480px) {
  /* General spacing fixes */
  .section {
    padding: 60px 16px 40px;
  }

  /* Hero section */
  .hero {
    min-height: 100vh !important;
    min-height: 100dvh !important;
    padding: 0 16px !important; /* Remove top padding to center vertically */
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .hero-title {
    font-size: 36px !important;
    line-height: 1.2 !important;
  }

  .hero-subtitle {
    font-size: 18px !important;
  }

  .hero-desc {
    font-size: 14px !important;
  }

  /* About section - Bento grid */
  .about-bento-grid {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  .bento-card {
    padding: 20px !important;
  }

  .profile-3d-container {
    max-width: 180px !important;
  }

  .avatar-3d {
    width: 100% !important;
  }

  .profile-name-gradient {
    font-size: 24px !important;
  }

  .profile-actions-modern {
    flex-direction: column !important;
    width: 100%;
  }

  .profile-actions-modern .md3-btn {
    width: 100% !important;
  }

  /* Skills cloud */
  .skills-cloud-modern {
    gap: 8px !important;
  }

  .skill-tag-modern {
    padding: 6px 12px !important;
    font-size: 11px !important;
  }

  /* Interests grid */
  .interests-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }

  .interest-item {
    padding: 12px 8px !important;
  }

  .interest-item .material-symbols-outlined {
    font-size: 24px !important;
  }

  .interest-item span:last-child {
    font-size: 11px !important;
  }

  /* Skills carousel */
  .skills-carousel-wrapper {
    height: 380px !important;
  }

  .skill-card {
    width: 280px !important;
    padding: 24px !important;
  }

  .nav-btn {
    width: 48px !important;
    height: 48px !important;
    min-width: 48px !important;
  }

  /* Projects */
  .project-gallery {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
    padding: 0 !important;
  }

  .project-card {
    margin: 0 !important;
  }

  .project-image-container {
    height: 180px !important;
  }

  .project-content {
    padding: 20px !important;
  }

  .project-tags {
    gap: 6px !important;
  }

  .project-tags span {
    font-size: 11px !important;
    padding: 3px 8px !important;
  }

  /* Blog */
  .blog-grid-modern {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
    padding: 0 !important;
  }

  .blog-card-header {
    height: 140px !important;
  }

  .blog-card-content {
    padding: 20px !important;
  }

  .blog-card-title {
    font-size: 20px !important;
  }

  /* Gallery */
  .gallery-grid-staggered {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  .gallery-item {
    margin-top: 0 !important;
  }

  /* Contact */
  .contact-grid-modern {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  .contact-card {
    padding: 16px !important;
  }

  .social-dock {
    gap: 12px !important;
  }

  .social-icon-btn {
    width: 48px !important;
    height: 48px !important;
  }

  /* Quote text - reduce indent on mobile */
  .quote-text {
    text-indent: 1.5em !important;
    font-size: 14px !important;
  }

  /* Profile tagline */
  .profile-tagline {
    font-size: 13px !important;
    padding: 0 8px;
  }
}

/* Tablet: 481px - 768px */
@media (min-width: 481px) and (max-width: 768px) {
  .section {
    padding: 80px 24px 60px;
  }

  /* About bento grid - 2 columns on tablet */
  .about-bento-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .bento-profile-main {
    grid-column: span 2 !important;
  }

  /* Projects - 2 columns on tablet */
  .project-gallery {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* Blog - 2 columns on tablet */
  .blog-grid-modern {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* Gallery - 2 columns on tablet */
  .gallery-grid-staggered {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* Prevent horizontal scroll */
* {
  max-width: 100%;
}

body {
  overflow-x: hidden !important;
}

/* Fix any overflowing containers */
.container,
.section,
.hero,
.about-bento-grid,
.project-gallery,
.blog-grid-modern,
.gallery-grid-staggered {
  overflow-x: hidden !important;
}

/* Ensure images don't overflow */
img {
  max-width: 100%;
  height: auto;
}

/* Fix long text overflow */
.project-content h3,
.blog-card-title,
.contact-value {
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}
