/* Section (Project) */
.projects-section {
    padding: 120px 20px;
    position: relative;
    z-index: 1;
}

.section-header {
    text-align: center;
    margin-bottom: 80px;
}

.section-title {
    font-size: clamp(3rem, 8vw, 5rem);
    font-weight: 700;
    margin-bottom: 20px;
    position: relative;
    display: inline-block;
}

.title-gradient {
    background: linear-gradient(
        135deg,
        var(--primary-color) 0%,
        var(--accent) 50%,
        var(--color-base-highlight) 100%
    );
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradient-shift 3s ease-in-out infinite alternate;
}

@keyframes gradient-shift {
    0% {
        filter: hue-rotate(0deg);
    }
    100% {
        filter: hue-rotate(20deg);
    }
}

.title-underline {
    height: 4px;
    width: 0;
    background: linear-gradient(
        90deg,
        transparent,
        var(--accent),
        var(--primary-color),
        transparent
    );

    margin: 20px auto;
    animation: expand 2s ease-out forwards;
    animation-delay: 0.5s;
}

@keyframes expand {
    to {
        width: 100%;
    }
}

.section-subtitle {
    font-size: 1.2rem;
    color: var(--text-color);
    font-weight: 300;
    opacity: 0;
    animation: fadeInUp 1s ease-out forwards;
    animation-delay: 1s;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Projects Grid */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 40px;
    max-width: 1400px;
    margin: 0 auto;
}

/* Project Cards */
.project-card {
    background: var(--card-bg-overlay); /* Uses theme value */
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color); /* Uses theme value */
    border-radius: 24px;
    overflow: hidden;
    position: relative;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    transform-style: preserve-3d;
    opacity: 0;
    animation: cardFadeIn 1s ease-out forwards;
}

@keyframes cardFadeIn {
    from {
        opacity: 0;
        transform: translateY(60px) rotateX(20deg);
    }
    to {
        opacity: 1;
        transform: translateY(0) rotateX(0deg);
    }
}

.project-card:hover {
    transform: translateY(-20px) rotateX(5deg) rotateY(5deg);
    box-shadow: 0 40px 80px var(--shadow-glow), 0 0 0 1px var(--border-color);
}

.project-card:nth-child(1) {
    animation-delay: 0.2s;
}
.project-card:nth-child(2) {
    animation-delay: 0.4s;
}
.project-card:nth-child(3) {
    animation-delay: 0.6s;
}

.card-glow {
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: var(--shadow-glow);
    border-radius: 24px;
    opacity: 0;
    z-index: -1;
    transition: opacity 0.4s ease;
}

.project-card:hover .card-glow {
    opacity: 0.8;
}

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

/* Project Image */
.project-image {
    height: 250px;
    position: relative;
    overflow: hidden;
    background: var(
        --project-image-gradient,
        linear-gradient(135deg, #1e1e2e, #2d2d4a)
    );
}

.project-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.project-card:hover .project-image img {
    transform: scale(1.1) rotate(2deg);
}

/* Image Overlay */
.image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(
        --image-overlay-gradient,
        linear-gradient(
            135deg,
            rgba(102, 126, 234, 0.9),
            rgba(118, 75, 162, 0.9)
        )
    );
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.4s ease;
}

.project-card:hover .image-overlay {
    opacity: 1;
}

.quick-view-btn {
    background: rgba(255 255 255 / 0.2); /* fallback */
    background: var(--button-bg, rgba(255 255 255 / 0.2));
    backdrop-filter: blur(10px);
    border: 1px solid var(--button-border, rgba(255 255 255 / 0.3));
    color: var(--button-text, #fff);
    padding: 12px 24px;
    border-radius: 50px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    transform: translateY(30px);
}

.project-card:hover .quick-view-btn {
    transform: translateY(0);
}

.quick-view-btn:hover {
    background: var(--hero-btn-hover); /* theme-based hover background */
    transform: scale(1.05);
}

/* Project Content */
.project-content {
    padding: 30px;
}

.project-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

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

.tag {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid transparent;
    transition: all 0.3s ease;
}

.tag-react {
    background: rgba(97, 218, 251, 0.2);
    color: #61dafb;
    border-color: rgba(97, 218, 251, 0.3);
}
.tag-node {
    background: rgba(104, 160, 99, 0.2);
    color: #68a063;
    border-color: rgba(104, 160, 99, 0.3);
}
.tag-mongo {
    background: rgba(77, 153, 128, 0.2);
    color: #4d9980;
    border-color: rgba(77, 153, 128, 0.3);
}
.tag-vue {
    background: rgba(77, 186, 131, 0.2);
    color: #4dba83;
    border-color: rgba(77, 186, 131, 0.3);
}
.tag-firebase {
    background: rgba(255, 171, 64, 0.2);
    color: #ffab40;
    border-color: rgba(255, 171, 64, 0.3);
}
.tag-pwa {
    background: rgba(156, 39, 176, 0.2);
    color: #9c27b0;
    border-color: rgba(156, 39, 176, 0.3);
}
.tag-django {
    background: rgba(9, 46, 32, 0.2);
    color: #092e20;
    border-color: rgba(9, 46, 32, 0.3);
}
.tag-postgres {
    background: rgba(51, 103, 145, 0.2);
    color: #336791;
    border-color: rgba(51, 103, 145, 0.3);
}
.tag-docker {
    background: rgba(9, 155, 225, 0.2);
    color: #099be1;
    border-color: rgba(9, 155, 225, 0.3);
}

.tag:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.project-status {
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    animation: pulse 2s infinite;
}

.status-dot.status-beta {
    background: #f59e0b;
}

@keyframes pulse {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Apply theme variables to your classes */
.status-text {
    font-size: 0.75rem;
    color: var(--secondary-text);
    font-weight: 500;
}

.project-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 12px;
    line-height: 1.2;
}

.project-description {
    font-size: 0.95rem;
    color: var(--secondary-text);
    line-height: 1.6;
    margin-bottom: 24px;
}

/* Project Stats */
.project-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}
.stat {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 0.75rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Card Footer */
.card-footer {
    padding: 0 30px 30px;
}

.project-links {
    display: flex;
    gap: 12px;
}
/* Project Link */
.project-link {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--button-bg);
    border: 1px solid var(--button-border);
    border-radius: 12px;
    color: var(--secondary-text);
    text-decoration: none;
    transition: all 0.3s ease;
}

.project-link:hover {
    background: var(--hero-btn-hover);
    border-color: var(--primary-hover);
    color: var(--primary-color);
    transform: translateY(-2px);
}

/* Modal Styles */
.project-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    padding: 20px;
}

.project-modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--hero-shadow);
    backdrop-filter: blur(10px);
}

.modal-content {
    background: var(--card-bg-overlay);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    padding: 40px;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.project-modal.active .modal-content {
    transform: scale(1);
}

.close-modal {
    position: absolute;
    top: 20px;
    right: 20px;
    background: var(--button-bg);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--secondary-text);
    cursor: pointer;
    transition: all 0.3s ease;
}

.close-modal:hover {
    background: var(--error);
    color: var(--button-text);
}

.modal-header {
    margin-bottom: 30px;
}

.modal-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 16px;
}

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

.modal-gallery {
    margin-bottom: 40px;
}

.main-image {
    height: 400px;
    border-radius: 16px;
    overflow: hidden;
    background: var(--project-image-gradient);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.main-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.thumbnail-container {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 8px;
}

.thumbnail {
    min-width: 100px;
    height: 75px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    opacity: 0.6;
    transition: all 0.3s ease;
    background: var(--project-image-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid transparent;
}

.thumbnail:hover,
.thumbnail.active {
    opacity: 1;
    border-color: var(--primary-color);
    transform: translateY(-4px);
}

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

.modal-body {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
}

.modal-description h3,
.modal-features h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 16px;
}

.modal-description p {
    color: var(--secondary-text);
    line-height: 1.7;
}

.modal-features ul {
    list-style: none;
    padding: 0;
}

.modal-features li {
    color: var(--secondary-text);
    margin-bottom: 12px;
    padding-left: 24px;
    position: relative;
}

.modal-features li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--success);
    font-weight: bold;
}

.modal-footer {
    display: flex;
    gap: 16px;
}

.modal-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 1px solid var(--button-border);
    background: var(--button-bg);
    color: var(--secondary-text);
}

.modal-link:hover {
    transform: translateY(-2px);
    background: var(--hero-btn-hover);
}

.modal-link.primary {
    background: var(--image-overlay-gradient);
    color: var(--button-text);
    border-color: transparent;
}

.modal-link.primary:hover {
    background: var(
        --image-overlay-gradient
    ); /* Maintain gradient, no change needed */
}

/* Responsive Design */
@media (max-width: 768px) {
    .projects-grid {
        grid-template-columns: 1fr;
        gap: 30px;
        padding: 0 10px;
    }

    .project-card {
        min-width: unset;
    }

    .project-stats {
        grid-template-columns: repeat(3, 1fr);
        gap: 15px;
    }

    .modal-content {
        padding: 30px 20px;
        margin: 10px;
    }

    .modal-body {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .main-image {
        height: 250px;
    }

    .section-title {
        font-size: clamp(2rem, 6vw, 3rem);
    }

    .modal-footer {
        flex-direction: column;
    }

    .project-card:hover {
        transform: translateY(-10px);
    }
}

@media (max-width: 480px) {
    .projects-section {
        padding: 80px 10px;
    }

    .section-header {
        margin-bottom: 60px;
    }

    .project-content {
        padding: 24px;
    }

    .card-footer {
        padding: 0 24px 24px;
    }

    .project-stats {
        gap: 10px;
    }

    .stat-number {
        font-size: 1.1rem;
    }
}
