/* Project Listings Page Styles - Matching Figma Design */

.project-listings-page {
    max-width: 100%;
    margin: 0;
    padding: 0;
    background: #ffffff;
}

/* Home link size on homepage */
.project-listings-page~.nav-bar .nav-home-link,
body:has(.project-listings-page) .nav-bar .nav-home-link {
    font-size: 14px;
}

/* Find a Project Section - Green Banner */
.find-project-section {
    height: 244px;
    /* Fixed height as requested */
    background: #243413;
    padding: 0;
    color: #ffffff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    /* Center the wrapper horizontally */
    box-shadow: 0px 4px 6px -4px #0000001A, 0px 10px 15px -3px #0000001A;
}

.find-project-wrapper {
    width: 100%;
    max-width: 1440px;
    padding: 0 40px;
    /* Padding from specs */
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.find-project-content {
    width: 961px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.find-project-text-frame {
    height: 54px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.find-project-title {
    font-size: 2rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0;
    line-height: 1;
    /* Ensure tight fit */
}

.find-project-description {
    font-size: 1rem;
    color: #ffffff;
    margin: 0;
    line-height: 1.2;
    /* Ensure tight fit */
    opacity: 0.95;
    max-width: 800px;
}

.find-project-filters {
    margin-top: 0;
    background: #93A481;
    border-radius: 12px;
    /* rounded-xl */
    padding: 16px;
    /* gap-4 */
    width: 100%;
    height: 86px;
    box-shadow: 0px 2px 4px -2px #0000001A, 0px 4px 6px -1px #0000001A;
    display: flex;
    align-items: center;
    box-sizing: border-box;
}

.filter-grid {
    display: grid;
    grid-template-columns: 118px 265px 273px 231px;
    gap: 11px;
    /* Adjusted to 11px per spec to fit container */
    width: 100%;
}

.filter-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #1a1a1a;
}

.filter-select {
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    /* Extra padding-right for dropdown arrow */
    border: 1px solid #E5E5E5;
    border-radius: 6px;
    font-size: 0.875rem;
    background: #ffffff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M2 4L6 8L10 4' stroke='%231a1a1a' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 12px;
    color: #1a1a1a;
    cursor: pointer;
    width: 100%;
    height: 36px;
    box-shadow: 0px 1px 2px 0px #0000001A;
    /* Remove default browser styling */
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

/* Specific Filter Styles */
#department {
    background-color: #7D8E6A;
    color: #ffffff;
    box-shadow: inset 2px 2px 4px 0px #0000004D;
    border: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M2 4L6 8L10 4' stroke='%23ffffff' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 12px;
}

#department option:disabled {
    color: #999999;
    font-style: italic;
}

#department option:not(:disabled) {
    color: #1a1a1a;
    font-style: normal;
}

.filter-select:focus {
    outline: none;
    border-color: #5C7C2F;
    box-shadow: 0 0 0 2px rgba(92, 124, 47, 0.2);
}

/* Project Listings Section */
.project-listings-section {
    padding: 2rem;
    max-width: 1440px;
    /* Match hero max-width */
    margin: 0 auto;
}

.listings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.listings-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0;
}

.search-form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input {
    padding: 0.625rem 2.5rem 0.625rem 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.875rem;
    width: 250px;
    transition: border-color 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: #2d5016;
    box-shadow: 0 0 0 3px rgba(45, 80, 22, 0.1);
}

.search-clear-button {
    position: absolute;
    right: 0.5rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #737373;
    transition: color 0.2s;
    z-index: 1;
}

.search-clear-button:hover {
    color: #1a1a1a;
}

.search-clear-button:focus {
    outline: 2px solid #2d5016;
    outline-offset: 2px;
    border-radius: 2px;
}

.search-button {
    padding: 0.625rem;
    background: #1a1a1a;
    /* Changed to black/dark per mockup search icon usually */
    color: #ffffff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.search-button:hover {
    background: #333;
}

/* Listings Content Layout */
.listings-content {
    display: grid;
    grid-template-columns: 1fr 260px;
    /* Projects take available space, sidebar fixed width */
    gap: 2rem;
    align-items: start;
}

/* View Options Sidebar */
.view-options-sidebar {
    background: #ffffff;
    border: 1px solid #E5E5E5;
    border-radius: 12px;
    padding: 1.5rem;
    /* Shadow per card spec */
    box-shadow: 0px 1px 3px 0px #0000001A;
}

.sidebar-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 1.5rem 0;
}

.view-options-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

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

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    padding: 0.75rem;
    border-radius: 4px;
    background-color: #FFF9E6;
    /* Light yellow background for this specific option */
    border: 1px solid transparent;
    /* Placeholder */
    transition: background 0.2s;
}

.checkbox-label:hover {
    background-color: #FFF0C2;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #1a1a1a;
}

.checkbox-label span {
    font-size: 0.875rem;
    color: #1a1a1a;
    line-height: 1.4;
}

.order-by-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.order-by-group fieldset {
    border: none;
    padding: 0;
    margin: 0;
}

.order-by-group legend {
    font-size: 0.875rem;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 0.5rem;
    padding: 0;
}

.order-by-label {
    font-size: 0.875rem;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 0.5rem;
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0;
    border-radius: 0;
    transition: opacity 0.2s;
}

.radio-label:hover {
    opacity: 0.8;
}

.radio-label input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #1a1a1a;
}

.radio-label span {
    font-size: 0.875rem;
    color: #1a1a1a;
}

.submit-button {
    padding: 0.75rem 1.5rem;
    background: #000000;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 0.5rem;
    width: 100%;
}

.submit-button:hover {
    background: #333333;
}

/* Projects Container */
.projects-container {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(450px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Project Card */
.project-card {
    background: #FFFFFF;
    /* var(--card) */
    border: 1px solid #E5E5E5;
    /* var(--border) */
    border-radius: 12px;
    /* rounded-xl */
    padding: 24px;
    /* 24px padding */
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 0px 1px 3px 0px #0000001A;
    min-height: 290px;
    /* justify-content: space-between removed per Issue #107 - causes weird spacing when no comments bar */
    gap: 0;
}

.project-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 0.375rem 0.75rem;
    border-radius: 16px;
    /* More rounded */
    font-size: 0.75rem;
    font-weight: 500;
    /* Medium weight for better contrast */
    margin-bottom: 1rem;
    width: fit-content;
    position: relative;
    z-index: 0;
}

/* Status badge colors - unified with project detail page per Issue #105 */
.status-cancelled {
    background-color: #FB7185;
    color: #1a1a1a;
}

.status-completed {
    background-color: #D3E7A6;
    color: #1a1a1a;
}

.status-developing {
    background-color: #BEE7F5;
    color: #1a1a1a;
}

.status-in-progress {
    background-color: #FBBF24;
    color: #1a1a1a;
}

.status-default {
    background: #e9ecef;
    color: #1a1a1a;
}

/* Project Date */
.project-date {
    font-size: 0.75rem;
    color: #666;
    margin: 0 0 0.75rem 0;
    font-weight: 500;
}

/* Details Button */
.details-button {
    position: absolute;
    top: 24px;
    right: 24px;
    padding: 0.5rem 1rem;
    background: #f8f9fa;
    color: #1a1a1a;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
    z-index: 1;
}

.details-button:hover {
    background: #e9ecef;
}

.details-button svg {
    vertical-align: middle;
    margin-left: 4px;
}

/* Project Title */
.project-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 0.75rem 0;
    line-height: 1.4;
    padding-right: 80px;
    /* Space for details button */
}

/* Project Description */
.project-description {
    font-size: 0.875rem;
    color: #666;
    line-height: 1.6;
    margin: 0 0 1.5rem 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Project Details */
.project-details {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
    color: #666;
}

.detail-row {
    display: flex;
    gap: 0.5rem;
}

.detail-row strong {
    color: #1a1a1a;
    font-weight: 700;
    min-width: 90px;
}

/* Comments Bar */
.comments-bar {
    background: #E8F2D9;
    /* Light green bar */
    border-radius: 8px;
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

.comments-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
}

.clock-icon {
    color: #000000;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.comments-status {
    font-weight: 700;
    color: #000000;
    font-size: 0.75rem;
    text-transform: uppercase;
    line-height: 1;
    display: flex;
    align-items: center;
}

.comments-deadline {
    color: #666;
    font-size: 0.75rem;
    margin-left: 0.25rem;
    line-height: 1;
    display: flex;
    align-items: center;
}

.add-comment-button {
    padding: 0.25rem 0.75rem;
    background: #000000;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 4px;
}

.add-comment-button:hover {
    background: #333333;
    color: #ffffff;
}

/* Results Count Styling */
.results-count {
    color: #666666;
    font-size: 14px;
    font-weight: 700;
}

/* No Results */
.no-results {
    text-align: center;
    padding: 3rem;
    background: #f8f9fa;
    border-radius: 8px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.no-results-message {
    font-size: 1.125rem;
    color: #666;
    margin-bottom: 1rem;
}

.btn-reset {
    padding: 0.5rem 1.5rem;
    background: white;
    color: #666;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
    transition: border-color 0.2s;
}

.btn-reset:hover {
    border-color: #999;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid #e5e7eb;
    grid-column: span 2;
}

.pagination-link {
    padding: 0.5rem 1rem;
    background: white;
    color: #2d5016;
    border: 1px solid #2d5016;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s;
}

.pagination-link:hover {
    background: #2d5016;
    color: white;
}

.pagination-info {
    font-size: 0.875rem;
    color: #666;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .listings-content {
        grid-template-columns: 1fr 240px;
    }
}

/* Transition breakpoint for find-project section */
@media (max-width: 1020px) {
    .find-project-section {
        height: auto;
        min-height: 244px;
        padding: 1.5rem 0;
    }

    .find-project-content {
        width: 100%;
        max-width: 100%;
    }

    .find-project-filters {
        height: auto;
        min-height: 86px;
    }

    .filter-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
    }
}

/* Tablet breakpoint - 2-column filter layout */
@media (max-width: 968px) {
    .find-project-section {
        height: auto;
        min-height: auto;
        padding: 1.5rem 0;
    }

    .find-project-content {
        width: 100%;
        max-width: 100%;
    }

    .find-project-filters {
        height: auto;
        min-height: auto;
    }

    .filter-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .listings-content {
        grid-template-columns: 1fr;
    }

    .view-options-sidebar {
        position: static;
        margin-bottom: 2rem;
    }

    .projects-grid {
        grid-template-columns: 1fr;
    }

    /* Fix search bar height mismatch at tablet */
    .search-input {
        height: 40px;
        box-sizing: border-box;
    }

    .search-button {
        width: 40px;
        height: 40px;
        min-width: 40px;
        min-height: 40px;
        padding: 0;
        box-sizing: border-box;
    }
}

@media (max-width: 640px) {

    /* Fix 1: Reduce filter section vertical space */
    .find-project-section {
        padding: 0.75rem 0.5rem;
        height: auto;
        min-height: auto;
    }

    .find-project-wrapper {
        padding: 0 0.5rem;
    }

    .find-project-content {
        width: 100%;
        max-width: 100%;
        gap: 10px;
        /* Reduced from 16px */
    }

    .find-project-text-frame {
        height: auto;
        gap: 2px;
        /* Reduced from 4px */
    }

    .find-project-title {
        font-size: 1.125rem;
        /* Slightly smaller */
    }

    .find-project-description {
        font-size: 0.75rem;
        /* Slightly smaller */
    }

    .find-project-filters {
        width: 100%;
        height: auto;
        min-height: auto;
        padding: 0.5rem;
        /* Reduced from 0.75rem */
    }

    .project-listings-section {
        padding: 1rem;
    }

    .filter-grid {
        grid-template-columns: 1fr 1fr;
        /* 2x2 grid instead of stacked */
        gap: 0.5rem;
        /* Reduced from 0.625rem */
    }

    .filter-field {
        gap: 1px;
        /* Reduced from 2px */
    }

    .filter-label {
        font-size: 0.6875rem;
    }

    .filter-select {
        font-size: 16px;
        /* Prevent iOS auto-zoom */
        min-height: 40px;
        height: 40px;
        padding: 0.5rem 2.25rem 0.5rem 0.75rem;
        background-position: right 0.75rem center;
        background-size: 12px;
    }

    .listings-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .search-form {
        width: 100%;
        max-width: 100%;
        gap: 0.5rem;
    }

    .search-input-wrapper {
        flex: 1;
        max-width: calc(100% - 50px);
        /* Leave space for button */
    }

    .search-input {
        width: 100%;
        max-width: 100%;
        font-size: 16px;
        /* Prevent iOS auto-zoom */
        height: 40px;
        /* Fixed height instead of min-height */
        min-height: auto;
        padding: 0.5rem 2rem 0.5rem 0.75rem;
        box-sizing: border-box;
    }

    .search-button {
        width: 40px;
        height: 40px;
        min-width: auto;
        min-height: auto;
        padding: 0.5rem;
        flex-shrink: 0;
        /* Prevent button from shrinking */
    }

    .search-clear-button {
        width: 32px;
        height: 32px;
        min-width: auto;
        min-height: auto;
        padding: 0.25rem;
    }

    /* Fix 5: Consistent card spacing */
    .project-card {
        min-height: auto;
        padding: 0.875rem;
        display: flex;
        flex-direction: column;
        gap: 0.375rem;
        /* Tighter internal gap */
        justify-content: flex-start;
    }

    .status-badge {
        margin-bottom: 0.25rem;
        /* Reduced from 0.5rem */
        align-self: flex-start;
        order: 0;
        /* First element */
    }

    /* Fix 3: Compact Details button but keep gray box style */
    .details-button {
        position: static;
        margin: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: unset;
        height: auto;
        padding: 0.25rem 0.5rem;
        width: auto;
        text-align: left;
        order: 5;
        align-self: flex-start;
        background: #f8f9fa;
        border: none;
        box-shadow: none;
        outline: none;
        color: #1a1a1a;
        font-weight: 500;
        font-size: 0.8125rem;
        text-decoration: none;
        border-radius: 4px;
    }

    .project-title {
        padding-right: 0;
        font-size: 1rem;
        margin-top: 0;
        margin-bottom: 0.25rem;
        /* Reduced from 0.5rem */
        order: 1;
    }

    .project-description {
        order: 2;
        margin-bottom: 0.5rem;
        /* Reduced from 1rem for consistency */
    }

    .project-details {
        order: 3;
        margin-bottom: 0.5rem;
        /* Reduced from 0.75rem */
        gap: 0.25rem;
        /* Tighter gap */
    }

    .detail-row {
        gap: 0.375rem;
    }

    .detail-row strong {
        min-width: 80px;
        font-size: 0.8125rem;
    }

    .project-details .detail-row span,
    .detail-row:not(:has(span)) {
        font-size: 0.8125rem;
    }

    /* Fix 4: Improve comments bar layout alignment */
    .comments-bar {
        order: 4;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.375rem 0.5rem;
        /* row gap, column gap */
        align-items: center;
        justify-content: space-between;
        padding: 0.5rem;
        /* Tighter padding */
        margin-top: 0.375rem;
    }

    .comments-info {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.375rem;
        /* Slightly more gap for readability */
        flex: 1;
        width: 100%;
    }

    .comments-status {
        display: inline;
        line-height: 1.4;
        font-size: 0.6875rem;
        font-weight: 700;
    }

    .comments-deadline {
        margin-left: 0.25rem;
        display: inline;
        line-height: 1.4;
        font-size: 0.6875rem;
    }

    /* Fix 2: Constrain 'Add' button width - more compact on mobile */
    .add-comment-button {
        min-height: unset;
        height: auto;
        padding: 0.25rem 0.5rem;
        /* Tighter padding */
        font-size: 0.75rem;
        line-height: 1.2;
        white-space: nowrap;
        width: auto;
        min-width: unset;
        max-width: fit-content;
        justify-content: center;
        margin-top: 0;
        align-self: flex-start;
        display: inline-flex;
        border-radius: 4px;
    }

    .submit-button {
        min-height: 44px;
        padding: 0.875rem 1.5rem;
        width: 100%;
    }

    .pagination-link {
        min-height: 44px;
        min-width: 44px;
        padding: 0.75rem 1rem;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .projects-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

/* Very small mobile screens */
@media (max-width: 375px) {
    .find-project-section {
        padding: 0.5rem 0.375rem;
    }

    .find-project-wrapper {
        padding: 0 0.375rem;
    }

    /* Stack filters to single column on very small screens */
    .filter-grid {
        grid-template-columns: 1fr;
        gap: 0.375rem;
    }

    .project-listings-section {
        padding: 0.75rem;
    }

    .listings-title {
        font-size: 1rem;
    }

    .project-card {
        padding: 0.875rem;
        gap: 0.375rem;
    }

    .details-button {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
        min-height: unset;
        /* Keep gray box style consistent with larger viewports */
        background: #f8f9fa !important;
        border-radius: 4px;
    }

    .add-comment-button {
        padding: 0.1875rem 0.375rem;
        font-size: 0.6875rem;
        min-height: unset;
    }

    .comments-bar {
        padding: 0.5rem;
    }
}

/* Extra small mobile screens (400px and below - matching screenshot) */
@media (max-width: 400px) {
    .project-card {
        padding: 1rem;
    }

    .project-title {
        font-size: 0.9375rem;
    }

    .project-description {
        font-size: 0.8125rem;
        margin-bottom: 0.75rem;
    }

    .detail-row {
        flex-direction: column;
        gap: 0.125rem;
    }

    .detail-row strong {
        min-width: auto;
    }

    .project-details {
        margin-bottom: 0.625rem;
    }
}