/* General Styles */
:root {
    --primary-color: #4e73df;
    --secondary-color: #2e59d9;
    --text-color: #343a40; /* Dark text for light mode */
    --background-color: #ffffff; /* Light background for light mode */
    --card-background: #ffffff;
    --border-color: #e0e0e0;
    --footer-background: #1a1a1a;
    --footer-text-color: #ffffff;
    --transition: all 0.3s ease;
}

[data-theme="dark"] {
    --primary-color: #6a8cd4;
    --secondary-color: #5172b8;
    --text-color: #e0e0e0; /* Light text for dark mode */
    --background-color: #212529; /* Dark background for dark mode */
    --card-background: #343a40;
    --border-color: #495057;
    --footer-background: #121212;
    --footer-text-color: #b0b0b0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Poppins', sans-serif;
    padding-top: 50px;
    color: var(--text-color);
    background-color: var(--background-color);
    transition: background-color var(--transition), color var(--transition);
}

/* Navbar Styling */
.navbar {
    background-color: var(--footer-background);
    backdrop-filter: blur(10px);
    padding: 0.5rem 0;
    transition: background-color var(--transition), padding var(--transition);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.navbar-scrolled {
    padding: 0.7rem 0;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.2);
}

.navbar-brand {
    font-weight: 600;
    font-size: 1.5rem;
    color: white;
    transition: var(--transition);
}

.navbar-brand img {
    max-height: 40px !important; /* Default height for larger screens */
    width: auto !important; /* Maintain aspect ratio */
    transition: max-height 0.3s ease; /* Smooth transition for height changes */
}


.navbar-brand:hover {
    color: var(--primary-color);
}

.nav-link {
    font-weight: 500;
    padding: 0.5rem 0.5rem !important;
    color: rgba(255, 255, 255, 0.75);
    transition: var(--transition);
    display: flex;
    align-items: center;
}

.nav-link:hover {
    color: var(--primary-color) !important;
}

.nav-link i {
    margin-right: 0.5rem;
    font-size: 1.1rem; /* Consistent size for all nav icons */
}

#themeToggle i, #themeToggleDetails i {
    margin-right: 0; /* No text, so no right margin needed */
    /* Font size is now handled by .nav-link i for consistency */
}

.form-check-label {
    color: rgba(255, 255, 255, 0.75) !important; /* Ensure visibility against dark navbar */
    cursor: pointer;
    display: flex;
    align-items: center;
}

.form-check-label i {
    font-size: 1.2rem; /* Slightly larger icon */
    transition: color var(--transition);
    color: var(--text-color); /* Inherit text color for theme adaptation */
}

/* Hero Section */
.hero-section {
    background: linear-gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.7)), url('../images/hero-bg.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    height: 100vh;
    color: white;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(78, 115, 223, 0.8), rgba(46, 89, 217, 0.8));
    z-index: 1;
    pointer-events: none; /* Allow clicks to pass through */
}

.hero-background-elements {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0; /* Behind the overlay and content */
}

.hero-particles {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 1; /* Above hero-background-elements, below hero-overlay */
    pointer-events: none; /* Allow clicks to pass through */
}

.hero-background-elements::before,
.hero-background-elements::after {
    content: '';
    position: absolute;
    top: -10%;
    left: -10%;
    width: 120%;
    height: 120%;
    background: rgba(255, 255, 255, 0.05); /* Subtle white overlay */
    border-radius: 40%;
    animation: rotateLeft 30s linear infinite;
    opacity: 0.7;
}

.hero-background-elements::after {
    background: rgba(0, 0, 0, 0.05); /* Subtle dark overlay */
    border-radius: 45%;
    animation: rotateRight 40s linear infinite;
    top: -5%;
    left: -5%;
    opacity: 0.6;
}

@keyframes rotateLeft {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes rotateRight {
    from { transform: rotate(360deg); }
    to { transform: rotate(0deg); }
}

.hero-section .container {
    position: relative;
    z-index: 2; /* Ensure content is above overlays */
}

.hero-content {
    position: relative;
    z-index: 999; /* Ensure content is above everything, including background elements */
    pointer-events: auto; /* Ensure clicks are captured */
}

.hero-section h1 {
    font-size: 3.5rem;
    margin-bottom: 1.5rem;
    font-weight: 700;
}

.hero-section .lead {
    font-size: 1.25rem;
    
}

.hero-shape {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 2;
    pointer-events: none; /* Ensure clicks pass through the wave shape */
}

/* Service Cards */
.service-card {
    background: var(--card-background);
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: var(--transition);
    height: 100%;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

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

.service-icon {
    width: 80px;
    height: 80px;
    background: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem auto;
    transition: var(--transition);
}

.service-icon i {
    font-size: 2rem;
    color: white;
}

.service-card:hover .service-icon {
    background: var(--secondary-color);
    transform: rotateY(360deg);
}

.service-card h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    font-weight: 600;
    color: var(--text-color);
}

.service-card p {
    font-size: 1rem;
    color: var(--text-color);
    margin-bottom: 1.5rem;
}

.service-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
}

.service-link i {
    margin-left: 0.5rem;
    transition: var(--transition);
}

.service-link:hover {
    color: var(--secondary-color);
}

.service-link:hover i {
    transform: translateX(5px);
}

/* Portfolio Section */
.portfolio-item {
    background: var(--card-background);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    position: relative;
    height: 100%;
}

.portfolio-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
}

.portfolio-item img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.portfolio-item:hover img {
    transform: scale(1.05);
}

.portfolio-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));
    color: white;
    padding: 1.5rem;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    height: 100%;
}

.portfolio-item:hover .portfolio-info {
    transform: translateY(0);
}

.portfolio-info h4 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.portfolio-info p {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-bottom: 1rem;
}

.view-project-link {
    color: white;
    font-size: 1.5rem;
    position: absolute;
    right: 1.5rem;
    bottom: 1.5rem;
    background: var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.view-project-link:hover {
    background: var(--secondary-color);
    transform: scale(1.1);
}

/* Contact Form */
.contact-card {
    background: var(--card-background);
    padding: 3rem;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border-color);
}

.form-floating > .form-control,
.form-floating > .form-select,
.form-floating > .form-control-plaintext,
.form-floating > .form-control:focus,
.form-floating > .form-control:not(:placeholder-shown),
.form-floating > .form-select ~ label,
.form-floating > .form-control-plaintext ~ label,
.form-floating > .form-control:focus ~ label,
.form-floating > .form-control:not(:placeholder-shown) ~ label {
    padding-top: 1.625rem;
    padding-bottom: 0.625rem;
}

.form-floating > label {
    padding: 1rem 0.75rem;
    transition: transform 0.2s ease-in-out, opacity 0.2s ease-in-out;
}

.form-floating > .form-control:focus ~ label,
.form-floating > .form-control:not(:placeholder-shown) ~ label,
.form-floating > .form-select ~ label {
    transform: scale(.85) translateY(-.5rem) translateX(.15rem);
    opacity: 0;
}

.form-floating > textarea.form-control {
    height: auto;
}

.form-control:focus,
.form-select:focus,
.btn:focus {
    box-shadow: 0 0 0 0.25rem rgba(78, 115, 223, 0.25);
    border-color: var(--primary-color);
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    font-weight: 600;
    transition: var(--transition);
}

.btn-primary:hover {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
}

.alert {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1060; /* Higher than navbar */
    min-width: 300px;
    text-align: center;
}

/* Footer */
.footer {
    background-color: var(--footer-background);
    color: var(--footer-text-color);
    padding: 1rem 0 0;
}

.footer h5 {
    font-weight: 600;
    margin-bottom: 1.5rem;
}

.social-links {
    margin-top: 1.5rem;
}

.social-links a {
    color: var(--footer-text-color);
    font-size: 1.5rem;
    margin-right: 1rem;
    transition: var(--transition);
}

.social-links a:hover {
    color: var(--primary-color);
}

.footer-links {
    list-style: none;
    padding: 0;
}

.footer-links li {
    margin-bottom: 0.75rem;
}

.footer-links a {
    color: var(--footer-text-color);
    text-decoration: none;
    transition: var(--transition);
}

.footer-links a:hover {
    color: var(--primary-color);
    padding-left: 5px;
}

.contact-info {
    list-style: none;
    padding: 0;
}

.contact-info li {
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
}

.contact-info i {
    margin-right: 1rem;
    color: var(--primary-color);
}

.footer-bottom {
    text-align: center;
    padding: 1rem 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Section Titles */
.section-title {
    position: relative;
    padding-bottom: 1rem;
    margin-bottom: 3rem;
    color: var(--text-color);
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 3px;
    background: var(--primary-color);
}

/* Animations */
.pulse-animation {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

.highlighted-btn {
    position: relative;
    overflow: hidden;
    z-index: 1;
    transition: all 0.3s ease;
}

.highlighted-btn::before {
    content: '';
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    background: linear-gradient(45deg, #ff00ff, #00ffff, #ff00ff);
    background-size: 400% 400%;
    z-index: -1;
    filter: blur(8px);
    animation: gradientBorder 3s ease infinite;
    border-radius: 10px;
}

.highlighted-btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--primary-color);
    border-radius: 5px;
    z-index: -1;
}

@keyframes gradientBorder {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .hero-section h1 {
        font-size: 2.5rem;
    }
    
    .service-card {
        padding: 1.5rem;
    }
    
    .stat-item {
        margin-bottom: 1rem;
    }
    
    .stat-content h3 {
        font-size: 2rem;
    }
    
    .stat-icon {
        font-size: 2rem;
    }
    
    .contact-card {
        padding: 2rem;
    }
    
    .footer {
        text-align: center;
    }
    
    .social-links {
        justify-content: center;
    }
    
    .contact-info li {
        justify-content: center;
    }
}

.navbar-scrolled {
    padding: 0.7rem 0;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.2);
}

.navbar-brand img {
    max-height: 40px; /* Smaller height when scrolled */
}

@media (max-width: 991.98px) { /* Targeting typical mobile/tablet breakpoints */
    .navbar {
        min-height: 60px; /* Ensure sufficient height for both logo and icons */
        padding: 0.5rem 0;
        display: flex; /* Make the navbar itself a flex container */
        align-items: center; /* Vertically align items */
        justify-content: space-between; /* Space logo and nav items */
    }
    .navbar-toggler {
        display: none; /* Hide the hamburger icon */
    }
    .navbar .container {
        flex-wrap: nowrap; /* Prevent wrapping for mobile navbar items */
        justify-content: space-between; /* Space out logo and nav items */
        align-items: center; /* Vertically align items */
    }
    .navbar-brand {
        margin-right: 0; /* Remove default right margin */
        flex-shrink: 0; /* Prevent logo from shrinking */
    }
    .navbar-brand img {
        max-height: 40px; /* Adjust logo size for mobile */
        width: auto;
    }
    .navbar-collapse {
        display: flex !important; /* Force flexbox for the collapsed content */
        flex-direction: row; /* Ensure items are in a row */
        width: auto; /* Take only necessary width */
        background-color: transparent; /* No background when collapsed */
        padding-top: 0;
        flex-grow: 1; /* Allow nav to take remaining space */
        justify-content: flex-end; /* Push icons to the right */
        align-items: center; /* Vertically align items */
    }
    .navbar-nav {
        flex-direction: row; /* Align nav items horizontally */
        align-items: center; /* Vertically align nav items */
        margin-left: auto; /* Push nav items to the right */
    }
    .navbar-nav .nav-item {
        margin-left: 10px; /* Space between icons */
        margin-right: 0;
    }
    .nav-link {
        padding: 0; /* Remove padding to make icons closer */
        display: flex; /* Use flexbox for icons */
        align-items: center; /* Center icons */
        justify-content: center; /* Center icons */
    }
    .nav-link span {
        display: none; /* Hide text labels on mobile */
    }
    .nav-link i {
        font-size: 1.2rem; /* Adjust icon size */
    }
    body {
        padding-top: 60px; /* Adjust body padding to match new fixed navbar height */
    }
}