#portfolio {
    background: linear-gradient(139deg, #05020c 0%, #0c0516 100%);
    padding: 100px 0 80px;
    position: relative;
    z-index: 1;
    overflow: hidden;
}

#portfolio::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 60% 30%, rgba(139,92,246,0.10) 0%, transparent 70%);
    z-index: 0;
    pointer-events: none;
}

#portfolio::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
            radial-gradient(circle at 20% 40%, #fff 1px, transparent 1.5px),
            radial-gradient(circle at 80% 70%, #fff 1px, transparent 1.5px),
            radial-gradient(circle at 50% 80%, #fff 1px, transparent 1.5px),
            radial-gradient(circle at 70% 20%, #fff 1px, transparent 1.5px);
    background-size: 180px 180px, 220px 220px, 300px 300px, 260px 260px;
    background-repeat: repeat;
    opacity: 0.10;
    z-index: 0;
    pointer-events: none;
}

.portfolio-container {
    position: relative;
    z-index: 1;
}

.portfolio-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}
.portfolio-filters {
    display: flex;
    justify-content: left;
    gap: 1rem;
    margin-bottom: 2.5rem;
}


.filter-btn {
    background: #1e1b2f;
    color: #fff;
    border: 2px solid #442688;
    padding: 10px 28px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.3s, color 0.3s, box-shadow 0.3s, border-color 0.3s;
}

.filter-btn.active,
.filter-btn:hover {
    background: #4f00a8;
    color: white;
    border-color: var(--light-purple);
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.12);
}

.single-card {
    display: flex !important;
    flex-direction: column !important;
    gap: 2rem;
}

.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
}
.portfolio-card {
    background: rgba(38, 30, 59, 0.0);
    border-radius: 18px;
    box-shadow: 0 8px 32px rgba(139,92,246,0.12), 0 1.5px 0 0 rgba(139,92,246,0.08);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s, box-shadow 0.3s;
    border: 1.5px solid rgba(139,92,246,0.18);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: relative;
}
.portfolio-card:hover {
    transform: translateY(-8px) scale(1.03);
    box-shadow: 0 16px 40px rgba(139,92,246,0.22);
}
.portfolio-image {
    width: 100%;
    height: 200px;
    background-size: cover;
    background-position: center;
    border-bottom: 1.5px solid rgba(139, 92, 246, 0.12);
}
.portfolio-content {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.portfolio-content h3 {
    color: #fff;
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}
.portfolio-content p {
    color: #cbd5e1;
    font-size: 1rem;
    margin-bottom: 1.2rem;
}
.portfolio-details-btn {
    background: linear-gradient(135deg, var(--primary-purple), var(--dark-purple));
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 22px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    align-self: flex-start;
    box-shadow: 0 2px 8px rgba(139,92,246,0.18);
}
.portfolio-details-btn:hover {
    background: var(--light-purple);
    color: #fff;
    transform: translateY(-2px);
}
.glass-modal {
    background: rgba(30, 15, 50, 0.95);
    border-radius: 18px;
    border: 1px solid rgba(139, 92, 246, 0.25);
    box-shadow:
            0 15px 35px rgba(0, 0, 0, 0.3),
            0 0 0 1px rgba(139, 92, 246, 0.1),
            0 0 30px rgba(139, 92, 246, 0.2);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    overflow: hidden;
}

.modal-header {
    background: linear-gradient(90deg,
    rgba(139, 92, 246, 0.2) 0%,
    rgba(139, 92, 246, 0.1) 100%);
    border-bottom: 1px solid rgba(139, 92, 246, 0.15);
    padding: 1.25rem 1.5rem;
    position: relative;
}

.modal-title {
    color: white;
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0;
    letter-spacing: -0.5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.portfolio-modal-close {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.portfolio-modal-close:hover {
    background: var(--primary-purple);
    transform: rotate(90deg);
}

/* NEW LAYOUT: Gallery on top, details below */
.portfolio-modal-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    max-height: 75vh;
    overflow-y: auto;
}

/* Gallery Styles - Now Full Width */
.portfolio-modal-gallery {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
}

.portfolio-main-image {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    background: rgba(0, 0, 0, 0.2);
    aspect-ratio: 16/9;
    max-height: 400px; /* Larger than before */
}

.portfolio-main-image img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Changed from cover to contain for better image viewing */
    object-position: center;
}

.image-nav {
    position: absolute;
    top: 50%;
    width: 100%;
    display: flex;
    justify-content: space-between;
    transform: translateY(-50%);
    pointer-events: none; /* Keeps the container non-interactive */
}

.image-nav-btn {
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    pointer-events: auto; /* Makes the buttons interactive */
    font-size: 1.1rem;
    position: absolute; /* Explicitly position the buttons */
}

.image-nav-btn:first-child {
    left: 10px; /* Position the "prev" button on the left */
}

.image-nav-btn:last-child {
    right: 10px; /* Position the "next" button on the right */
}

.image-nav-btn:hover {
    background: var(--primary-purple);
    transform: scale(1.1);
}

.portfolio-thumbnails {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding: 0.5rem 0;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-purple) rgba(0, 0, 0, 0.2);
    justify-content: center;
}

.thumbnail {
    width: 100px; /* Larger thumbnails */
    height: 75px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    opacity: 0.6;
    transition: all 0.3s;
    flex-shrink: 0;
    border: 2px solid transparent;
}

.thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thumbnail.active {
    opacity: 1;
    border-color: var(--primary-purple);
    box-shadow: 0 0 0 1px var(--primary-purple);
}

.thumbnail:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

/* Details Styles - Now Below Gallery */
.portfolio-modal-details {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Grid layout for details sections */
.details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.details-section {
    margin-bottom: 0;
}

.details-section h5 {
    color: var(--primary-purple);
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.project-description {
    color: var(--white-87);
    line-height: 1.6;
    font-size: 1rem;
}

.tech-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tech-tags span {
    background: rgba(139, 92, 246, 0.15);
    color: var(--white-87);
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 0.9rem;
    border: 1px solid rgba(139, 92, 246, 0.2);
    display: inline-block;
    transition: all 0.3s;
}

.tech-tags span:hover {
    background: var(--primary-purple);
    color: white;
    transform: translateY(-2px);
}

.project-links {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(139, 92, 246, 0.15);
}

.project-links a {
    flex: 1;
    max-width: 200px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
}

.btn-purple {
    background: linear-gradient(135deg, var(--primary-purple), var(--dark-purple));
    color: white;
}

.btn-outline-purple {
    background: transparent;
    color: var(--primary-purple);
    border: 2px solid var(--primary-purple);
}

.btn-purple:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.btn-outline-purple:hover {
    background: var(--primary-purple);
    color: white;
    transform: translateY(-2px);
}

/* Responsive Styles */
@media (max-width: 992px) {
    .details-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .portfolio-main-image {
        max-height: 350px;
    }
}

@media (max-width: 768px) {
    .modal-title {
        font-size: 1.5rem;
    }

    .portfolio-modal-gallery {
        width: 99%;
    }

    .portfolio-main-image {
        aspect-ratio: 4/3;
        max-height: 280px;
    }

    .thumbnail {
        width: 80px;
        height: 60px;
    }

    .image-nav-btn {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    .project-links {
        flex-direction: column;
    }

    .project-links a {
        max-width: 100%;
    }

    .portfolio-thumbnails {
        justify-content: flex-start;
    }
}

@media (max-width: 576px) {
    .portfolio-modal-container {
        gap: 1rem;
    }

    .portfolio-main-image {
        max-height: 250px;
    }

    .details-grid {
        gap: 0.75rem;
    }
}

/* CSS Variables (add these if not already defined) */
:root {
    --primary-purple: #8b5cf6;
    --dark-purple: #7c3aed;
    --light-purple: #a78bfa;
    --white-87: rgba(255, 255, 255, 0.87);
}