/* ========== BASIC SETUP ========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box; /* CRITICAL: Prevents overflow */
}

body {
  font-family: 'Poppins', sans-serif;
  scroll-behavior: smooth;
  overflow-x: hidden; /* Prevent horizontal scroll */
  max-width: 100vw; /* Never exceed viewport width */
}

/* ========== NAVBAR ========== */
header {
  background: #111;
  position: sticky;
  top: 0;
  z-index: 1000;
  width: 100%; /* Full width */
}

.navbar-brand {
  font-weight: 700;
  color: white !important;
  transition: color 0.3s;
}

.navbar-brand:hover {
  color: #0dcaf0 !important;
}

.navbar-nav .nav-link {
  color: white !important;
  margin: 0 10px;
  transition: color 0.3s;
}

.navbar-nav .nav-link:hover {
  color: #0dcaf0 !important;
}

/* ========== HOME SECTION ========== */
.hero {
  min-height: 100vh;
  background: linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)), url(src/portfoliomain.jpg) center/cover;
  color: white;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 40px 20px;
  width: 100%; /* FIXED: Ensure full width */
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.5rem); /* FIXED: Responsive font sizing */
  margin-bottom: 1rem;
}

.hero p {
  font-size: clamp(1rem, 2.5vw, 1.25rem); /* FIXED: Responsive text */
  max-width: 700px; /* FIXED: Prevent text from being too wide */
  margin: 0 auto 2rem;
}

.hero .btn {
  transition: transform 0.3s, box-shadow 0.3s;
}

.hero .btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 20px rgba(13, 202, 240, 0.4);
}

/* ========== ABOUT SECTION ========== */
#about {
  padding: 80px 20px;
  background: #f8f9fa;
  width: 100%; /* FIXED */
}

#about img {
  width: 100%;
  max-width: 400px;
  height: auto; /* FIXED: Maintain aspect ratio */
  border-radius: 15px;
  display: block; /* FIXED: Remove inline spacing */
  margin: 0 auto; /* FIXED: Center on mobile */
}

#about h2 {
  font-size: clamp(1.75rem, 4vw, 2.5rem); /* FIXED: Responsive */
}

#about p {
  font-size: clamp(0.95rem, 2vw, 1.1rem); /* FIXED: Responsive */
}

/* ========== SKILLS SECTION ========== */
#skills {
  width: 100%; /* FIXED */
  padding: 80px 20px;
}

#skills img {
  width: 80px;
  height: 80px; /* FIXED: Set height */
  object-fit: contain; /* FIXED: Maintain aspect ratio */
  max-width: 100%; /* FIXED: Never exceed container */
}

#skills h5 {
  margin-top: 10px;
  font-size: clamp(0.9rem, 2vw, 1.1rem); /* FIXED: Responsive */
}

/* ========== PROJECTS SECTION ========== */
#projects {
  width: 100%; /* FIXED */
  padding: 80px 20px;
}

#projects .card {
  transition: transform 0.3s, box-shadow 0.3s;
  height: 100%; /* FIXED: Equal card heights */
  display: flex;
  flex-direction: column;
}

#projects .card-img-top {
  width: 100%;
  height: 200px; /* FIXED: Consistent image height */
  object-fit: cover; /* FIXED: Crop images properly */
}

#projects .card-body {
  flex-grow: 1; /* FIXED: Push content down evenly */
}

#projects .card:hover {
  transform: translateY(-10px);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
}

/* ========== SERVICES SECTION ========== */
#services {
  width: 100%; /* FIXED */
  padding: 80px 20px;
}

/* ========== CONTACT SECTION ========== */
#contact {
  padding: 80px 20px;
  background: #111;
  color: white;
  width: 100%; /* FIXED */
}

#contact .form-control {
  background: #222;
  border: 2px solid #333;
  color: white;
  padding: 12px;
  width: 100%; /* FIXED: Ensure full width in container */
}

#contact .form-control:focus {
  border-color: #0dcaf0;
  background: #2a2a2a;
  outline: none; /* FIXED: Remove default outline */
}

.error-msg {
  color: #ff6b6b;
  font-size: 0.875rem;
  margin-top: 5px;
}

.is-invalid {
  border-color: #ff6b6b !important;
}

#contact .btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 20px rgba(13, 202, 240, 0.4);
}

#contact a {
  color: white;
  text-decoration: none;
  transition: color 0.3s;
}

#contact a:hover {
  color: #0dcaf0;
}

/* ========== FOOTER ========== */
footer {
  width: 100%; /* FIXED */
}

/* ========== MOBILE FIXES ========== */
@media (max-width: 768px) {
  .hero {
    padding: 60px 15px; /* FIXED: Reduce padding */
    min-height: 80vh; /* FIXED: Shorter on mobile */
  }
  
  #about img {
    margin-bottom: 30px;
    max-width: 300px; /* FIXED: Smaller on mobile */
  }
  
  #about {
    padding: 60px 15px; /* FIXED: Reduce padding */
  }
  
  #skills img {
    width: 60px; /* FIXED: Smaller on mobile */
    height: 60px;
  }
  
  #projects .card-img-top {
    height: 180px; /* FIXED: Slightly shorter on mobile */
  }
  
  .container {
    padding-left: 15px; /* FIXED: Ensure proper padding */
    padding-right: 15px;
  }
}

@media (max-width: 576px) {
  .hero h1 {
    font-size: 1.75rem; /* FIXED: Even smaller on very small screens */
  }
  
  .hero p {
    font-size: 0.95rem;
  }
  
  #skills .col-6 {
    padding: 10px; /* FIXED: Reduce spacing */
  }
}