/* variables */
:root {
    --pl-gold: #c69c6d;
    --pl-text-dark: #333;
    --pl-text-light: #666;
    --pl-border: #e1e1e1;
    --pl-bg-white: #ffffff;
}

/* Page Wrapper Adjustments */
.pl-page-wrapper {
    background-color: var(--pl-bg-white);
    padding: 60px 0;
}

/* Header Section: Title & Search */
.pl-header-section {
    display: flex;
    flex-direction: column;
    margin-bottom: 40px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.pl-title-container {
    padding-left: 15px;
    border-left: 5px solid #c69c6d; /* Golden accent bar */
    margin-bottom: 30px;
    line-height: 1.2;
}

.pl-page-title {
    font-size: 24px;
    margin: 0;
    font-weight: 700;
    color: #333;
}

.pl-nav-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    border-bottom: 2px solid #f0f0f0;
    width: 100%;
    position: relative;
}

/* Tabs Panel Styles */
.pl-tabs-panel {
    display: flex;
    gap: 30px;
}

.pl-tab-btn {
    padding: 10px 0 15px 0;
    background: none !important;
    border: none !important;
    text-decoration: none !important;
    color: #666;
    font-size: 15px;
    
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    border-bottom: 4px solid transparent !important;
    margin-bottom: -2px; /* Sits on the nav-row border */
}

.pl-tab-icon {
    width: 20px !important;
    height: 20px !important;
    min-width: 20px;
    display: block;
    filter: grayscale(1) opacity(0.6);
}

.pl-tab-btn:hover {
    color: #333;
}

.pl-tab-btn.active {
    color: #288244; /* WordPress Green */
    border-bottom-color: #288244 !important;
}

.pl-tab-btn.active .pl-tab-icon {
    filter: invert(41%) sepia(13%) saturate(3025%) hue-rotate(93deg) brightness(95%) contrast(82%);
    opacity: 1;
}

/* Search Container Styles */
.pl-search-container {
    padding-bottom: 12px;
}

.pl-search-wrapper {
    display: flex;
    align-items: center;
    border-bottom: 1px solid #777; /* Darker underline for search */
    gap: 12px;
    padding: 0 5px;
}

.pl-search-icon-img {
    width: 18px !important;
    height: 18px !important;
    min-width: 18px;
    display: block;
    opacity: 0.7;
}

.pl-search-form input[type="text"] {
    border: none !important;
    background: transparent !important;
    padding: 2px 0 !important;
    font-size: 15px !important;
    color: #333;
    width: 200px;
    box-shadow: none !important;
    outline: none !important;
}

.pl-search-form input[type="text"]::placeholder {
    color: #aaa;
    opacity: 0.8;
}

/* Projects Grid - Optimized for 5 columns */
.pl-projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    row-gap: 45px; /* Increased vertical separation */
    column-gap: 15px;
}

/* Individual Project Card - Compact Uniform Height */
.pl-project-card {
    background: var(--pl-bg-white);
    border: none;
    border-radius: 15px; /* Slightly smaller radius */
    padding: 15px 10px 8px 10px; /* More compact padding */
    position: relative;
    display: flex;
    flex-direction: column;
    height: 320px; /* Reduced uniform height */
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
    transition: all 0.3s ease;
    overflow: hidden;
    text-align: center;
}

.pl-project-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 45%;
    height: 5px; /* Thinner accent */
    background-color: #A87B2E; /* Default color */
}

/* Dynamic State Colors for Footer Accent */
.pl-project-card.pl-state-nuevo::after { background-color: #8BC34A; }
.pl-project-card.pl-state-repuesto::after { background-color: #FFC107; }
.pl-project-card.pl-state-tratamiento-c-s::after { background-color: #2196F3; }
.pl-project-card.pl-state-tratamiento-c-d::after { background-color: #03A9F4; }
.pl-project-card.pl-state-pl-en-consulta::after { background-color: #FF9800; }
.pl-project-card.pl-state-informe-comision::after { background-color: #9C27B0; }
.pl-project-card.pl-state-archivado::after { background-color: #607D8B; }
.pl-project-card.pl-state-aprobado::after { background-color: #4CAF50; }
.pl-project-card.pl-state-aprobado-modif::after { background-color: #8BC34A; }
.pl-project-card.pl-state-sancionado::after { background-color: #795548; }
.pl-project-card.pl-state-aplazado::after { background-color: #9E9E9E; }
.pl-project-card.pl-state-rechazado::after { background-color: #F44336; }
.pl-project-card.pl-state-al-ejecutivo::after { background-color: #E91E63; }
.pl-project-card.pl-state-promulgado-a-ley::after { background-color: #3F51B5; }

/* Card Actions - Hover Icons */
.pl-card-actions {
    position: absolute;
    bottom: 40px; /* Positioned above the footer line */
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    display: flex;
    gap: 15px;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 10;
}

.pl-project-card:hover .pl-card-actions {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.pl-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transition: transform 0.2s ease;
}

.pl-action-btn:hover {
    transform: scale(1.15);
}

.pl-action-btn img {
    width: 18px;
    height: 18px;
}

/* Download Icon Color (#C00000) */
.pl-download-btn img {
    filter: invert(10%) sepia(94%) saturate(7400%) hue-rotate(358deg) brightness(85%) contrast(110%);
}

/* Timeline Icon Color (#0E2841) and 90 degree rotation */
.pl-timeline-btn img {
    transform: rotate(90deg);
    filter: invert(13%) sepia(35%) saturate(1914%) hue-rotate(175deg) brightness(95%) contrast(97%);
}

.pl-project-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
}

.pl-project-card.is-featured {
    border-top: 4px solid #CA1818;
}

.pl-featured-star {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 20px; /* Smaller star */
    height: 20px;
}

.pl-card-top {
    margin-bottom: 12px;
}

.pl-project-number {
    font-size: 0.85rem; /* Smaller font for 5 columns */
    font-weight: 800;
    color: #A87B2E;
    text-transform: uppercase;
    display: block;
    margin-bottom: 6px;
}

.pl-tricolor-line {
    width: 100%;
    height: 2px; /* Thinner line */
    background: linear-gradient(to right, #D40000 0%, #D40000 33.33%, #FFD100 33.33%, #FFD100 66.66%, #00963F 66.66%, #00963F 100%);
    border-radius: 1px;
}

.pl-card-body {
    flex-grow: 1;
    margin-bottom: 12px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Bolivia background image - Compact */
.pl-card-body::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 140px; /* Smaller watermark */
    height: 140px;
    transform: translate(-50%, -50%);
    background-color: #A87B2E;
    -webkit-mask-image: url('../images/bolivia_white.png');
    mask-image: url('../images/bolivia_white.png');
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    opacity: 0.12;
    z-index: 0;
}

.pl-project-name {
    font-size: 0.9rem; /* Smaller font to fit content in narrow cards */
    line-height: 1.3;
    
    margin: 0;
    color: #000;
    text-transform: uppercase;
    position: relative;
    z-index: 1;
}

.pl-card-footer {
    padding-top: 6px;
    border-top: 1px solid #c8c8c8;
    font-size: 0.8rem; /* Smaller status text */
    width: 90%;
    margin: 0 auto 4px auto;
}

.pl-status-label {
    display: none;
}

.pl-status-text {
    font-weight: 800;
    color: #000;
    text-transform: uppercase;
    display: block;
}

/* Pagination */
.pl-pagination-wrapper {
    margin-top: 60px;
    text-align: center;
}

.pl-pagination-wrapper .page-numbers {
    display: inline-block;
    padding: 8px 14px;
    margin: 0 4px;
    border: 1px solid var(--pl-border);
    border-radius: 4px;
    text-decoration: none;
    color: var(--pl-text-dark);
    font-weight: 600;
    transition: all 0.2s;
}

.pl-pagination-wrapper .page-numbers.current,
.pl-pagination-wrapper .page-numbers:hover {
    background: var(--pl-gold);
    color: #fff;
    border-color: var(--pl-gold);
}

/* Responsive adjustments */
@media (max-width: 1200px) {
    .pl-projects-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }
}

@media (max-width: 992px) {
    .pl-tabs-panel {
        gap: 20px;
    }
    
    .pl-tab-btn {
        font-size: 14px;
    }
}

@media (max-width: 768px) {
    .pl-header-section {
        margin-bottom: 30px;
    }

    .pl-page-title {
        font-size: 22px;
        text-align: center;
    }
    
    .pl-title-container {
        border-left: none;
        border-top: 4px solid #c69c6d;
        padding-left: 0;
        padding-top: 10px;
        text-align: center;
        margin-bottom: 20px;
    }

    .pl-nav-row {
        flex-direction: column;
        align-items: center;
        border-bottom: none;
        gap: 25px;
    }

    .pl-tabs-panel {
        justify-content: center;
        flex-wrap: wrap;
        width: 100%;
        gap: 10px;
        border-bottom: 2px solid #f0f0f0;
        padding-bottom: 5px;
    }

    .pl-tab-btn {
        padding: 8px 5px;
        margin-bottom: -2px;
    }

    .pl-search-container {
        width: 100%;
        max-width: 100%;
        padding-bottom: 0;
    }
    
    .pl-search-wrapper {
        justify-content: center;
    }

    .pl-search-form input[type="text"] {
        width: 100%;
        text-align: center;
    }
}

/* Modal Styles */
.pl-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    backdrop-filter: blur(3px);
}

.pl-modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 0;
    border-radius: 12px;
    width: 60%;
    max-width: 800px;
    max-height: 85vh;
    box-shadow: 0 5px 30px rgba(0,0,0,0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.pl-modal-header {
    padding: 20px 25px;
    background-color: #fff;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pl-modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    color: #A87B2E;
    font-weight: 700;
}

.pl-close-modal {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.pl-close-modal:hover {
    color: #333;
}

.pl-modal-body {
    padding: 30px;
    overflow-y: auto;
    background-color: #fff;
}

.pl-modal-project-name {
    text-align: center;
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 40px;
    text-transform: uppercase;
    font-weight: 600;
    max-width: 80%;
    margin-left: auto;
    margin-right: auto;
}

/* Timeline Styles */
.pl-timeline-container {
    position: relative;
    padding: 20px 0;
}

.pl-timeline {
    position: relative;
    max-width: 100%;
    margin: 0 auto;
}

.pl-timeline::after {
    content: '';
    position: absolute;
    width: 4px;
    background-color: #D6BD96;
    top: 0;
    bottom: 0;
    left: 50%;
    margin-left: -2px;
    border-radius: 2px;
}

.pl-timeline-item {
    padding: 10px 40px;
    position: relative;
    background-color: inherit;
    width: 50%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    min-height: 80px;
}

.pl-timeline-item.pl-left {
    left: 0;
    align-items: flex-end;
    text-align: right;
}

.pl-timeline-item.pl-right {
    left: 50%;
    align-items: flex-start;
    text-align: left;
}

.pl-timeline-dot {
    position: absolute;
    width: 36px;
    height: 36px;
    right: -18px;
    background-color: #fff;
    border: 3px solid #D6BD96;
    top: 15px;
    border-radius: 50%;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.pl-timeline-item.pl-right .pl-timeline-dot {
    left: -18px;
}

.pl-timeline-icon {
    width: 20px;
    height: 20px;
}

.pl-icon-overlay {
    position: absolute;
    width: 14px;
    height: 14px;
    bottom: -2px;
    right: -2px;
    background: #fff;
    border-radius: 50%;
    padding: 1px;
}

.pl-timeline-date {
    display: flex;
    flex-direction: column;
    margin-bottom: 5px;
}

.pl-date {
    font-size: 0.85rem;
    color: #999;
    font-weight: 500;
}

.pl-time {
    font-size: 0.75rem;
    color: #bbb;
}

.pl-timeline-content {
    padding: 0;
}

.pl-status-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 5px;
}

.pl-left .pl-status-row {
    justify-content: flex-end;
}

.pl-right .pl-status-row {
    justify-content: flex-start;
}

.pl-status-title {
    margin: 0;
    font-size: 0.95rem;
    color: #D6BD96;
    text-transform: uppercase;
    font-weight: 700;
}

.pl-pdf-link {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.pl-pdf-link:hover {
    transform: scale(1.15);
}

.pl-pdf-link img {
    width: 20px;
    height: 20px;
}

.pl-timeline-desc {
    margin: 0;
    font-size: 0.75rem;
    color: #333;
    line-height: 1.4;
}

/* Alternating content placement */
.pl-left .pl-timeline-date {
    order: 1;
}
.pl-left .pl-timeline-content {
    order: 2;
}

.pl-right .pl-timeline-date {
    order: 2;
}
.pl-right .pl-timeline-content {
    order: 1;
}

/* Loading Spinner */
.pl-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 50px 0;
}

.pl-spinner {
    width: 40px;
    height: 40px;
    animation: pl-spin 1.5s linear infinite;
}

@keyframes pl-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@media screen and (max-width: 600px) {
    .pl-projects-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }
    .pl-project-number { font-size: 0.7rem !important; }
    .pl-project-name { font-size: 0.75rem !important; }
    .pl-status-text { font-size: 0.7rem !important; }
    
    .pl-modal-content {
        width: 95%;
    }
    
    .pl-timeline::after {
        left: 31px;
    }
    
    .pl-timeline-item {
        width: 100%;
        padding-left: 70px;
        padding-right: 25px;
        text-align: left !important;
        align-items: flex-start !important;
    }
    
    .pl-timeline-item.pl-left {
        left: 0;
    }
    
    .pl-timeline-item.pl-right {
        left: 0;
    }
    
    .pl-timeline-dot {
        left: 13px !important;
    }
    
    .pl-left .pl-timeline-date, .pl-right .pl-timeline-date {
        order: 1;
    }
    .pl-left .pl-timeline-content, .pl-right .pl-timeline-content {
        order: 2;
    }
}

