/**
* Modern Developer Portfolio - Dark Theme
* FINAL RESPONSIVE FIX (Services & Contact Layouts)
*/

:root {
  --bg-color: #0a192f;
  --light-bg: #112240;
  --text-main: #ccd6f6;
  --text-secondary: #8892b0;
  --accent: #64ffda;
  --highlight: #149ddd;
  --white: #e6f1ff;
  --font-primary: "Open Sans", sans-serif;
  --font-heading: "Raleway", sans-serif;
  --font-mono: "Fira Code", monospace;
}

/*--------------------------------------------------------------
# General
--------------------------------------------------------------*/
body {
  font-family: var(--font-primary);
  color: var(--text-secondary);
  background-color: var(--bg-color);
  overflow-x: hidden;
}

a {
  color: var(--highlight);
  text-decoration: none;
  transition: all 0.3s;
}

a:hover {
  color: var(--accent);
  text-decoration: none;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--white);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 10px;
}
::-webkit-scrollbar-track {
    background: var(--bg-color);
}
::-webkit-scrollbar-thumb {
    background: var(--light-bg);
    border: 1px solid var(--text-secondary);
    border-radius: 5px;
}

/*--------------------------------------------------------------
# Header & Sidebar
--------------------------------------------------------------*/
#header {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 300px;
  transition: all ease-in-out 0.5s;
  z-index: 9997;
  padding: 0 15px;
  background: var(--light-bg);
  overflow-y: auto;
  border-right: 1px solid rgba(255,255,255,0.05);
}

/* --- NEW Profile Image Flip Effect --- */
.profile-flip-container {
  margin: 15px auto;
  width: 128px; /* Total width including borders */
  height: 128px;
  perspective: 1000px; /* Creates the 3D space */
}

.profile-flipper {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 0 auto;
  /* Smooth, slightly bouncy transition */
  transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
  transform-style: preserve-3d;
}

/* Trigger the flip on hover */
.profile-flip-container:hover .profile-flipper {
  transform: rotateY(180deg);
}

.profile-front, .profile-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden; /* Hides the back when facing away */
  border-radius: 50%;
}

/* Styling for both images */
.profile-front img, .profile-back img {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border: 4px solid var(--light-bg);
  box-shadow: 0 0 0 2px var(--highlight); 
  border-radius: 50%;
  display: block;
}

/* Initially rotate the back image */
.profile-back {
  transform: rotateY(180deg);
}
/* --------------------------------- */

#header .profile h1 {
  font-size: 24px;
  margin: 0;
  padding: 0;
  font-weight: 600;
  text-align-last: center;
  font-family: var(--font-heading);
}

#header .profile h1 a,
#header .profile h1 a:hover {
  color: var(--white);
  text-decoration: none;
}

#header .profile .social-links a {
  font-size: 18px;
  display: inline-block;
  background: var(--bg-color);
  color: var(--white);
  line-height: 1;
  padding: 8px 0;
  margin-right: 4px;
  border-radius: 50%;
  text-align: center;
  width: 36px;
  height: 36px;
  transition: 0.3s;
}

#header .profile .social-links a:hover {
  background: var(--highlight);
  color: #fff;
  text-decoration: none;
}

/* DESKTOP LAYOUT (Screens larger than 991px) */
@media (min-width: 992px) {
  #header {
    left: 0;
  }
  #main {
    margin-left: 300px;
  }
}

/* TABLET & MOBILE LAYOUT (Screens 991px and smaller) */
@media (max-width: 991px) {
  #header {
    left: -300px;
  }
  #main {
    margin-left: 0;
  }
}

/*--------------------------------------------------------------
# Navigation Menu
--------------------------------------------------------------*/
.nav-menu {
  padding: 30px 0 0 0;
}
.nav-menu * {
  margin: 0;
  padding: 0;
  list-style: none;
}
.nav-menu > ul > li {
  position: relative;
  white-space: nowrap;
}
.nav-menu a, .nav-menu a:focus {
  display: flex;
  align-items: center;
  color: var(--text-secondary);
  padding: 12px 15px;
  margin-bottom: 8px;
  transition: 0.3s;
  font-size: 15px;
  border-radius: 4px;
}
.nav-menu a i, .nav-menu a:focus i {
  font-size: 24px;
  padding-right: 8px;
  color: var(--text-secondary);
}
.nav-menu a:hover, .nav-menu .active, .nav-menu .active:focus, .nav-menu li:hover > a {
  text-decoration: none;
  color: var(--white);
  background: rgba(100, 255, 218, 0.1);
}
.nav-menu a:hover i, .nav-menu .active i, .nav-menu .active:focus i, .nav-menu li:hover > a i {
  color: var(--accent);
}

/* Mobile Nav Toggle Button */
.mobile-nav-toggle {
  position: fixed;
  right: 15px;
  top: 15px;
  z-index: 9998;
  border: 0;
  font-size: 24px;
  transition: all 0.4s;
  outline: none !important;
  background-color: var(--highlight);
  color: #fff;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  border-radius: 50%;
  cursor: pointer;
}

.mobile-nav-active {
  overflow: hidden;
}
.mobile-nav-active #header {
  left: 0;
}

/*--------------------------------------------------------------
# Hero Section
--------------------------------------------------------------*/
#hero {
  width: 100%;
  height: 100vh;
  background: var(--bg-color); 
  background-image: radial-gradient(at 0% 0%, hsla(212,33%,26%,1) 0, transparent 50%), radial-gradient(at 100% 100%, hsla(202,33%,26%,1) 0, transparent 50%);
  position: relative;
}

/* HERO DESKTOP ADJUSTMENT */
@media (min-width: 992px) {
  #hero {
    margin-left: 300px;
    width: calc(100% - 300px);
  }
}

#hero .hero-container {
  position: relative;
  z-index: 2;
  min-width: 300px;
  padding: 0 50px;
}

#hero h1 {
  margin: 0 0 10px 0;
  font-size: 64px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--white);
}

#hero p {
  color: var(--text-secondary);
  margin-bottom: 30px;
  font-size: 24px;
  font-family: var(--font-mono);
}

#hero p span {
  color: var(--accent);
  border-bottom: 2px solid var(--accent);
  padding-bottom: 2px;
}

/* HERO MOBILE ADJUSTMENT */
@media (max-width: 768px) {
  #hero h1 {
    font-size: 36px;
    line-height: 1.2;
  }
  #hero p {
    font-size: 18px;
    line-height: 24px;
    margin-bottom: 30px;
  }
  #hero .hero-container {
      padding: 0 20px;
  }
}

@media (max-width: 450px) {
  #hero h1 {
    font-size: 28px; 
  }
}

/*--------------------------------------------------------------
# Sections General
--------------------------------------------------------------*/
section {
  padding: 60px 0;
  overflow: hidden;
}

.section-bg {
  background: var(--light-bg);
}

.section-title {
  padding-bottom: 30px;
}

.section-title h2 {
  font-size: 32px;
  font-weight: bold;
  margin-bottom: 20px;
  padding-bottom: 20px;
  position: relative;
  color: var(--white);
}

.section-title h2::after {
  content: "";
  position: absolute;
  display: block;
  width: 50px;
  height: 3px;
  background: var(--highlight);
  bottom: 0;
  left: 0;
}

.section-title p {
  margin-bottom: 0;
  color: var(--text-secondary);
}

/*--------------------------------------------------------------
# About
--------------------------------------------------------------*/
.about .content h3 {
  font-weight: 700;
  font-size: 26px;
  color: var(--accent);
  margin-bottom: 20px;
}

.about .content ul {
  list-style: none;
  padding: 0;
}

.about .content ul li {
  margin-bottom: 20px;
  display: flex;
  align-items: center;
}

.about .content ul strong {
  margin-right: 10px;
  color: var(--white);
}

.about .content ul i {
  font-size: 20px;
  margin-right: 5px;
  color: var(--accent);
  line-height: 0;
}

/*--------------------------------------------------------------
# Facts
--------------------------------------------------------------*/
.facts .count-box {
  padding: 30px;
  width: 100%;
  background: var(--light-bg);
  border-radius: 8px;
  box-shadow: 0 10px 30px -10px rgba(2,12,27,0.7);
  border: 1px solid rgba(255,255,255,0.05);
}

.facts .count-box i {
  display: block;
  font-size: 44px;
  color: var(--highlight);
  float: left;
  line-height: 0;
}

.facts .count-box span {
  font-size: 48px;
  line-height: 40px;
  display: block;
  font-weight: 700;
  color: var(--white);
  margin-left: 60px;
}

.facts .count-box p {
  padding: 15px 0 0 0;
  margin: 0 0 0 60px;
  font-family: var(--font-heading);
  font-size: 14px;
  color: var(--text-secondary);
}

/*--------------------------------------------------------------
# Skills
--------------------------------------------------------------*/
.skill-category-title {
    color: var(--white);
    border-bottom: 2px solid var(--highlight);
    display: inline-block;
    padding-bottom: 5px;
    margin-bottom: 20px;
}

.skill-tag-container {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 30px;
}

.skill-tag {
    background: rgba(20, 157, 221, 0.1);
    color: var(--highlight);
    border: 1px solid var(--highlight);
    padding: 10px 20px;
    border-radius: 50px;
    font-family: var(--font-mono);
    font-size: 14px;
    transition: 0.3s;
    cursor: default;
}
.skill-tag:hover {
    background: var(--highlight);
    color: #fff;
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(20, 157, 221, 0.3);
}

/*--------------------------------------------------------------
# Resume
--------------------------------------------------------------*/
.resume .resume-title {
  font-size: 26px;
  font-weight: 700;
  margin-top: 20px;
  margin-bottom: 20px;
  color: var(--white);
}

.resume .resume-item {
  padding: 0 0 20px 20px;
  margin-top: -2px;
  border-left: 2px solid var(--highlight);
  position: relative;
}

.resume .resume-item h4 {
  line-height: 18px;
  font-size: 18px;
  font-weight: 600;
  text-transform: uppercase;
  font-family: var(--font-heading);
  color: var(--accent);
  margin-bottom: 10px;
}

.resume .resume-item h5 {
  font-size: 16px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--white);
  padding: 5px 15px;
  display: inline-block;
  font-weight: 600;
  margin-bottom: 10px;
  border-radius: 4px;
}

.resume .resume-item em {
  font-style: italic;
  margin-bottom: 10px;
  display: block;
  color: var(--text-secondary);
}

.resume .resume-item ul {
  padding-left: 20px;
}

.resume .resume-item ul li {
  padding-bottom: 10px;
  color: var(--text-secondary);
}

.resume .resume-item::before {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50px;
  left: -9px;
  top: 0;
  background: var(--bg-color);
  border: 2px solid var(--highlight);
}

/*--------------------------------------------------------------
# Portfolio
--------------------------------------------------------------*/
.portfolio .portfolio-item {
  margin-bottom: 30px;
}

.portfolio #portfolio-flters {
  padding: 0;
  margin: 0 auto 35px auto;
  list-style: none;
  text-align: center;
  background: var(--light-bg);
  border-radius: 50px;
  padding: 10px 15px;
  display: inline-block;
}

.portfolio #portfolio-flters li {
  cursor: pointer;
  display: inline-block; 
  padding: 10px 15px 8px 15px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 5px;
  transition: all 0.3s ease-in-out;
}

.portfolio #portfolio-flters li:hover,
.portfolio #portfolio-flters li.filter-active {
  color: var(--highlight);
}

.portfolio #portfolio-flters li:last-child {
  margin-right: 0;
}

.portfolio .portfolio-wrap {
  transition: 0.3s;
  position: relative;
  overflow: hidden;
  z-index: 1;
  border-radius: 8px;
}

.portfolio .portfolio-wrap::before {
  content: "";
  background: rgba(10, 25, 47, 0.85);
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  transition: all ease-in-out 0.3s;
  z-index: 2;
  opacity: 0;
}

.portfolio .portfolio-wrap .portfolio-links {
  opacity: 1;
  left: 0;
  right: 0;
  bottom: -60px;
  z-index: 3;
  position: absolute;
  transition: all ease-in-out 0.3s;
  display: flex;
  justify-content: center;
}

.portfolio .portfolio-wrap .portfolio-links a {
  color: #fff;
  font-size: 28px;
  text-align: center;
  background: rgba(20, 157, 221, 0.75);
  transition: 0.3s;
  width: 50%;
}

.portfolio .portfolio-wrap .portfolio-links a:hover {
  background: rgba(20, 157, 221, 0.95);
}

.portfolio .portfolio-wrap:hover::before {
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  opacity: 1;
}

.portfolio .portfolio-wrap:hover .portfolio-links {
  opacity: 1;
  bottom: 0;
}

/*--------------------------------------------------------------
# Services (FIXED with CSS Grid)
--------------------------------------------------------------*/
.services .icon-box {
  padding: 30px;
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  background: var(--light-bg);
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 0 10px 30px -15px rgba(2, 12, 27, 0.7);
  transition: all 0.3s ease-in-out;
  height: 100%;
  /* Use CSS Grid for robust layout */
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 20px;
  align-items: start;
}

.services .icon-box:hover {
  transform: translateY(-10px);
  border-color: var(--highlight);
}

.services .icon {
  width: 60px;
  height: 60px;
  background: transparent;
  border-radius: 50%;
  border: 1px solid var(--highlight);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: 0.3s;
  grid-row: span 2; /* Icon spans two rows */
}

.services .icon i {
    color: var(--highlight);
    font-size: 28px;
}

.services .icon-box:hover .icon {
    background: var(--highlight);
}
.services .icon-box:hover .icon i {
    color: var(--white);
}

.services .title {
  font-weight: 700;
  margin-bottom: 10px;
  font-size: 18px;
  align-self: center;
}

.services .title a {
  color: var(--white);
  text-decoration: none;
}
.services .title a:hover {
  color: var(--accent);
}

.services .description {
  color: var(--text-secondary);
  line-height: 24px;
  font-size: 14px;
  margin-bottom: 0;
}

/* Mobile layout for services */
@media (max-width: 575px) {
  .services .icon-box {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }
  .services .icon {
    grid-row: auto;
    margin-bottom: 15px;
  }
}

/*--------------------------------------------------------------
# Contact (FIXED with Flexbox)
--------------------------------------------------------------*/
.contact .info {
  padding: 30px;
  background: var(--light-bg);
  width: 100%;
  box-shadow: 0 10px 30px -10px rgba(2,12,27,0.7);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  height: 100%;
}

/* Use Flexbox for info items */
.contact .info .address,
.contact .info .email,
.contact .info .phone {
  display: flex;
  align-items: flex-start;
  margin-bottom: 30px;
}

.contact .info i {
  font-size: 20px;
  color: var(--highlight);
  width: 44px;
  height: 44px;
  background: rgba(20, 157, 221, 0.1);
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 50%;
  transition: all 0.3s ease-in-out;
  margin-right: 20px;
  flex-shrink: 0;
}

.contact .info h4 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 5px;
  color: var(--white);
}

.contact .info p {
  padding: 0;
  margin-bottom: 0;
  font-size: 14px;
  color: var(--text-secondary);
}

.contact .info .email:hover i, .contact .info .address:hover i, .contact .info .phone:hover i {
  background: var(--highlight);
  color: #fff;
}

.contact .info iframe {
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.1) !important;
}

.contact .php-email-form {
  width: 100%;
  padding: 30px;
  background: var(--light-bg);
  box-shadow: 0 10px 30px -10px rgba(2,12,27,0.7);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.contact .php-email-form .form-group {
  padding-bottom: 20px;
}

.contact .php-email-form label {
  padding-bottom: 8px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-mono);
}

.contact .php-email-form input, 
.contact .php-email-form textarea {
  border-radius: 4px;
  box-shadow: none;
  font-size: 15px;
  background: rgba(10, 25, 47, 0.7);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--white);
  transition: 0.3s;
}

.contact .php-email-form input:focus, 
.contact .php-email-form textarea:focus {
  border-color: var(--accent);
  background: rgba(10, 25, 47, 1);
  outline: none;
}

.contact .php-email-form input {
  height: 48px;
}

.contact .php-email-form textarea {
  padding: 12px 15px;
}

.contact .php-email-form button[type=submit] {
  background: transparent;
  border: 1px solid var(--highlight);
  padding: 12px 30px;
  color: var(--highlight);
  transition: 0.4s;
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--font-mono);
  font-weight: 600;
  display: block;
  margin-top: 10px;
}

.contact .php-email-form button[type=submit]:hover {
  background: rgba(20, 157, 221, 0.1);
  transform: translateY(-2px);
}

.contact .php-email-form .loading,
.contact .php-email-form .error-message,
.contact .php-email-form .sent-message {
  display: none; 
  font-weight: 600;
  padding: 15px;
  margin-bottom: 15px;
}

.contact .php-email-form .loading {
  background: var(--bg-color);
  text-align: center;
  color: var(--text-secondary);
}

.contact .php-email-form .error-message {
  color: #fff;
  background: #ed3c0d;
  text-align: left;
}

.contact .php-email-form .sent-message {
  color: #fff;
  background: #18d26e;
  text-align: center;
}

/* Adjust padding for smaller screens in Contact section */
@media (max-width: 575px) {
  .contact .info, .contact .php-email-form {
    padding: 20px;
  }
  .contact .info .address,
  .contact .info .email,
  .contact .info .phone {
    margin-bottom: 20px;
  }
}

/*--------------------------------------------------------------
# Footer
--------------------------------------------------------------*/
#footer {
  padding: 15px;
  color: var(--text-secondary);
  font-size: 14px;
  position: fixed;
  left: 0;
  bottom: 0;
  width: 300px;
  z-index: 9999;
  background: var(--light-bg);
  border-top: 1px solid rgba(255,255,255,0.05);
}

/* FOOTER RESPONSIVENESS */
@media (max-width: 991px) {
  #footer {
    position: static;
    width: auto;
    padding-right: 20px 15px;
  }
}

/* --- FINAL FIXES FOR IMAGE & STATS OVERFLOW --- */

/* 1. Restrict About Image Size */
.about .profile-img {
  max-width: 280px;  /* Limits image size */
  width: 100%;
  height: auto;
  border-radius: 15px; /* Adds nice rounded corners */
  margin: 0 auto 20px auto; /* Centers it */
  display: block;
}

/* 2. Adjust Facts Text for Laptops */
@media (min-width: 992px) and (max-width: 1199px) {
  .facts .count-box {
    padding: 20px 10px;
  }
  .facts .count-box span {
    font-size: 36px; /* Slightly smaller numbers on laptop */
  }
}

/* Full Screen Loader Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7); /* Dark transparent background */
    z-index: 9999;
    display: none; /* Hidden by default */
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

/* The Spinner */
.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #149ddd; /* Theme Color */
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

.loading-text {
    color: #fff;
    font-family: "Poppins", sans-serif;
    font-size: 18px;
    letter-spacing: 1px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}