/* Projects Section Styling */
.projects-section {
    background-color: #f8f9fa;
    padding: 40px 0;
    min-height: 100vh;
}

/* Page Header */
.projects-header {
    text-align: center;
    margin-bottom: 3rem;
}

.projects-title {
    color: #8CC63E;
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.projects-subtitle {
    color: #6c757d;
    font-size: 1.2rem;
    line-height: 1.6;
    max-width: 800px;
    margin: 0 auto;
}

/* Search and Sort Controls - Same as other pages */
.project-tile.search-hidden {
    display: none !important;
}

.projects-controls {
    position: relative;
    z-index: 1000;
    margin-bottom: 2rem;
}

/* Search container with integrated clear button */
.search-container {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box {
    position: relative;
    flex-grow: 1;
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
    z-index: 5;
}

.search-box input {
    padding-left: 2.5rem;
    padding-right: 3rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    transition: all 0.3s ease;
    width: 100%;
}

.search-box input:focus {
    border-color: #999999;
    box-shadow: 0 0 0 0.2rem rgba(153, 153, 153, 0.25);
}

/* Clear button */
.clear-search-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    color: #6c757d;
    border: none;
    border-radius: 6px;
    width: 32px;
    height: 32px;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
}

.clear-search-btn.show {
    display: flex !important;
}

.clear-search-btn i:hover {
    color: #C3020D;
    transform: scale(1.5);
}

.clear-search-btn i {
    font-size: 0.8rem;
    transition: all 0.3s ease;
}

/* Filter and Sort Icons */
.filter-icon-container,
.sort-icon-container {
    position: relative;
    display: flex;
    justify-content: flex-end;
    z-index: 1002;
    isolation: isolate;
    margin-right: 0.5rem;
}

.filter-icon,
.sort-icon {
    background: none;
    color: #6c757d;
    width: 45px;
    height: 45px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    box-shadow: 0 2px 4px rgba(153, 153, 153, 0.25);
}

.filter-icon:hover,
.sort-icon:hover {
    background: #999999;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(153, 153, 153, 0.25);
}

.filter-icon.has-active-filters,
.sort-icon.has-active-sort {
    background: #8CC63E;
    color: white;
    box-shadow: 0 2px 8px rgba(140, 198, 62, 0.3);
}

.filter-icon.has-active-filters:hover,
.sort-icon.has-active-sort:hover {
    background: #6f9e32;
}

.filter-icon i,
.sort-icon i {
    font-size: 1.1rem;
}

/* Filter Section Styling */
.filters-section {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border: 2px solid #e9ecef;
    
    opacity: 0;
    transform: translateY(-10px) scale(0.98);
    visibility: hidden;
    transition: all 0.3s ease;
    
    max-height: 0;
    overflow: hidden;
    padding-top: 0;
    padding-bottom: 0;
}

.filters-section.show {
    visibility: visible;
    opacity: 1;
    transform: translateY(0) scale(1);
    margin-bottom: 2rem;
    max-height: 500px;
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
}

.filters-content {
    max-height: none;
    overflow: visible;
    padding-top: 0;
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.filter-group {
    display: flex;
    flex-direction: column;
}

.filter-label {
    font-weight: 600;
    color: #495057;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-select {
    padding: 0.5rem 0.75rem;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    background: white;
    color: #495057;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    cursor: pointer;
}

.filter-select:focus {
    outline: none;
    border-color: #698EE9;
    box-shadow: 0 0 0 0.2rem rgba(105, 142, 233, 0.25);
}

.filter-select:hover {
    border-color: #698EE9;
}

.filter-select.has-filter {
    border-color: #698EE9;
    background: #f0f4ff;
}

/* Clear Filters Button */
.clear-filters-container {
    margin-top: 1rem;
    text-align: right;
}

.clear-filters-btn {
    background: #ffeff0;
    border: 1px solid #C3020D;
    color: #C3020D;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: none;
}

.clear-filters-btn.show {
    display: inline-block;
}

.clear-filters-btn:hover {
    background: #ffd7da;
    color: #C3020D;
}

/* Sort Popup Styling */
.sort-icon-container {
    position: relative;
    z-index: 1001;
    isolation: isolate;
}

.sort-popup {
    position: absolute !important;
    top: 55px;
    right: auto;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    z-index: 9999 !important;
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.sort-popup.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.sort-popup-header {
    padding: 1rem;
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sort-popup-title {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: #495057;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.direction-arrow {
    color: #6c757d;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.3s ease;
    min-width: 20px;
    text-align: center;
}

.direction-arrow:hover {
    color: #495057;
    background: rgba(0, 0, 0, 0.05);
    transform: scale(1.1);
}

.direction-arrow.disabled {
    color: #dee2e6;
    cursor: not-allowed;
}

.direction-arrow.disabled:hover {
    color: #dee2e6;
    background: none;
    transform: none;
}

.sort-options {
    padding: 0.5rem 0;
}

.sort-option {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.sort-option:hover {
    background-color: #f8f9fa;
}

.sort-option.active {
    background-color: #e3f2fd;
    color: #698EE9;
}

.sort-option i {
    margin-right: 0.75rem;
    width: 16px;
    color: #6c757d;
}

.sort-option.active i {
    color: #698EE9;
}

.sort-option-text {
    font-size: 0.9rem;
    font-weight: 500;
}

.sort-option-divider {
    border-top: 1px solid #e9ecef;
    margin: 0.5rem 0;
}

.sort-option.reset-option {
    color: #6c757d;
    font-style: italic;
    padding: 0.5rem 1rem;
}

.sort-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9998;
    display: none;
}

.sort-backdrop.show {
    display: block;
}

/* PROJECT TILES GRID - The main feature! */
.project-tiles-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin: 1rem 0;
}

.project-tile {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    position: relative;
    height: 480px;
    display: flex;
    flex-direction: column;
}

.project-tile:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.project-tile.featured {
    /* Remove yellow border - featured indication is now just the star */
}

/* Top Section with grey background */
.project-top-section {
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    padding: 1rem;
    position: relative;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

/* Project Image - Circular in top left of top section */
.project-image {
    width: 75px;
    height: 75px;
    border-radius: 50%;
    overflow: hidden;
    background: white;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

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

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

.project-image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    font-size: 1.5rem;
    background: #cccccc;
}

/* Featured star - absolute top right corner of tile */
.featured-star-overlay {
    position: absolute;
    top: 4px;
    right: 6px;
    color: #FFD700;
    font-size: 1rem;
    text-shadow: 0 0 3px rgba(255, 215, 0, 0.5);
    z-index: 20;
    pointer-events: none;
}

/* Top Right Badges - without featured star */
.project-badges {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Remove the inline featured star from badges */
.featured-star {
    display: none;
}

.badges-container {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.project-type-badge,
.project-status-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.project-type-badge {
    background: #e3f2fd;
    color: #1976d2;
    border: 1px solid #bbdefb;
}

/* Status Badge Colors */
.project-status-badge.status-active {
    background: #e8f5e8;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

.project-status-badge.status-completed {
    background: #f3e5f5;
    color: #7b1fa2;
    border: 1px solid #e1bee7;
}

.project-status-badge.status-planned {
    background: #fff3e0;
    color: #f57c00;
    border: 1px solid #ffcc02;
}

.project-status-badge.status-on_hold {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ffcdd2;
}

/* Project Info Container - Now below the top section */
.project-info {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

/* Project Title */
.project-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #212529;
    margin-bottom: 0.75rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Project Description */
.project-description {
    color: #6c757d;
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 1rem;
    flex-grow: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Research Areas Tags */
.research-areas-tags {
    margin-bottom: 1.25rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.research-area-tag {
    background: #f8f9fa;
    color: #495057;
    padding: 0.25rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid #e9ecef;
    white-space: nowrap;
}

.research-area-tag.more-tag {
    background: #8CC63E;
    color: white;
    border-color: #8CC63E;
}

/* Project Action Buttons */
.project-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: auto;
}

.project-btn {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
    min-width: 0;
    border: none;
    cursor: pointer;
}

/* Regular buttons (demo and images) take equal space */
.project-btn:not(.project-btn-github) {
    flex: 1;
}

.project-btn span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.project-btn i {
    flex-shrink: 0;
}

.project-btn-demo {
    background: #8CC63E;
    color: white;
}

.project-btn-demo:hover {
    background: #6f9e32;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(140, 198, 62, 0.3);
}

/* GitHub button - compact when with other buttons, full when alone */
.project-btn-github {
    background: #f8f9fa;
    color: #6c757d;
    border: 1px solid #e9ecef;
    flex: none; /* Don't grow with other buttons */
    min-width: 40px; /* Just enough for icon */
    padding: 0.5rem; /* Square padding for icon-only */
}

.project-btn-github:hover {
    background: #e9ecef;
    color: #495057;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.2);
}

/* When GitHub is the only button, show text and make it full width */
.project-actions:has(.project-btn-github):not(:has(.project-btn-demo)):not(:has(.project-btn-images)) .project-btn-github {
    flex: 1;
    padding: 0.5rem 1rem;
    background: #495057;
    color: white;
}


.project-actions:has(.project-btn-github):not(:has(.project-btn-demo)):not(:has(.project-btn-images)) .project-btn-github:hover {
    background: #1a1e22;
    color: white;
    box-shadow: 0 4px 12px rgba(36, 41, 46, 0.3);
}

/* Hide GitHub text when other buttons are present */
.project-actions:has(.project-btn-demo) .project-btn-github span,
.project-actions:has(.project-btn-images) .project-btn-github span {
    display: none;
}

/* Show GitHub text when it's the only button */
.project-actions:has(.project-btn-github):not(:has(.project-btn-demo)):not(:has(.project-btn-images)) .project-btn-github span {
    display: inline;
}

.project-btn-images {
    background: #698EE9;
    color: white;
}

.project-btn-images:hover {
    background: #5a7ed4;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(105, 142, 233, 0.3);
}

/* Filter Animations */
.project-tile.filtered-out {
    opacity: 0;
    transform: scale(0.95);
    max-height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.project-tile.filtered-in {
    opacity: 1;
    transform: scale(1);
    transition: all 0.3s ease;
}

/* Stats Cards */
.projects-stats {
    margin-top: 3rem;
}

.projects-stats .row {
    display: flex;
    align-items: stretch;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    border: 2px solid transparent;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 120px;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: #8CC63E;
    margin-bottom: 0.5rem;
}

.stat-label {
    color: #6c757d;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.9rem;
}

/* No Results Message */
.no-results {
    text-align: center;
    padding: 3rem;
    color: #6c757d;
    grid-column: 1 / -1;
}

.no-results i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.no-results h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.no-results p {
    font-size: 1.1rem;
}

/* IMAGE MODAL STYLING */
.modal-xl {
    max-width: 80%;
}

#imageModal .modal-content {
    border-radius: 12px;
    overflow: hidden;
    background: transparent;  
}

#imageModal .modal-header {
    background: #f8f9fa;
    color: #999999;
}

#imageModal .modal-body {
    padding: 0;
    background: rgba(0, 0, 0, 0.3);    
    backdrop-filter: blur(15px);        
    -webkit-backdrop-filter: blur(15px); 
    border: 1px solid rgba(255, 255, 255, 0.1); 
}

.carousel-inner {
    border-radius: 0;
}

.carousel-item {
    height: 70vh;
    min-height: 400px;
}

.carousel-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    padding: 1rem
}

.carousel-control-prev,
.carousel-control-next {
    width: 8%;
    opacity: 0.8;
}

.carousel-control-prev:hover,
.carousel-control-next:hover {
    opacity: 1;
}

.carousel-control-prev-icon,
.carousel-control-next-icon {
    width: 3rem;
    height: 3rem;
}

.carousel-indicators {
    margin-bottom: 1rem;
}

.carousel-indicators [data-bs-target] {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin: 0 4px;
    opacity: 0.5;
}

.carousel-indicators .active {
    opacity: 1;
}

/* RESPONSIVE DESIGN */
@media (max-width: 1200px) {
    .projects-title {
        font-size: 2.5rem;
    }
    
    .projects-subtitle {
        font-size: 1.1rem;
    }
    
    .project-tiles-grid {
        gap: 1.5rem;
    }
    
    .project-tile {
        height: 450px;
    }
    
    .project-image {
        width: 65px;
        height: 65px;
        border-width: 2px;
    }
    
    .project-top-section {
        padding: 0.875rem;
        min-height: 70px;
    }

    .project-type-badge,
    .project-status-badge {
        font-size: .6rem;
    }
}

@media (max-width: 992px) {
    .projects-section {
        padding: 60px 0;
    }
    
    .projects-title {
        font-size: 2.25rem;
    }
    
    /* 2 columns on tablets */
    .project-tiles-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    .project-tile {
        height: 420px;
    }
    
    .project-image {
        width: 55px;
        height: 55px;
        border-width: 2px;
    }
    
    .project-top-section {
        padding: 0.75rem;
        min-height: 65px;
    }
    
    .filters-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .filter-icon,
    .sort-icon {
        width: 40px;
        height: 40px;
    }
    
    .modal-xl {
        max-width: 90%;
    }
}

@media (max-width: 768px) {
    .projects-section {
        padding: 40px 0;
    }
    
    .projects-title {
        font-size: 2rem;
    }
    
    .projects-subtitle {
        font-size: 1rem;
    }
    
    /* 1 column on mobile */
    .project-tiles-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .project-tile {
        height: auto;
        min-height: 380px;
        width: 80%;
        justify-self: center;
    }
    
    .project-image {
        width: 50px;
        height: 50px;
        border-width: 2px;
    }
    
    .project-image-placeholder {
        font-size: 1.2rem;
    }
    
    .project-top-section {
        padding: 0.75rem;
        min-height: 60px;
        gap: 0.5rem;
    }
    
    .featured-star-overlay {
        font-size: 0.9rem;
        top: 6px;
        right: 6px;
    }
    
    .project-type-badge,
    .project-status-badge {
        font-size: 0.7rem;
        padding: 0.2rem 0.4rem;
    }
    
    .featured-star {
        font-size: 0.9rem;
    }
    
    .project-actions {
        flex-direction: column;
    }
    
    .project-btn {
        flex: none;
    }
    
    .stat-number {
        font-size: 2rem;
    }
    
    .sort-icon,
    .filter-icon {
        width: 40px;
        height: 40px;
    }
    
    .clear-search-btn {
        width: 28px;
        height: 28px;
    }
    
    .modal-xl {
        max-width: 95%;
    }
    
    .carousel-item {
        height: 50vh;
        min-height: 300px;
    }

    .stat-card {
        width: 60%;
        justify-self: center;
    }
}

@media (max-width: 576px) {
    .projects-controls .row {
        --bs-gutter-x: 0.75rem;
    }
    
    .projects-controls .col-lg-5,
    .projects-controls .col-lg-7 {
        margin-bottom: 0.5rem;
    }
    
    .project-image {
        width: 45px;
        height: 45px;
        border-width: 2px;
    }
    
    .project-image-placeholder {
        font-size: 1rem;
    }
    
    .project-top-section {
        padding: 0.5rem;
        min-height: 55px;
        gap: 0.5rem;
    }
    
    .featured-star-overlay {
        font-size: 0.8rem;
        top: 5px;
        right: 5px;
    }
    
    .badges-container {
        gap: 0.25rem;
    }
    
    .project-type-badge,
    .project-status-badge {
        font-size: 0.65rem;
        padding: 0.15rem 0.3rem;
    }
    
    .featured-star {
        font-size: 0.8rem;
    }
    
    .project-title {
        font-size: 1.1rem;
    }
    
    .project-description {
        font-size: 0.9rem;
    }
    
    .research-area-tag {
        font-size: 0.7rem;
        padding: 0.2rem 0.5rem;
    }
    
    .project-btn {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
}