/* 🔹 CSS Variables: Easy color/theme updates */
:root {
    --primary: #6244C5;
    --secondary: #FFC448;
    --light: #FAFAFB;
    --dark: #12141D;
}

/* 🔹 Back to Top Button: Fixed position, hidden by default */
.back-to-top {
    position: fixed;
    display: none;
    right: 45px;
    bottom: 45px;
    z-index: 99;
    transition: opacity 0.3s ease;
}

/* 🔹 Show button when scrolled */
.back-to-top.show {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 🔹 Custom spacing utilities */
.my-6 { margin-top: 6rem; margin-bottom: 6rem; }
.py-6 { padding-top: 6rem; padding-bottom: 6rem; }

/* 🔹 Responsive spacing adjustments for mobile */
@media (max-width: 768px) {
    .my-6 { margin-top: 3rem; margin-bottom: 3rem; }
    .py-6 { padding-top: 3rem; padding-bottom: 3rem; }
    .display-3 { font-size: calc(1.3rem + 2vw) !important; }
    .display-5 { font-size: calc(1.2rem + 1.5vw) !important; }
}

/* 🔹 Spinner: Loading animation */
#spinner {
    opacity: 0;
    visibility: hidden;
    transition: opacity .5s ease-out, visibility 0s linear .5s;
    z-index: 99999;
}

#spinner.show {
    transition: opacity .5s ease-out, visibility 0s linear 0s;
    visibility: visible;
    opacity: 1;
}

/* 🔹 Buttons: Consistent sizing & hover effects */
.btn {
    font-weight: 500;
    transition: .5s;
    white-space: nowrap; /* Prevent text wrapping on small buttons */
}

.btn.btn-primary,
.btn.btn-secondary {
    color: #FFFFFF;
}

.btn:hover {
    transform: translateY(-2px); /* Subtle lift effect */
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* 🔹 Square buttons for icons */
.btn-square { width: 38px; height: 38px; }
.btn-sm-square { width: 32px; height: 32px; }
.btn-lg-square { width: 48px; height: 48px; }

.btn-square,
.btn-sm-square,
.btn-lg-square {
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: normal;
}

/* 🔹 Navbar: Responsive behavior */
.navbar.fixed-top {
    display: none; /* Hidden until scroll */
    transition: .5s;
}

.navbar .navbar-nav .nav-link {
    padding: 20px 15px;
    color: var(--dark);
    font-size: 18px;
    font-weight: 600;
    outline: none;
}

.navbar .navbar-nav .nav-link:hover,
.navbar .navbar-nav .nav-link.active {
    color: var(--primary);
}

/* 🔹 Mobile navbar: Compact padding */
@media (max-width: 991.98px) {
    .navbar .navbar-nav .nav-link {
        padding: 10px 0;
        font-size: 16px;
    }
    
    .navbar-brand {
        font-size: 1.2rem !important;
    }
}

/* 🔹 Header Section: Background + responsive layout */
#home {
    margin-bottom: 6rem;
    background: url(../img/bg-header.png) left top no-repeat;
    background-size: contain; /* Ensures bg image doesn't overflow on mobile */
}

/* 🔹 Typed.js cursor styling */
.typed-cursor {
    font-size: 30px;
    color: var(--dark);
}

/* 🔹 Mobile: Reduce typed text size */
@media (max-width: 768px) {
    .typed-cursor { font-size: 24px; }
}

/* 🔹 Play Button: Animated pulse effect */
.btn-play {
    position: relative;
    display: block;
    box-sizing: content-box;
    width: 16px;
    height: 26px;
    border-radius: 100%;
    border: none;
    outline: none !important;
    padding: 18px 20px 20px 28px;
    background: var(--primary);
    cursor: pointer;
    transition: transform 0.3s ease;
}

.btn-play:hover {
    transform: scale(1.05);
}

.btn-play:before {
    content: "";
    position: absolute;
    z-index: 0;
    left: 50%;
    top: 50%;
    transform: translateX(-50%) translateY(-50%);
    display: block;
    width: 60px;
    height: 60px;
    background: var(--primary);
    border-radius: 100%;
    animation: pulse-border 1500ms ease-out infinite;
}

.btn-play:after {
    content: "";
    position: absolute;
    z-index: 1;
    left: 50%;
    top: 50%;
    transform: translateX(-50%) translateY(-50%);
    display: block;
    width: 60px;
    height: 60px;
    background: #FFFFFF;
    border-radius: 100%;
    transition: all 200ms;
}

.btn-play span {
    display: block;
    position: relative;
    z-index: 3;
    width: 0;
    height: 0;
    left: -1px;
    border-left: 16px solid var(--primary);
    border-top: 11px solid transparent;
    border-bottom: 11px solid transparent;
}

@keyframes pulse-border {
    0% {
        transform: translateX(-50%) translateY(-50%) translateZ(0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translateX(-50%) translateY(-50%) translateZ(0) scale(2);
        opacity: 0;
    }
}

/* 🔹 Video Modal: Responsive sizing */
.modal-video .modal-dialog {
    position: relative;
    max-width: 800px;
    margin: 60px auto 0 auto;
}

.modal-video .modal-body {
    position: relative;
    padding: 0px;
}

.modal-video .close {
    position: absolute;
    width: 30px;
    height: 30px;
    right: 0px;
    top: -30px;
    z-index: 999;
    font-size: 30px;
    font-weight: normal;
    color: #FFFFFF;
    background: #000000;
    opacity: 1;
}

/* 🔹 Mobile modal adjustments */
@media (max-width: 768px) {
    .modal-video .modal-dialog {
        margin: 20px auto;
    }
    .modal-video .close {
        top: -20px;
        right: -10px;
    }
}

/* 🔹 About Section: Large number styling */
#about .years .display-1 {
    font-size: 10rem;
    line-height: 9rem;
}

#about .years h5 {
    letter-spacing: 30px;
    margin-right: -30px;
}

/* 🔹 Mobile: Scale down large numbers */
@media (max-width: 768px) {
    #about .years .display-1 {
        font-size: 6rem;
        line-height: 5.5rem;
    }
    #about .years h5 {
        letter-spacing: 15px;
        margin-right: -15px;
        font-size: 0.9rem;
    }
}

/* 🔹 Skills: Progress bar animations */
#skill .progress {
    height: 5px;
    border-radius: 5px;
    overflow: visible; /* Allows bar animation to be visible */
}

#skill .progress .progress-bar {
    width: 0px;
    border-radius: 5px;
    transition: width 3s ease-in-out;
}

#skill .nav-pills .nav-link {
    color: var(--dark);
    margin-bottom: 5px; /* Spacing for mobile tabs */
}

#skill .nav-pills .nav-link.active {
    color: #FFFFFF;
    background-color: var(--primary);
}

#skill .tab-content hr {
    width: 30px;
}

/* 🔹 Service Cards: Icon background */
.service-item .bg-icon {
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: url(../img/bg-icon.png) center center no-repeat;
    background-size: cover;
    flex-shrink: 0; /* Prevent icon from shrinking */
}

/* 🔹 Mobile: Adjust service card layout */
@media (max-width: 576px) {
    .service-item {
        flex-direction: column !important;
        text-align: center;
    }
    .service-item .bg-icon {
        margin: 0 auto 1rem auto;
    }
    .service-item .ms-sm-4 {
        margin-left: 0 !important;
    }
}

/* 🔹 Portfolio Filters: Button styling */
#portfolio-flters li {
    display: inline-block;
    font-weight: 500;
    color: var(--dark);
    cursor: pointer;
    transition: .5s;
    border-bottom: 2px solid transparent;
    padding: 5px 10px;
    margin: 5px 0; /* Better mobile spacing */
}

#portfolio-flters li:hover,
#portfolio-flters li.active {
    color: var(--primary);
    border-color: var(--primary);
}

/* 🔹 Portfolio Item: Hover overlay */
.portfolio-img {
    position: relative;
    overflow: hidden;
}

.portfolio-btn {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background: rgba(98, 68, 197, .9);
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
    padding: 30px;
    padding-bottom: 100px !important;
    opacity: 0;
    transition: .5s;
}

.portfolio-item:hover .portfolio-btn {
    opacity: 1;
    padding-bottom: 30px !important;
}

/* 🔹 Team Cards: Hover reveal effect */
.team-item img {
    transition: .5s;
    width: 100%; /* Ensure image fills container */
    height: auto;
}

.team-item:hover img {
    opacity: .7;
}

.team-item .team-text {
    position: absolute;
    left: 0;
    right: 60px;
    bottom: 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    opacity: 0;
    transition: .5s;
    background: rgba(255,255,255,0.95); /* Better readability */
    border-radius: 0 10px 10px 0;
}

.team-item:hover .team-text {
    right: 30px;
    opacity: 1;
}

.team-item .team-text div {
    transition: .5s;
}

.team-item:hover .team-text div {
    margin-left: 30px;
}

/* 🔹 Mobile: Adjust team card hover */
@media (max-width: 768px) {
    .team-item .team-text {
        right: 30px;
        opacity: 1; /* Always visible on mobile */
        bottom: 15px;
    }
    .team-item:hover .team-text div {
        margin-left: 0;
    }
}

/* 🔹 Testimonials: Side image positioning */
.testimonial-left,
.testimonial-right {
    position: relative;
}

.testimonial-left img,
.testimonial-right img {
    position: absolute;
    padding: 5px;
    border: 1px solid var(--secondary);
    border-radius: 70px;
    object-fit: cover;
}

.testimonial-left img:nth-child(1),
.testimonial-right img:nth-child(3) {
    width: 70px;
    height: 70px;
    top: 10%;
    left: 50%;
    transform: translateX(-50%);
}

.testimonial-left img:nth-child(2),
.testimonial-right img:nth-child(2) {
    width: 60px;
    height: 60px;
    top: 50%;
    left: 10%;
    transform: translateY(-50%);
}

.testimonial-left img:nth-child(3),
.testimonial-right img:nth-child(1) {
    width: 50px;
    height: 50px;
    bottom: 10%;
    right: 10%;
}

/* 🔹 Hide side images on mobile */
@media (max-width: 991px) {
    .testimonial-left,
    .testimonial-right {
        display: none;
    }
}

.testimonial-carousel .owl-item img {
    width: 120px;
    height: 120px;
    object-fit: cover;
}

.testimonial-carousel .testimonial-icon {
    position: absolute;
    width: 40px;
    height: 40px;
    left: 50%;
    bottom: -15px;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    background: #FFFFFF;
    border: 1px solid var(--secondary);
    border-radius: 60px;
}

.testimonial-carousel .owl-dots {
    height: 40px;
    margin-top: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.testimonial-carousel .owl-dot {
    position: relative;
    display: inline-block;
    margin: 0 5px;
    width: 30px;
    height: 30px;
    background: #FFFFFF;
    border: 2px solid var(--secondary);
    border-radius: 30px;
    transition: .5s;
}

.testimonial-carousel .owl-dot::after {
    position: absolute;
    content: "";
    width: 16px;
    height: 16px;
    top: 5px;
    left: 5px;
    border-radius: 16px;
    background: var(--secondary);
    transition: .5s;
}

.testimonial-carousel .owl-dot.active::after {
    background: var(--primary);
}

/* 🔹 Contact Form: Better mobile spacing */
@media (max-width: 768px) {
    .form-floating label {
        padding-left: 15px;
        font-size: 0.9rem;
    }
    .form-floating .form-control {
        padding-left: 15px;
    }
}

/* 🔹 Map: Ensure iframe is responsive */
iframe {
    max-width: 100%;
    display: block;
}

/* 🔹 Footer: Center text on mobile */
@media (max-width: 768px) {
    .text-md-start,
    .text-md-end {
        text-align: center !important;
    }
}

/* 🔹 Utility: Prevent horizontal scroll */
html, body {
    overflow-x: hidden;
    max-width: 100vw;
}

/* 🔹 Images: Always responsive */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* 🔹 Accessibility: Focus outlines */
a:focus,
button:focus,
input:focus,
textarea:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* 🔹 Print styles */
@media print {
    .navbar,
    .back-to-top,
    .btn-play,
    #spinner {
        display: none !important;
    }
}