:root {
    --primary-color: #0d6efd;
    --primary-gradient: linear-gradient(135deg, #0d6efd 0%, #00d4ff 100%);
    --secondary-color: #6c757d;
    --dark-color: #212529;
    --light-color: #f8f9fa;
    --card-bg: #ffffff;
    --text-color: #212529;
    --text-secondary: #6c757d;
    --body-bg: #ffffff;
    --glow-shadow: 0 0 20px rgba(13, 110, 253, 0.4);
}

[data-theme="dark"] {
    --primary-color: #3d8bfd;
    --primary-gradient: linear-gradient(135deg, #3d8bfd 0%, #00f2fe 100%);
    --dark-color: #f8f9fa;
    --light-color: #212529;
    --card-bg: #1e2227;
    --text-color: #f8f9fa;
    --text-secondary: #adb5bd;
    --body-bg: #0f1215;
    --glow-shadow: 0 0 25px rgba(61, 139, 253, 0.5);
}

body {
    font-family: 'Poppins', sans-serif;
    color: var(--text-color);
    background-color: var(--body-bg);
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Fix for Secondary Text in Dark Mode */
.text-secondary, .text-muted {
    color: var(--text-secondary) !important;
}

/* Navbar Gradient */
.navbar {
    background: rgba(var(--body-bg), 0.85);
    backdrop-filter: blur(15px);
    transition: all 0.3s ease;
    border-bottom: 1px solid rgba(13, 110, 253, 0.1);
}

.navbar-brand {
    color: var(--text-color) !important;
}

.nav-link {
    font-weight: 500;
    color: var(--text-color) !important; /* Forces light color in dark mode */
    position: relative;
    padding: 0.5rem 1rem;
    transition: color 0.3s ease;
}

.navbar-toggler {
    border-color: rgba(13, 110, 253, 0.5);
    background-color: rgba(13, 110, 253, 0.1);
}

.navbar-toggler-icon {
    filter: invert(var(--theme-invert, 0)); /* Helps toggle visibility */
}

[data-theme="dark"] .navbar-toggler-icon {
    filter: invert(1);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 1rem;
    right: 1rem;
    height: 3px;
    background: var(--primary-gradient);
    border-radius: 10px;
}

/* Buttons with Gradient */
.btn-primary {
    background: var(--primary-gradient);
    border: none;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    box-shadow: var(--glow-shadow);
    transform: translateY(-2px);
    background: var(--primary-gradient);
    opacity: 0.9;
}

/* Fix for "Download Resume" (btn-outline-dark) in Dark Mode */
.btn-outline-dark {
    border-color: var(--text-color);
    color: var(--text-color);
}

.btn-outline-dark:hover {
    background-color: var(--text-color);
    color: var(--body-bg);
}

/* Decoration Underline */
.underline {
    width: 80px;
    height: 5px;
    background: var(--primary-gradient);
    border-radius: 10px;
    margin-top: 10px;
}

/* Cards with Gradient Glow Effect */
.skill-card, .project-card, .achievement-card, .education-timeline, .bg-white {
    background-color: var(--card-bg) !important;
    color: var(--text-color);
    border: 1px solid rgba(13, 110, 253, 0.1) !important;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    z-index: 1;
}

.skill-card:hover, .project-card:hover, .achievement-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--glow-shadow) !important;
    border-color: var(--primary-color) !important;
}

/* Gradient Border Glow for Specific Cards */
.achievement-card::before, .project-card::before {
    content: "";
    position: absolute;
    top: -2px; left: -2px; right: -2px; bottom: -2px;
    background: var(--primary-gradient);
    z-index: -1;
    border-radius: inherit;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.achievement-card:hover::before, .project-card:hover::before {
    opacity: 0.3;
}

/* Image Hover Glow */
.achievement-img-container, .project-img-container {
    position: relative;
    overflow: hidden;
}

.achievement-img-container::after, .project-img-container::after {
    content: "";
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(0deg, rgba(13, 110, 253, 0.3) 0%, transparent 50%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.achievement-card:hover .achievement-img-container::after,
.project-card:hover .project-img-container::after {
    opacity: 1;
}

/* Progress Bars with Gradient */
.progress-bar {
    background: var(--primary-gradient) !important;
}

/* Hero Section Specifics */
.text-primary {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
}

/* Timeline specific glow */
.timeline-dot {
    width: 12px;
    height: 12px;
    background: var(--primary-gradient);
    position: absolute;
    left: -7px;
    top: 5px;
    border-radius: 50%;
    box-shadow: 0 0 10px var(--primary-color);
}

/* Section Headings */
h2.fw-bold {
    letter-spacing: -1px;
}

/* Dark mode toggle glow */
#theme-toggle:hover {
    box-shadow: var(--glow-shadow);
    border-color: var(--primary-color);
}

.hero-img-blob img {
    width: min(420px, 100%);
    height: min(420px, 100%);
    object-fit: cover;
    object-position: center center;
    transform: scale(1.1);
    border-radius: 50%;
    display: inline-block;
    margin-left: auto;
    margin-right: auto;
    max-width: 420px;
    max-height: 420px;
}

/* Keep fixed navbar on top and prevent hero content from hiding behind it */
#mainNav {
    z-index: 1030;
}

.hero-section {
    padding-top: 120px; /* space for fixed navbar */
    padding-bottom: 100px;
}

/* Project Badge */
.project-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    padding: 5px 15px;
    border-radius: 20px;
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
}

/* ... Keep all existing styles ... */

/* Case Study Modal Overlay */
.case-study-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(12px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    transition: opacity 0.3s ease;
}

/* Modal Container */
.case-study-container {
    background-color: var(--card-bg);
    color: var(--text-color);
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    border-radius: 30px;
    position: relative;
    overflow-y: auto;
    padding: 40px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(13, 110, 253, 0.2);
}

.modal-close-btn {
    position: absolute;
    top: 25px;
    right: 25px;
    background: var(--primary-gradient);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.3s ease;
    z-index: 10;
}

.modal-close-btn:hover {
    transform: rotate(90deg) scale(1.1);
}

.bg-light-soft {
    background-color: rgba(13, 110, 253, 0.05);
}

/* Animations */
.animate-scale-up {
    animation: scaleUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes scaleUp {
    from { opacity: 0; transform: scale(0.8) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

/* Body scroll lock */
body.modal-open {
    overflow: hidden;
}

/* Dark mode specific tweaks */
[data-theme="dark"] .case-study-container {
    background-color: #1a1d21;
    border-color: rgba(13, 110, 253, 0.3);
}

[data-theme="dark"] .bg-light-soft {
    background-color: rgba(255, 255, 255, 0.03);
}

@media (max-width: 768px) {
    .case-study-container {
        padding: 25px;
        border-radius: 20px;
    }
    .modal-close-btn {
        top: 15px;
        right: 15px;
    }
}

/* --- Live Project Pulse Indicator --- */
.pulse-circle {
    display: inline-block;
    width: 12px;
    height: 12px;
    background-color: #ff4d4d;
    border-radius: 50%;
    margin-right: 12px;
    vertical-align: middle;
    box-shadow: 0 0 0 rgba(255, 77, 77, 0.4);
    animation: pulse-red 2s infinite;
}

@keyframes pulse-red {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(255, 77, 77, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 10px rgba(255, 77, 77, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(255, 77, 77, 0); }
}

/* --- Infinite Sliding Window (Marquee) --- */
.project-slider-wrapper {
    overflow: hidden;
    padding: 30px 0;
    position: relative;
    width: 100%;
}

.project-slider-track {
    display: flex;
    /* width calculation: (Card Width + Margins) * Total Items (including duplicates) */
    width: calc(580px * 4); 
    animation: scroll-left 35s linear infinite;
}

.project-slider-track:hover {
    animation-play-state: paused;
}

.slider-item {
    flex: 0 0 550px; /* Increased Card Size */
    margin: 0 15px;
    height: 480px; /* Height increased to accommodate image */
}

@keyframes scroll-left {
    0% { transform: translateX(0); }
    /* Scroll past exactly the unique items (2 items * width) */
    100% { transform: translateX(calc(-580px * 2)); } 
}

/* Gradient Masking for Edges */
.project-slider-wrapper::before,
.project-slider-wrapper::after {
    content: "";
    height: 100%;
    position: absolute;
    width: 100px;
    z-index: 2;
    pointer-events: none;
}

.project-slider-wrapper::before {
    left: 0; top: 0;
    background: linear-gradient(to right, var(--body-bg) 0%, rgba(255, 255, 255, 0) 100%);
}

.project-slider-wrapper::after {
    right: 0; top: 0;
    transform: rotateZ(180deg);
    background: linear-gradient(to right, var(--body-bg) 0%, rgba(255, 255, 255, 0) 100%);
}

/* Mobile Responsiveness for Slider */
@media (max-width: 991px) {
    .slider-item {
        flex: 0 0 450px;
        height: 440px;
    }
    .project-slider-track {
        width: calc(480px * 4);
    }
    @keyframes scroll-left {
        0% { transform: translateX(0); }
        100% { transform: translateX(calc(-480px * 2)); }
    }
}

@media (max-width: 576px) {
    .slider-item {
        flex: 0 0 320px;
        height: 420px;
    }
    .project-slider-track {
        width: calc(350px * 4);
    }
    @keyframes scroll-left {
        0% { transform: translateX(0); }
        100% { transform: translateX(calc(-350px * 2)); }
    }
}