/* Responsive Styles for Portfolio Website */

/* General responsive adjustments */
@media (max-width: 1200px) {
  .container {
    padding: 0 2rem;
  }
}

/* Tablet and smaller devices */
@media (max-width: 1024px) {
  /* Fix sidebar navigation */
  body {
    padding-left: 0;
  }

  .side-section {
    transform: translateX(-100%);
    transition: transform 0.4s ease;
    z-index: 1010;
    width: 250px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
  }

  .side-section.active {
    transform: translateX(0);
  }

  .mobile-menu-toggle {
    display: flex !important;
    z-index: 1020;
  }

  /* Add overlay when mobile menu is open */
  .menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1005;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
  }

  .menu-overlay.active {
    opacity: 1;
    visibility: visible;
  }

  section {
    padding: 5rem 0;
  }

  /* Adjust hero content for better spacing */
  .hero-content {
    text-align: center;
    margin: 0 auto;
  }

  .hero-cta {
    justify-content: center;
  }

  /* Adjust section spacing */
  .section-title {
    margin-bottom: 3rem;
  }
}

/* Medium devices (tablets) */
@media (max-width: 900px) {
  :root {
    --font-size-3xl: 2.75rem;
    --font-size-2xl: 1.85rem;
    --font-size-xl: 1.35rem;
  }

  /* Stack about content */
  .about-content {
    grid-template-columns: 1fr;
    gap: 3rem;
  }

  .about-image {
    order: -1; /* Move image above text on mobile */
    max-width: 350px;
    margin: 0 auto;
  }

  /* Adjust skills grid */
  .skills-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }

  /* Project grid adjustments */
  .project-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  }

  /* Footer adjustments */
  .footer-content {
    grid-template-columns: 1fr;
    gap: 3rem;
  }

  .footer-links {
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
  }

  /* Certificate grid adjustment */
  .certificate-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
}

/* Small devices (landscape phones) */
@media (max-width: 768px) {
  :root {
    --font-size-3xl: 2.5rem;
    --font-size-2xl: 1.75rem;
  }

  .container {
    padding: 0 1.5rem;
  }

  section {
    padding: 4rem 0;
  }

  /* Adjust hero content */
  .hero h1 {
    font-size: 2.5rem;
  }

  .subtitle {
    font-size: 1.25rem;
  }

  /* Projects grid single column on mobile */
  .project-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  /* Skills grid adjustments */
  .skills-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    max-width: 500px;
    margin: 0 auto;
  }
  
  .skill-category {
    width: 100%;
    margin: 0 auto;
  }

  /* Contact section adjustments */
  .contact-content {
    padding: 2rem;
  }

  .contact-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  /* Timeline adjustments */
  .timeline::before {
    left: 1rem;
  }

  .timeline-item {
    padding-left: 3rem;
  }

  .timeline-item::after {
    left: 0.5rem;
  }
  
  /* Education adjustments */
  .education-container {
    max-width: 500px;
    margin: 0 auto;
  }

  .education-item {
    flex-direction: column;
    padding: 1.75rem;
  }
  
  .education-icon {
    margin: 0 auto 1.5rem;
  }
  
  .education-content {
    text-align: center;
  }
  
  .education-extra {
    text-align: center;
  }
}

/* Extra small devices (phones) */
@media (max-width: 576px) {
  :root {
    --font-size-3xl: 2.2rem;
    --font-size-2xl: 1.65rem;
    --font-size-xl: 1.25rem;
  }

  .container {
    padding: 0 1.25rem;
  }

  /* Stack hero buttons */
  .hero-cta {
    flex-direction: column;
    gap: 1rem;
    align-items: center;
  }
  
  .cta-button, .secondary-button {
    width: 100%;
    justify-content: center;
  }

  /* Contact item adjustments */
  .contact-item {
    flex-direction: column;
    text-align: center;
    gap: 0.75rem;
  }

  /* Timeline further adjustments */
  .timeline-content {
    padding: 1.5rem;
  }

  /* Certificate grid adjustment for smallest screens */
  .certificate-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin: 0 auto;
    max-width: 500px; /* Control max width to ensure better centering */
  }
  
  .certificate-item {
    margin: 0 auto;
    width: 100%;
  }
  
  @media (max-width: 400px) {
    .certificate-grid {
      grid-template-columns: 1fr;
      max-width: 280px;
    }
    
    .certificate-item {
      padding: 1rem;
    }
    
    .education-extra h3 {
      font-size: 1.25rem;
      margin-bottom: 1.5rem;
    }
  }

  /* Footer adjustments */
  .footer-links {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  
  /* Social links adjustments */
  .social-links {
    justify-content: center;
    flex-wrap: wrap;
  }
}

/* Fix sidebar navigation for mobile devices */
@media (max-width: 1024px) {
  /* Mobile menu toggle button */
  .mobile-menu-toggle {
    position: fixed;
    top: 1rem;
    right: 1rem;
    width: 50px;
    height: 50px;
    background: var(--secondary);
    border-radius: 50%;
    display: flex !important; /* Ensure it's always displayed on mobile */
    align-items: center;
    justify-content: center;
    color: white;
    font-size: var(--font-size-large);
    cursor: pointer;
    z-index: 1020;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  }
  
  /* Improved sidebar styling */
  .side-section {
    padding: 2rem 1.5rem;
    overflow-y: auto;
  }
  
  .side-section .profile-sidebar {
    margin-bottom: 2rem;
  }
  
  .side-nav-links a {
    padding: 0.8rem 1rem;
    margin-bottom: 0.5rem;
    font-size: 1rem;
  }
}

/* Fix the back to top button positioning */
@media (max-width: 768px) {
  .back-to-top {
    bottom: 1rem;
    right: 1rem;
    width: 45px;
    height: 45px;
  }
  
  /* Project cards improvements for mobile */
  .project-image {
    height: 200px; /* Slightly taller images on mobile */
  }
  
  .project-card {
    margin-bottom: 1.5rem;
  }
  
  /* Timeline improvements */
  .timeline-content {
    padding: 1.5rem;
  }
  
  /* Contact section adjustments */
  .contact-info-centered {
    text-align: center;
  }
  
  .contact-item {
    flex-direction: column;
    margin-bottom: 2rem;
  }
  
  /* Fix hero spacing on mobile */
  .hero {
    padding-top: 5rem;
    min-height: auto;
    height: 100vh;
    justify-content: center;
  }
  
  .hero-content {
    width: 100%;
    max-width: 100%;
    padding: 0 1rem;
  }
  
  .hero h1 {
    font-size: 2rem;
    margin-bottom: 1rem;
  }
  
  .subtitle {
    font-size: 1.1rem;
    margin-bottom: 2rem;
  }
}
