/* Projects Section Styling */

/* Projects grid layout */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 30px;
    margin-top: 30px;
    padding: 0 20px;
}

/* Responsive grid adjustments */
@media (min-width: 768px) {
    .projects-grid {
        grid-template-columns: repeat(2, 1fr);
        max-width: 1200px;
        margin: 30px auto 0;
    }
}

@media (min-width: 1000px) {
    .projects-grid {
        grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); /* Increased from 350px to 360px */
        max-width: 1000px; /* Increased container width */
    }
}

@media (min-width: 768px) {
    .projects-grid {
        grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); /* Increased from 350px to 360px */
        max-width: 992px; /* Increased container width */
    }
}
@media (min-width: 1200px) {
    .projects-grid {
        grid-template-columns: repeat(3, 1fr);
        max-width: 1400px; /* Further increased for larger screens */
    }
}

@media (min-width: 1400px) {
    .projects-grid {
        grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); /* Even wider tiles */
        max-width: 1600px; /* Maximum utilization for very large screens */
        gap: 25px; /* Increased gap for better spacing */
    }
}

@media (max-width: 767px) {
    .projects-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 0 10px;
    }
}

/* Project card styling */
.project {
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: all 0.3s ease;
    height: 100%;
    position: relative;
    min-height: 480px; /* Minimum height to ensure consistency */
}

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


.project-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.project-image img:hover {
    transform: scale(1.05);
}

/* Project info styling */
.project-info {
    padding: 0 25px;
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

.project-info p {
    margin: 0;
    line-height: 1.6;
    color: #666;
    text-align: justify;
}

/* Tech stack styling */
.tech-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 15px 0;
    justify-content: center;
}

.tech-icon {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #f8f9fa;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.85em;
    color: #555;
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
}

.tech-icon:hover {
    background: var(--gradient-primary);
    color: white;
    transform: translateY(-2px);
}

.tech-icon img {
    width: 16px;
    height: 16px;
    object-fit: contain;
}

/* Project toggle button styling */
.project-toggle {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(32, 178, 170, 0.9);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    color: white;
    font-size: 16px;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(32, 178, 170, 0.3);
}

.project-toggle:hover {
    background: rgba(32, 178, 170, 1);
    transform: scale(1.1) rotate(15deg);
    box-shadow: 0 6px 20px rgba(32, 178, 170, 0.5);
}

.project-toggle:active {
    transform: scale(0.95);
}

/* Project details container - positioned to replace image */
.project-details {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 320px; /* Same height as project-image */
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px 12px 0 0;
    padding: 25px 20px 20px 20px; /* Added top padding for tech stack spacing */
    opacity: 0;
    transform: scale(0.95) rotateY(80deg); /* Adjusted for smoother animation */
    transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94); /* Smoother easing */
    z-index: 5;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    box-sizing: border-box; /* Ensure padding doesn't overflow */
}

.project-details.expanded {
    opacity: 1;
    transform: scale(1) rotateY(0deg);
}

/* Project image with transition */
.project-image {
    width: 100%;
    height: 320px;
    overflow: hidden;
    position: relative;
    transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94); /* Matching smooth easing */
    z-index: 3;
}

.project-image.hidden {
    opacity: 0;
    transform: scale(0.95) rotateY(-80deg); /* Matching details animation values */
}

/* Project footer - always visible at bottom */
.project-footer {
    margin-top: auto;
    text-align: center;
    padding: 20px 25px;
}

.project-footer h3 {
    margin: 0 0 15px 0;
    font-size: 1.2em;
    color: #333;
    font-weight: 600;
    text-align: center;
}

/* Project links styling */
.project-links {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.project-info a {
    position: relative;
    display: inline-block;
    padding: 10px 20px;
    background: var(--gradient-primary);
    color: white !important;
    text-decoration: none !important;
    border-radius: 6px;
    transition: all 0.3s ease;
    overflow: hidden;
    font-weight: 500;
    font-size: 0.9em;
}

.project-info a:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(32, 178, 170, 0.4);
}

.project-info a.secondary {
    background: transparent;
    color: var(--neon-purple) !important;
    border: 2px solid var(--neon-purple);
}

.project-info a.secondary:hover {
    background: var(--neon-purple);
    color: white !important;
}

/* Dark mode project styling */
body.dark-mode .project {
    background: linear-gradient(135deg, var(--dark-secondary) 0%, #2d3d3c 100%);
    border: 1px solid rgba(32, 178, 170, 0.3);
    box-shadow: 0 8px 32px rgba(32, 178, 170, 0.1);
}

body.dark-mode .project:hover {
    box-shadow: 0 20px 40px rgba(32, 178, 170, 0.3);
}

body.dark-mode .project-info h3 {
    color: #fff;
}

body.dark-mode .project-info p {
    color: #ccc;
}

body.dark-mode .tech-icon {
    background: rgba(45, 45, 45, 0.8);
    color: #ccc;
    border: 1px solid rgba(32, 178, 170, 0.3);
}

body.dark-mode .tech-icon:hover {
    background: var(--gradient-primary);
    color: white;
}

body.dark-mode .project-info a {
    background: var(--gradient-primary);
    color: white !important;
}

body.dark-mode .project-info a:hover {
    box-shadow: 0 6px 20px rgba(32, 178, 170, 0.6);
}

body.dark-mode .project-info a.secondary {
    background: transparent;
    color: var(--neon-purple) !important;
    border: 2px solid var(--neon-purple);
}

body.dark-mode .project-info a.secondary:hover {
    background: var(--neon-purple);
    color: white !important;
}

/* Dark mode styling for new elements */
body.dark-mode .project-toggle {
    background: rgba(32, 178, 170, 0.8);
    border: 1px solid rgba(32, 178, 170, 0.5);
}

body.dark-mode .project-toggle:hover {
    background: rgba(32, 178, 170, 1);
    border-color: rgba(32, 178, 170, 0.8);
    box-shadow: 0 6px 25px rgba(32, 178, 170, 0.6);
}

body.dark-mode .project-footer h3 {
    color: #fff;
}

body.dark-mode .project-info p {
    color: #ccc;
}

body.dark-mode .project-details {
    background: linear-gradient(135deg, #2d2d2d 0%, #2d3d3c 100%);
    border: 1px solid rgba(32, 178, 170, 0.3);
}

/* Animation for project cards */
.project.fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease;
}

.project.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Enhanced flip animation between image and details */
@keyframes flipIn {
    0% {
        opacity: 0;
        transform: scale(0.8) rotateY(90deg);
    }
    50% {
        opacity: 0.5;
        transform: scale(0.9) rotateY(45deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotateY(0deg);
    }
}

@keyframes flipOut {
    0% {
        opacity: 1;
        transform: scale(1) rotateY(0deg);
    }
    50% {
        opacity: 0.5;
        transform: scale(0.9) rotateY(-45deg);
    }
    100% {
        opacity: 0;
        transform: scale(0.8) rotateY(-90deg);
    }
}

/* Staggered animation delays for project cards */
.project.fade-in:nth-child(1) { transition-delay: 0.1s; }
.project.fade-in:nth-child(2) { transition-delay: 0.2s; }
.project.fade-in:nth-child(3) { transition-delay: 0.3s; }
.project.fade-in:nth-child(4) { transition-delay: 0.4s; }
.project.fade-in:nth-child(5) { transition-delay: 0.5s; }
.project.fade-in:nth-child(6) { transition-delay: 0.6s; }

/* Mobile responsive design */
@media (max-width: 768px) {
    .project {
        min-height: 420px; /* Adjusted for mobile */
    }

    .project-toggle {
        width: 35px;
        height: 35px;
        font-size: 14px;
        top: 12px;
        right: 12px;
    }

    .project-footer {
        padding: 15px 20px;
    }

    .project-footer h3 {
        font-size: 1.1em;
        margin-bottom: 12px;
    }

    .project-info {
        padding: 0 20px;
    }

    .project-details {
        height: 260px; /* Reduced height to leave space for footer */
        padding: 18px 15px 12px 15px;
        font-size: 0.9em; /* Slightly smaller text for better fit */
    }
    
    .project-image {
        height: 260px;
    }
    
    .project-info {
        padding: 0 15px; /* Ensure footer has proper spacing */
    }

    .tech-stack {
        gap: 6px;
        margin-bottom: 15px;
    }

    .tech-icon {
        font-size: 0.8em;
        padding: 4px 8px;
    }

    .tech-icon img {
        width: 14px;
        height: 14px;
    }

    .project-links {
        gap: 8px;
    }

    .project-info a {
        padding: 8px 16px;
        font-size: 0.85em;
    }
}

@media (max-width: 480px) {
    .project {
        min-height: 380px; /* Smaller min-height for very small screens */
    }

    .project-toggle {
        width: 32px;
        height: 32px;
        font-size: 12px;
        top: 10px;
        right: 10px;
    }

    .project-details {
        height: 220px; /* Smaller height for very small screens */
        padding: 15px 12px 10px 12px;
        font-size: 0.85em; /* Even smaller text for tiny screens */
    }
    
    .project-image {
        height: 220px;
    }

    .project-footer {
        padding: 12px 15px;
    }

    .project-footer h3 {
        font-size: 1em;
        margin-bottom: 10px;
    }

    .project-info {
        padding: 0 15px;
    }

    .project-links {
        flex-direction: column;
        gap: 6px;
    }

    .project-info a {
        padding: 8px 12px;
        font-size: 0.8em;
        text-align: center;
    }
}