/* Responsive styles for Gaurab Lohani's portfolio website */

/* Better mobile margins for all sections */
@media (max-width: 576px) {
  .container {
    padding-left: 20px;
    padding-right: 20px;
  }
  
  .hero-content {
    margin-top: 20px;
    margin-bottom: 20px;
  }
  
  .section {
    padding: 60px 0;
  }
  
  .hero-section {
    padding-top: 80px;
  }
  
  .hero-name {
    font-size: 2.5rem;
  }
  
  .hero-title {
    font-size: 1.5rem;
  }
  
  .hero-description {
    font-size: 1rem;
    margin-bottom: 1.5rem;
  }
  
  .hero-buttons {
    flex-wrap: wrap;
    gap: 10px;
  }
  
  .btn {
    width: 100%;
    margin-bottom: 10px;
    justify-content: center;
  }
  
  .social-links {
    margin-top: 1rem;
    justify-content: center;
  }
  
  .profile-img {
    margin: 0 auto;
  }
  
  .floating-elements {
    display: none; /* Hide floating elements on mobile for cleaner interface */
  }
}

/* Tablet optimizations */
@media (min-width: 577px) and (max-width: 991px) {
  .hero-content {
    padding-top: 30px;
    text-align: center;
  }
  
  .profile-img {
    max-width: 70%;
    margin: 0 auto;
  }
  
  .hero-section .row {
    min-height: 85vh !important;
  }
  
  .floating-card {
    transform: scale(0.8);
  }
}

/* Enhanced loader with network detection */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh; /* Fallback */
  height: calc(var(--vh, 1vh) * 100); /* Use custom vh variable for mobile browsers */
  background-color: var(--bg-primary);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s ease;
  overflow: hidden; /* Prevent scrolling when loader is visible */
}

.loading-overlay.fade-out {
  opacity: 0;
  pointer-events: none;
}

/* Ensure body doesn't scroll when loading */
body:not(.loaded) {
  overflow: hidden !important;
  height: 100vh;
  position: fixed;
  width: 100%;
}

.loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  max-width: 80%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 20px;
}

.loading-logo {
  animation: pulse 2s infinite ease-in-out;
}

.loading-text {
  text-align: center;
}

.loading-text h3 {
  margin: 0;
  font-size: 1.5rem;
  color: var(--text-primary);
}

.loading-text p {
  margin: 0.5rem 0 0;
  color: var(--text-secondary);
}

.loading-progress {
  width: 300px;
  max-width: 80vw;
  height: 6px;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
}

.loading-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #1d4ed8);
  border-radius: 10px;
  transition: width 0.4s ease;
  width: 0%;
}

.loading-dots {
  display: flex;
  gap: 8px;
}

.loading-dot {
  width: 8px;
  height: 8px;
  background-color: var(--accent-color);
  border-radius: 50%;
  animation: dotPulse 1.4s infinite ease-in-out;
}

.loading-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.loading-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes dotPulse {
  0%, 100% {
    transform: scale(0.5);
    opacity: 0.5;
  }
  50% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Mobile-specific loading overlay improvements */
@media (max-width: 576px) {
  .loading-content {
    max-width: 90%;
    padding: 15px;
  }
  
  .loading-text h3 {
    font-size: 1.3rem;
  }
  
  .loading-progress {
    max-width: 85vw;
    width: 250px;
  }
}

/* Fix for iOS devices */
@supports (-webkit-touch-callout: none) {
  .loading-overlay {
    height: -webkit-fill-available;
  }
  
  body:not(.loaded) {
    height: -webkit-fill-available;
  }
}

/* Fix theme toggle button positioning on mobile */
@media (max-width: 991px) {
  .theme-toggle {
    margin-top: 10px;
    margin-bottom: 10px;
  }
}

/* Fix navbar behavior on mobile */
@media (max-width: 991px) {
  .navbar-collapse {
    background-color: var(--bg-secondary);
    padding: 15px;
    border-radius: 12px;
    margin-top: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  }
  
  .navbar-nav {
    text-align: center;
  }
  
  .nav-link {
    padding: 12px 0 !important;
  }
}

/* Improve scrolling behavior */
html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px; /* Adjusted for fixed navbar height */
}

/* Improve footer on mobile */
@media (max-width: 576px) {
  .footer-content {
    flex-direction: column;
    text-align: center;
  }
  
  .footer-links {
    margin-top: 15px;
    justify-content: center;
  }
}
