/* Projects Section Container */
.projects {
    max-width: 1300px;
    margin: 0 auto;
    padding: 3rem 2rem;
    background: linear-gradient(180deg, white 0%, #f8f9fa 50%, white 100%);
    position: relative;
    scroll-margin-top: 30px;
}

/* Filter Section - ALWAYS on RIGHT */
.project_filter_section {
    display: flex;
    justify-content: flex-end; /* KEEP dropdown on RIGHT side */
    margin-bottom: 40px;
}

.custom_select {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(174, 174, 192, 0.15);
    border-radius: 12px;
    padding: 12px 18px;
    min-width: 220px;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
    font-family: var(--font-primary), sans-serif;
    box-shadow:
            4px 4px 12px rgba(174, 174, 192, 0.2),
            -4px -4px 12px rgba(255, 255, 255, 0.9);
    z-index: 1;
}

.custom_select:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.selected_value {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--text-dark);
    font-weight: 500;
    font-size: 0.9375rem;
}

.selected_value i {
    color: var(--primary-color);
    transition: transform 0.3s ease;
}

.custom_select.open .selected_value i {
    transform: rotate(180deg);
}

.custom_options {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    border: 2px solid rgba(174, 174, 192, 0.15);
    border-radius: 12px;
    box-shadow:
            0 10px 30px rgba(0, 0, 0, 0.15),
            0 5px 15px rgba(0, 0, 0, 0.1);
    display: none;
    z-index: 100;
    max-height: 280px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) transparent;
    font-size: 0.9375rem;
}

.custom_options::-webkit-scrollbar {
    width: 6px;
}

.custom_options::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 2px;
}

.custom_options::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 2px;
    transition: background 0.3s ease;
}

.custom_options::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

.custom_options.show {
    display: block;
}

.custom_option {
    padding: 12px 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-light);
    border-bottom: 1px solid rgba(174, 174, 192, 0.1);
}

.custom_option:last-child {
    border-bottom: none;
}

.custom_option:hover,
.custom_option[aria-selected="true"] {
    background: rgba(255, 107, 53, 0.08);
    color: var(--primary-color);
}

/* Projects Container */
.projects_container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
}

/* Project Card */
.project {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border: 2px solid rgba(174, 174, 192, 0.15);
    border-radius: 24px;
    overflow: hidden;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow:
            10px 10px 30px rgba(174, 174, 192, 0.2),
            -10px -10px 30px rgba(255, 255, 255, 0.8);
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
}

/* NO orange glow on hover - just subtle lift */
.project:hover {
    transform: translateY(-8px);
    border-color: rgba(255, 107, 53, 0.25);
    box-shadow:
            12px 12px 35px rgba(174, 174, 192, 0.25),
            -10px -10px 30px rgba(255, 255, 255, 0.9);
}

/* Shimmer effect on hover */
.project::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.6s ease;
    pointer-events: none;
}

.project:hover::before {
    left: 100%;
}

.project-image {
    width: 100%;
    height: 240px;
    overflow: hidden;
}

.project-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.project:hover .project-image img {
    transform: scale(1.05);
}

/* Project Info */
.project_info {
    padding: 1.5rem 1.5rem 5rem; /* Increased bottom padding for buttons */
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

/* Tech Tags - Orange Theme */
.tech-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.tech-tag {
    display: inline-block;
    padding: 5px 14px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--primary-color);
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.08), rgba(255, 140, 66, 0.12));
    border: 1px solid rgba(255, 107, 53, 0.25);
    border-radius: 12px;
    transition: all 0.3s ease;
}

.tech-tag:hover {
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.15), rgba(255, 140, 66, 0.2));
    border-color: rgba(255, 107, 53, 0.4);
    transform: translateY(-2px);
}

.project_info h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 0.875rem; /* Increased spacing */
    line-height: 1.3;
}

.project_info p {
    color: var(--text-light);
    font-size: 0.9375rem;
    line-height: 1.7; /* Better readability */
    margin-bottom: 1.25rem; /* More space before buttons */
    flex-grow: 1;
    min-height: 0;
}

/* Project Actions - Side by Side with Space Between */
.project-actions {
    display: flex;
    justify-content: space-between; /* Left and right alignment */
    gap: 0.75rem;
    position: absolute;
    bottom: 1.5rem;
    left: 1.5rem;
    right: 1.5rem;
    margin-top: 0;
}

/* View Code Button - Orange gradient */
.view-code-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 10px 18px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    text-decoration: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9375rem;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
    flex: 1; /* Take equal space */
    min-width: 0; /* Allow shrinking */
}

/* NO icon rotation on hover */
.view-code-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 53, 0.4);
}

.view-code-btn:active {
    transform: translateY(0);
}

/* Demo Button - Outlined style */
.demo-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 10px 18px;
    background: transparent;
    color: var(--primary-color);
    text-decoration: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9375rem;
    border: 2px solid var(--primary-color);
    transition: all 0.3s ease;
    flex: 1; /* Take equal space */
    min-width: 0; /* Allow shrinking */
}

/* NO icon rotation on hover */
.demo-btn:hover {
    background: rgba(255, 107, 53, 0.08);
    transform: translateY(-2px);
}

.demo-btn:active {
    transform: translateY(0);
}

/* Empty State */
.empty-state-message {
    text-align: center;
    padding: 4rem 2rem;
    margin: 2rem 0;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    animation: float 3s ease-in-out infinite;
}

.empty-state-message h3 {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 1rem;
}

.empty-state-message p {
    color: var(--text-light);
    font-size: 1rem;
    line-height: 1.5;
    max-width: 400px;
    margin: 0 auto;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

/* Staggered fade-in animation */
.project {
    animation: projectFadeIn 0.6s ease backwards;
}

.project:nth-child(1) { animation-delay: 0.1s; }
.project:nth-child(2) { animation-delay: 0.15s; }
.project:nth-child(3) { animation-delay: 0.2s; }
.project:nth-child(4) { animation-delay: 0.25s; }
.project:nth-child(5) { animation-delay: 0.3s; }
.project:nth-child(6) { animation-delay: 0.35s; }
.project:nth-child(7) { animation-delay: 0.4s; }
.project:nth-child(8) { animation-delay: 0.45s; }
.project:nth-child(9) { animation-delay: 0.5s; }
.project:nth-child(10) { animation-delay: 0.55s; }
.project:nth-child(11) { animation-delay: 0.6s; }
.project:nth-child(12) { animation-delay: 0.65s; }
.project:nth-child(13) { animation-delay: 0.7s; }
.project:nth-child(14) { animation-delay: 0.75s; }
.project:nth-child(15) { animation-delay: 0.8s; }

@keyframes projectFadeIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   RESPONSIVE DESIGN - MOBILE OPTIMIZED
   ======================================== */

/* Tablet Landscape (1024px and below) */
@media (max-width: 1024px) {
    .projects {
        padding: 5rem 1.5rem;
    }

    .projects_container {
        grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
        gap: 2rem;
    }
}

/* Tablet Portrait & Mobile (768px and below) */
@media (max-width: 768px) {
    .projects {
        padding: 0;
        scroll-margin-top: 0;
    }

    .project_filter_section {
        justify-content: flex-end;
        margin-bottom: 30px;
    }

    .custom_select {
        min-width: 200px;
        padding: 10px 16px;
        font-size: 0.875rem;

        /* Simplified shadows for mobile */
        box-shadow:
                3px 3px 10px rgba(174, 174, 192, 0.2),
                -3px -3px 10px rgba(255, 255, 255, 0.8);
    }

    .selected_value {
        font-size: 0.875rem;
    }

    .custom_options {
        font-size: 0.875rem;
        max-height: 240px;
    }

    .custom_option {
        padding: 10px 16px;
    }

    /* Single column grid on tablet */
    .projects_container {
        grid-template-columns: 1fr;
        gap: 1.75rem;
        max-width: 500px;
        margin: 0 auto;
    }

    /* Simplified project cards */
    .project {
        border-radius: 20px;
        box-shadow:
                8px 8px 20px rgba(174, 174, 192, 0.15),
                -6px -6px 20px rgba(255, 255, 255, 0.8);
    }

    .project:hover {
        transform: translateY(-6px);
        box-shadow:
                10px 10px 25px rgba(174, 174, 192, 0.2),
                -8px -8px 20px rgba(255, 255, 255, 0.9);
    }

    .project-image {
        height: 200px;
    }

    .project_info {
        padding: 1.25rem 1.25rem 4.5rem; /* More space for buttons */
    }

    .project_info h3 {
        font-size: 1.125rem;
        margin-bottom: 0.75rem;
    }

    .project_info p {
        font-size: 0.875rem;
        line-height: 1.65; /* Better readability */
        margin-bottom: 1.25rem; /* More space before buttons */
    }

    /* KEEP BUTTONS SIDE BY SIDE on tablet */
    .project-actions {
        justify-content: space-between;
        bottom: 1.25rem;
        left: 1.25rem;
        right: 1.25rem;
        gap: 0.625rem;
    }

    .view-code-btn,
    .demo-btn {
        padding: 9px 14px;
        font-size: 0.8125rem;
        flex: 1;
    }

    .tech-tags {
        gap: 6px;
        margin-bottom: 10px;
    }

    .tech-tag {
        font-size: 0.75rem;
        padding: 4px 12px;
    }

    /* Empty state */
    .empty-state-message {
        padding: 3rem 1.5rem;
    }

    .empty-icon {
        font-size: 3rem;
    }

    .empty-state-message h3 {
        font-size: 1.5rem;
    }

    .empty-state-message p {
        font-size: 0.9375rem;
    }
}

/* Mobile (480px and below) */
@media (max-width: 480px) {
    .projects {
        padding: 3.5rem 1rem;
        scroll-margin-top: 30px;
    }

    /* Dropdown stays on right but smaller */
    .project_filter_section {
        margin-bottom: 25px;
    }

    .custom_select {
        min-width: 180px;
        padding: 9px 14px;
        border-radius: 10px;
    }

    .selected_value {
        font-size: 0.8125rem;
    }

    .custom_options {
        font-size: 0.8125rem;
        max-height: 200px;
        border-radius: 10px;
    }

    .custom_option {
        padding: 9px 14px;
    }

    .projects_container {
        gap: 1.5rem;
        max-width: 100%;
    }

    .project {
        border-radius: 18px;
    }

    .project-image {
        height: 180px;
    }

    .project_info {
        padding: 1.125rem 1.125rem 4rem; /* More bottom padding */
    }

    .project_info h3 {
        font-size: 1.0625rem;
        margin-bottom: 0.625rem;
    }

    .project_info p {
        font-size: 0.8125rem;
        line-height: 1.6;
        margin-bottom: 1rem; /* Space before buttons */
    }

    /* KEEP BUTTONS SIDE BY SIDE on mobile */
    .project-actions {
        justify-content: space-between;
        bottom: 1.125rem;
        left: 1.125rem;
        right: 1.125rem;
        gap: 0.5rem;
    }

    .view-code-btn,
    .demo-btn {
        padding: 9px 12px;
        font-size: 0.75rem;
        flex: 1;
        min-width: 0;
    }

    /* Make button text responsive */
    .view-code-btn span,
    .demo-btn span {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .tech-tags {
        gap: 5px;
        margin-bottom: 8px;
    }

    .tech-tag {
        font-size: 0.6875rem;
        padding: 3px 10px;
    }

    /* Empty state */
    .empty-state-message {
        padding: 2.5rem 1rem;
    }

    .empty-icon {
        font-size: 2.5rem;
    }

    .empty-state-message h3 {
        font-size: 1.3rem;
    }

    .empty-state-message p {
        font-size: 0.875rem;
    }
}

/* Extra Small Mobile (360px and below) */
@media (max-width: 360px) {
    .projects {
        padding: 3rem 0.75rem;
    }

    .custom_select {
        min-width: 160px;
        padding: 8px 12px;
    }

    .selected_value {
        font-size: 0.75rem;
    }

    .selected_value i {
        font-size: 0.875rem;
    }

    .project-image {
        height: 160px;
    }

    .project_info {
        padding: 1rem 1rem 3.75rem; /* Adequate space for buttons */
    }

    .project_info h3 {
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }

    .project_info p {
        font-size: 0.8rem;
        line-height: 1.55;
        margin-bottom: 0.875rem;
    }

    /* KEEP BUTTONS SIDE BY SIDE even on very small screens */
    .project-actions {
        bottom: 1rem;
        left: 1rem;
        right: 1rem;
        gap: 0.375rem;
    }

    .view-code-btn,
    .demo-btn {
        padding: 8px 10px;
        font-size: 0.7rem;
    }

    /* Hide button text icons on very small screens to save space */
    .view-code-btn i,
    .demo-btn i {
        display: none;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    .custom_select,
    .project,
    .view-code-btn,
    .demo-btn,
    .tech-tag {
        transition: transform 0.2s ease, box-shadow 0.2s ease;
    }

    .custom_select:active {
        transform: scale(0.98);
    }

    .project:active {
        transform: translateY(-4px) scale(0.99);
    }

    .view-code-btn:active,
    .demo-btn:active {
        transform: scale(0.96);
    }

    /* Remove shimmer effect on touch devices for performance */
    .project::before {
        display: none;
    }

    .project:hover .project-image img {
        transform: scale(1.03);
    }
}