/* ===== Base Styles ===== */
body {
    overflow-x: hidden;
    position: relative;
}

/* ===== Hero Section with Professional Background ===== */
.hero {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 90vh;
  padding: 0 10%;
  overflow: hidden;
  background: linear-gradient(135deg, #f9f9f9, #eef6ff);
}

/* Abstract circles */
.hero::before,
.hero::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  opacity: 0.15;
  z-index: 0;
}

.hero::before {
  width: 400px;
  height: 400px;
  background: #4f46e5; /* Accent color */
  top: -100px;
  left: -100px;
  filter: blur(120px);
}

.hero::after {
  width: 300px;
  height: 300px;
  background: #22d3ee; /* Secondary accent */
  bottom: -100px;
  right: -100px;
  filter: blur(100px);
}

/* Content always above background */
.hero-content, .hero-image {
  position: relative;
  z-index: 1;
}

/* ===== Scroll Animation System ===== */
.scroll-hidden {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), 
                transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform, opacity;
}

.scroll-hidden.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Animation Variations */
[data-scroll="fade"] { transform: none !important; }
[data-scroll="left"] { transform: translateX(-30px); }
[data-scroll="left"].is-visible { transform: translateX(0); }
[data-scroll="right"] { transform: translateX(30px); }
[data-scroll="right"].is-visible { transform: translateX(0); }
[data-scroll="scale"] { transform: scale(0.95); }
[data-scroll="scale"].is-visible { transform: scale(1); }
[data-scroll="pop"] {
    transform: scale(0.8);
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
[data-scroll="pop"].is-visible {
    transform: scale(1);
    opacity: 1;
}

/* Staggered Animations */
.service-item:nth-child(odd) { transition-delay: 0.1s !important; }
.service-item:nth-child(even) { transition-delay: 0.2s !important; }

/* ===== Flip Animation for All Pages ===== */
.section, .main-content {
    animation: pageFlipIn 0.8s ease-out forwards;
    transform-origin: center;
    opacity: 0;
    transform-style: preserve-3d;
}
.main-content{
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

@keyframes pageFlipIn {
    from {
        transform: perspective(1000px) rotateY(15deg) scale(0.95);
        opacity: 0.8;
    }
    to {
        transform: perspective(1000px) rotateY(0deg) scale(1);
        opacity: 1;
    }
}

.section.active { opacity: 1; }

/* Independent Flip Animation */
.flip-animation {
    opacity: 0;
    transform-style: preserve-3d;
    backface-visibility: visible;
}

@keyframes flipInY {
    from {
        transform: perspective(1000px) rotateY(90deg);
        opacity: 0;
    }
    to {
        transform: perspective(1000px) rotateY(0deg);
        opacity: 1;
    }
}

/* ===== Animated Button ===== */
.animated-button {
    position: relative;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 16px 36px;
    border: 4px solid transparent;
    font-size: 16px;
    background-color: inherit;
    border-radius: 100px;
    font-weight: 600;
    color: #2E86AB;
    background-color: transparent;
    box-shadow: 0 0 0 2px #2E86AB;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
    width: fit-content;
    margin-top: 20px;
}
.animated-button svg {
    position: absolute;
    width: 24px;
    fill: #2E86AB;
    z-index: 9;
    transition: all 0.8s cubic-bezier(0.23, 1, 0.32, 1);
}
.animated-button .arr-1 { right: 16px; }
.animated-button .arr-2 { left: -25%; }
.animated-button .circle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    background-color: #2E86AB;
    border-radius: 50%;
    opacity: 0;
    transition: all 0.8s cubic-bezier(0.23, 1, 0.32, 1);
}
.animated-button .text {
    position: relative;
    z-index: 1;
    transform: translateX(-12px);
    transition: all 0.8s cubic-bezier(0.23, 1, 0.32, 1);
}
.animated-button:hover {
    box-shadow: 0 0 0 12px transparent;
    color: #343A40;
    background-color: #2E86AB;
    border-radius: 12px;
}
.animated-button:hover .arr-1 { right: -25%; }
.animated-button:hover .arr-2 { left: 16px; }
.animated-button:hover .text { transform: translateX(12px); }
.animated-button:hover svg { fill: #ffffff; }
.animated-button:active {
    scale: 0.95;
    box-shadow: 0 0 0 4px #2E86AB;
}
.animated-button:hover .circle {
    width: 220px;
    height: 220px;
    opacity: 1;
}

/* ===== Section Transitions ===== */
.section {
    position: relative;
    transition: opacity 0.3s ease, transform 0.3s ease;
    background: rgba(255, 255, 255, 0.85);
}
.section.hidden { display: none; }
.section.hide {
    opacity: 0;
    transform: translateX(20px);
}

/* ===== Portfolio Styles ===== */
.filter-item {
    cursor: pointer;
    padding: 8px 16px;
    margin-right: 10px;
    border-radius: 20px;
    transition: all 0.3s ease;
}
.filter-item.active {
    background-color: #2E86AB;
    color: white;
}
.portfolio-item-inner { transition: transform 0.3s ease; }
.portfolio-item-inner:hover { transform: translateY(-5px); }

/* ===== Responsive Adjustments ===== */
@media (max-width: 768px) {
    #home, .main-content {
        width: 100% !important;
        margin-left: 0 !important;
        padding: 0 15px !important;
        max-width: none !important;
        transition: margin-left 0.3s ease, width 0.3s ease;
    }

    /* Fix for sidebar gap */
    .sidebar ~ #home,
    .sidebar ~ .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }

    .sidebar.expanded ~ #home,
    .sidebar.expanded ~ .main-content {
        margin-left: 80px !important;
        width: calc(100% - 80px) !important;
    }
    
    .home-text, .home-img,
    .about-img, .about-content,
    .service-item, .portfolio-item,
    .contact-info, .contact-form {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        text-align: center !important;
    }
    .home-img img { margin-top: 30px; }
}

/* ===== Compact Footer ===== */
.compact-footer {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    position: relative;
    z-index: 10;
    text-align: center;
}
.compact-footer .logo {
    background: linear-gradient(to right, var(--white), var(--bg-gray));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    display: inline-block;
}
.compact-footer .social-links a {
    transition: all 0.3s ease;
    transform: scale(1);
}
.compact-footer .social-links a:hover {
    transform: scale(1.1) translateY(-2px);
}
.compact-footer .back-to-top { opacity: 0.8; }
.compact-footer .back-to-top:hover { opacity: 1; }

/* Responsive Adjustments */
@media (max-width: 640px) {
    .compact-footer { padding: 1rem; }
    .compact-footer .footer-container > div {
        flex-direction: column;
        gap: 1rem;
    }
}

/* ===== Footer Animation Styles ===== */
.compact-footer {
  transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  transform-origin: bottom center;
}
.footer-hidden {
  opacity: 0;
  transform: translateY(20px) scale(0.95);
}
.footer-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Back to top button styles */
.back-to-top {
  bottom: -60px;
  right: 20px;
  width: 50px;
  height: 50px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
  z-index: 999;
  opacity: 0;
}
.back-to-top.show {
  bottom: 20px;
  opacity: 1;
}
.back-to-top:hover {
  background: var(--secondary);
  transform: translateY(-3px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .back-to-top {
    width: 40px;
    height: 40px;
    right: 15px;
    bottom: 15px;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
  }
  .back-to-top.show {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }
  .back-to-top:hover {
    background: var(--secondary);
    transform: translateY(-3px) !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  }
}
/* --- Topbar (minimal extras) --- */
#topbar-rotating { transition: opacity .2s ease; }
#topbar-rotating.fade-out { opacity: 0; }

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  #topbar-rotating { transition: none !important; }
  .animate-pulse { animation: none !important; }
}
.project-card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  margin: 20px auto;
  max-width: 600px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.project-title {
  font-size: 1.4rem;
  margin-bottom: 15px;
  text-align: center;
}

.project-card img {
  width: 100%;
  border-radius: 10px;
}
