/* Project Detail Page Styles */

/* Global box-sizing reset for this page */
.project-detail-page,
.project-detail-page *,
.project-detail-page *::before,
.project-detail-page *::after {
    box-sizing: border-box;
}

.project-detail-page {
    max-width: 1440px;
    margin: 0 auto;
    padding: 2rem 40px;
    font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #1a1a1a;
    overflow-x: hidden; /* Prevent horizontal scroll */
    width: 100%;
}

/* Ensure text wraps properly */
.project-detail-page p,
.project-detail-page h1,
.project-detail-page h2,
.project-detail-page h3,
.project-detail-page span,
.project-detail-page dd,
.project-detail-page dt {
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

/* Hide nav-bar on project detail page - breadcrumb bar replaces it */
.project-detail-page ~ .nav-bar,
body:has(.project-detail-page) .nav-bar {
    display: none;
}

/* 1. Breadcrumb Bar - Light grey bar with dark green top border (Issue #60) */
/* Now placed outside content-wrapper via {% block breadcrumb %} for natural full-width */
.breadcrumb-bar {
    background-color: #F0F0F0;
    border-top: 8px solid #243413;
    padding: 6px 0;
    width: 100%;
    height: auto;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    position: relative;
    z-index: 10;
    box-sizing: border-box;
}

.breadcrumb-content {
    display: flex;
    align-items: center;
    gap: 24px;
    color: #1B1B1B;
    font-size: 13px;
    font-weight: 400;
    max-width: 1320px;
    width: 100%;
    margin: 0 auto;
    padding: 0 40px;
}

.breadcrumb-link {
    color: #1B1B1B;
    text-decoration: none;
    font-weight: 400;
    transition: color 0.2s;
}

.breadcrumb-link:hover {
    color: #243413;
}

.breadcrumb-separator {
    color: #1B1B1B;
    font-weight: 400;
    height: 20px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.breadcrumb-current {
    color: #1B1B1B;
    font-weight: 400;
}

/* 2. Header Section */
.project-header {
    margin-bottom: 2rem;
}

.header-top {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.project-title {
    font-size: 2rem; /* ~32px */
    font-weight: 700;
    color: #111827;
    margin: 0;
    line-height: 1.2;
}

/* Status Badge - Matching project listings page style */
.status-badge {
    display: inline-block;
    padding: 0.375rem 0.75rem;
    border-radius: 16px; /* More rounded - matches listings */
    font-size: 0.75rem; /* 12px */
    font-weight: 500; /* Medium weight for better contrast */
    width: fit-content;
    white-space: nowrap;
}

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

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

.status-cancelled {
    background-color: #FB7185;
    color: #1a1a1a;
}

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

.project-hierarchy {
    font-size: 0.875rem;
    color: #6B7280;
    font-weight: 500;
    margin-top: 0.5rem;
}

/* 3. "Open for Comments" Banner */
.comment-banner {
    /* Specs: width 892 (max), height 52 (min), bg #E8F2D9, rounded-xl, shadow */
    background-color: #E8F2D9;
    border: 1px solid #E5E5E5; /* Using border color from specs */
    border-radius: 0.75rem; /* rounded-xl */
    margin-bottom: 2.5rem;
    
    display: flex;
    align-items: center;
    justify-content: space-between;
    
    box-shadow: 0px 1px 3px 0px rgba(0, 0, 0, 0.1);
    min-height: 52px;
    max-width: 892px; /* Constrain width if container is wider */
}

.banner-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0 0.5rem; /* padding-left/right: gap-2 approx */
}

.banner-text {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #1a1a1a;
    font-size: 0.95rem;
}

.clock-icon {
    font-size: 1.1rem;
    color: #1a1a1a;
    display: flex;
    align-items: center;
    justify-content: center;
}

.banner-label {
    font-weight: 800; /* OPEN FOR COMMENTS! Bold */
    color: #1a1a1a;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.02em;
}

.deadline-text {
    color: #4B5563;
    font-weight: 400;
    font-size: 0.9rem;
}

.btn-add-comment {
    background-color: #111827; /* Dark button */
    color: #fff;
    padding: 0.5rem 1.25rem;
    border-radius: 0.375rem; /* rounded-md approx for button inside xl banner */
    text-decoration: none;
    font-weight: 600;
    font-size: 0.875rem;
    transition: background-color 0.2s;
    white-space: nowrap;
}

.btn-add-comment:hover {
    background-color: #374151;
}

/* 4. Content Layout (2-Column) */
.project-content-grid {
    display: grid;
    grid-template-columns: 892px 434px; /* Fixed widths based on specs */
    gap: 2rem; /* Gap 32px approx */
    align-items: start;
}

/* Main Column Sections */
.main-column {
    max-width: 892px;
}

.content-section {
    margin-bottom: 3rem;
}

.section-title {
    font-size: 1.125rem; /* 18px */
    font-weight: 700;
    color: #111827;
    margin-bottom: 1rem;
}

.section-divider {
    border: 0;
    height: 1px;
    background-color: #E5E5E5;
    margin-bottom: 1.5rem;
}

/* Description Text Spec */
.description-section p {
    font-family: 'Open Sans', sans-serif; /* family/sans */
    font-weight: 500; /* weight/medium */
    font-style: normal;
    font-size: 1rem; /* size/base */
    line-height: 1.5; /* leading/6 (24px) */
    letter-spacing: normal;
    color: #737373; /* var(--muted-foreground) */
    margin: 0;
}

/* Agency Info Grid */
.info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* 2 columns for info */
    gap: 1.5rem;
}

.info-item dt {
    font-weight: 700;
    color: #111827;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.info-item dd {
    margin: 0;
    color: #4B5563;
    font-size: 0.875rem;
    line-height: 1.4;
}

/* Forests display styling */
.forests-list {
    display: inline;
}

.forest-chip {
    display: inline-block;
    background-color: #F3F4F6;
    border: 1px solid #E5E7EB;
    border-radius: 0.375rem;
    padding: 0.25rem 0.5rem;
    margin: 0.125rem;
    font-size: 0.875rem;
    color: #374151;
}

/* Milestones Table */
.milestones-section {
    margin-top: 2rem;
}

.milestones-header {
    display: grid;
    grid-template-columns: 1fr 1fr;
    margin-bottom: 1rem;
    gap: 1rem;
}

.milestone-col-header {
    font-size: 0.875rem;
    color: #111827;
}

.milestones-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid #E5E5E5;
    border-radius: 0.375rem;
    overflow: hidden; /* For rounded corners on table */
}

.milestones-table thead {
    background-color: #F9FAFB;
}

.milestones-table th {
    text-align: left;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #E5E5E5;
    font-weight: 600;
    font-size: 0.875rem;
    color: #374151;
}

.milestones-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #E5E5E5;
    font-size: 0.875rem;
    color: #4B5563;
}

.milestones-table tr:last-child td {
    border-bottom: none;
}


/* Sidebar Styles */
.sidebar-column {
    display: flex;
    flex-direction: column;
    gap: 16px; /* Spec gap */
    width: 434px; /* Spec width */
}

/* Sidebar Cards Common Styles */
.sidebar-card {
    background: #FFFFFF;
    border: 1px solid #E5E5E5;
    border-radius: 0.75rem; /* rounded-xl */
    overflow: hidden;
    box-shadow: 0px 1px 3px 0px rgba(0, 0, 0, 0.1); /* shadow */
    width: 434px; /* Spec width */
}

/* Map Card Specifics */
.map-card {
    width: 434px;
    height: 358px;
    display: flex;
    flex-direction: column;
    border-radius: 0.75rem; /* rounded-xl */
    border: 1px solid #E5E5E5;
    border-top: 1px solid #E5E5E5;
    background: #FFFFFF;
    box-shadow: 0px 1px 3px 0px rgba(0, 0, 0, 0.1);
    box-sizing: border-box;
    overflow: hidden;
}

#map {
    width: 100%;
    height: 100%; /* Fill the entire card */
    z-index: 1;
}

/* Contact Card Specifics */
.contact-card {
    width: 434px;
    height: 208px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 24px 1.5rem 24px 1.5rem; /* py-6 top/bottom, px-6 left/right, add 24px bottom */
    padding-bottom: 48px; /* 24px original + 24px extra = 48px total */
    border-radius: 0.75rem; /* rounded-xl */
    border: 1px solid #E5E5E5;
    background: #FFFFFF;
    box-shadow: 0px 1px 3px 0px rgba(0, 0, 0, 0.1);
    box-sizing: border-box;
}

.card-title {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 1rem 0;
    color: #111827;
}

.contact-details p {
    margin: 0 0 0.35rem 0;
    font-size: 0.875rem;
    color: #4B5563;
    line-height: 1.4;
}

.contact-name {
    color: #111827 !important;
    font-weight: 600;
    margin-bottom: 0.25rem !important;
}

.contact-details a {
    color: #4B5563;
    text-decoration: underline;
}

.contact-details a:hover {
    color: #111827;
}


/* Responsive Adjustments */
@media (max-width: 1350px) {
    .project-content-grid {
        grid-template-columns: 2fr 1fr;
        gap: 2rem;
    }
    
    .sidebar-column, .sidebar-card, .map-card, .contact-card {
        width: 100%;
        height: auto;
        min-height: 200px;
    }

    .map-card {
        height: 350px;
    }
    
    .main-column, .comment-banner {
        max-width: 100%;
    }
}

@media (max-width: 900px) {
    .project-content-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        width: 100%;
        max-width: 100%;
    }

    .project-detail-page {
        padding: 1rem;
        width: 100%;
        max-width: 100%;
    }

    /* Force all sidebar elements to respect viewport width */
    .sidebar-column,
    .sidebar-card,
    .map-card,
    .contact-card {
        width: 100% !important;
        max-width: 100% !important;
    }

    .main-column {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    .content-section {
        width: 100%;
        max-width: 100%;
    }

    .info-grid {
        width: 100%;
        max-width: 100%;
    }

    .breadcrumb-bar {
        padding: 12px 1rem;
        height: auto;
        min-height: 44px;
    }

    .breadcrumb-content {
        font-size: 12px;
        gap: 12px;
        flex-wrap: wrap;
        padding: 0 1rem;
    }

    .project-title {
        font-size: 1.5rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    .project-hierarchy {
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    .comment-banner {
        max-width: 100%;
        padding: 1rem;
        width: 100%;
        box-sizing: border-box;
    }

    .description-section {
        width: 100%;
        max-width: 100%;
    }

    .description-section p {
        max-width: 100%;
    }

    .banner-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .banner-text {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .btn-add-comment {
        width: 100%;
        text-align: center;
        min-height: 44px;
        padding: 0.75rem 1.5rem;
    }

    .header-top {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

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

    .milestones-header {
        grid-template-columns: 1fr;
    }

    /* Add horizontal scroll for milestones table on mobile */
    .milestones-section {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .milestones-table {
        font-size: 0.875rem;
        min-width: 100%; /* Allow table to fit container */
        width: 100%;
    }

    .milestones-table th,
    .milestones-table td {
        padding: 0.5rem;
        white-space: normal; /* Allow text wrapping on mobile */
        word-wrap: break-word;
    }

    .map-card {
        height: 300px;
        min-height: 300px;
    }

    .contact-card {
        height: auto;
        min-height: auto;
        padding-bottom: 1.5rem;
    }

    /* Description text should wrap properly */
    .description-section p {
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
}

/* Mobile-specific styles (max-width: 480px) */
@media (max-width: 480px) {
    .project-detail-page {
        padding: 0.75rem;
        width: 100%;
        overflow-x: hidden;
    }

    .breadcrumb-bar {
        padding: 10px 0.75rem;
    }

    .breadcrumb-content {
        padding: 0 0.5rem;
        font-size: 11px;
        gap: 8px;
    }

    .project-title {
        font-size: 1.25rem;
        line-height: 1.3;
    }

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

    .map-card {
        height: 250px;
        min-height: 250px;
        width: 100% !important;
    }

    .contact-card {
        width: 100% !important;
        padding: 1rem;
    }

    .sidebar-column {
        width: 100% !important;
        gap: 1rem;
    }

    /* Ensure description text fits */
    .description-section p {
        font-size: 0.9375rem;
    }

    /* Info items should stack properly */
    .info-item dt,
    .info-item dd {
        font-size: 0.8125rem;
    }
}
