/**
 * Completed Builds Archive Styles
 * Responsive design for the completed builds archive page
 */

/* Archive Container */
.pcp-completed-build-archive {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Archive Layout - 30-70 Split */
.pcp-archive-layout {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

.pcp-archive-left {
    flex: 0 0 20%;
    position: sticky;
    top: 20px;
}

.pcp-archive-right {
    flex: 0 0 80%;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .pcp-archive-layout {
        flex-direction: column;
        gap: 20px;
    }
    
    .pcp-archive-left,
    .pcp-archive-right {
        flex: 0 0 100%;
    }
    
    .pcp-archive-left {
        position: static;
    }
}

/* Create Build Section */
.pcp-create-build-section {
    margin-bottom: 30px;
    text-align: center;
}

.pcp-create-build-btn {
    display: inline-block;
    padding: 15px 30px;
    background: #007cba;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 16px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 124, 186, 0.3);
}

.pcp-create-build-btn:hover {
    background: #005a87;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 124, 186, 0.4);
    color: white;
}

/* Published Filter */
.pcp-published-filter {
    margin-bottom: 30px;
}

.pcp-filter-header {
    text-align: left;
    margin-bottom: 1.5rem;
}

.pcp-filter-header h3 {
    margin-bottom: 1rem;
    color: #333;
    font-size: 1.3rem;
    font-weight: 600;
}

.pcp-filter-dropdown {
    text-align: center;
}

.pcp-filter-dropdown select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    background: white;
    color: #333;
    cursor: pointer;
    transition: border-color 0.3s ease;
    text-align: center;
    text-align-last: center;
    min-height: 48px;
}

.pcp-filter-dropdown select:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

.pcp-filter-dropdown select option {
    text-align: center;
    padding: 8px;
    font-size: 14px;
}

/* Ensure dropdown text is fully visible */
.pcp-filter-dropdown select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}

/* Posts Grid */
.pcp-posts-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 40px;
}

@media (max-width: 1400px) {
    .pcp-posts-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }
}

@media (max-width: 1100px) {
    .pcp-posts-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .pcp-completed-build-archive {
        padding: 15px;
    }
    
    .pcp-posts-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .pcp-card-content {
        padding: 15px;
    }
    
    .pcp-card-footer {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
        text-align: left;
    }
    
    .pcp-card-engagement {
        justify-content: flex-start;
    }
}

/* Completed Build Card */
.pcp-completed-build-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: all 0.3s ease;
    position: relative;
    border: 1px solid #e1e5e9;
    height: 520px; /* Fixed height for consistent layout */
    display: flex;
    flex-direction: column;
}

.pcp-completed-build-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

/* Category Badge */
.pcp-card-category {
    position: absolute;
    top: 12px;
    left: 12px;
    background: #28a745;
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 2;
}

/* Main Image */
.pcp-card-main-image {
    width: 100%;
    height: 200px;
    overflow: hidden;
    position: relative;
}

.pcp-card-main-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.pcp-completed-build-card:hover .pcp-card-main-image img {
    transform: scale(1.05);
}

.pcp-no-image {
    width: 100%;
    height: 100%;
    background: #f8f9fa;
    color: #6c757d;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 5px;
}

/* Content Section */
.pcp-card-content {
    padding: 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.pcp-card-title {
    margin: 0 0 12px 0;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
    min-height: 44px; /* Fixed height for 2 lines of title */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pcp-card-title a {
    color: #333;
    text-decoration: none;
    transition: color 0.3s ease;
}

.pcp-card-title a:hover {
    color: #007cba;
}

/* Component Titles */
.pcp-card-components {
    margin-bottom: 15px;
    min-height: 60px; /* Fixed height for 3 component lines */
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

/* Ensure consistent spacing even with fewer components */
.pcp-card-components:empty::after {
    content: '';
    flex: 1;
}

.pcp-completed-build-card .pcp-component-title {
    color: #666;
    font-size: 13px;
    line-height: 1.3;
    margin-bottom: 4px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 80%;
    display: block;
    word-wrap: normal;
    word-break: keep-all;
    min-height: 17px; /* Fixed height for each component line */
}

/* Author Info - Plain text style (no container) */
.pcp-card-author {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
}

.pcp-card-author img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    vertical-align: middle;
}

.pcp-author-name {
    color: #007cba;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
}

.pcp-card-readmore {
    text-align: left;
    margin-top: auto; /* Push read more to bottom of content area */
}

.pcp-readmore-link {
    color: #007cba;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: color 0.3s ease;
}

.pcp-readmore-link:hover {
    color: #005a87;
    text-decoration: underline;
}

/* Footer Section */
.pcp-card-footer {
    padding: 12px 16px;
    border-top: 1px solid #e1e5e9;
    background: #f8f9fa;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto; /* Push footer to bottom */
    flex-shrink: 0; /* Prevent footer from shrinking */
}

.pcp-card-date {
    color: #6c757d;
    font-size: 11px;
    font-weight: 500;
}

.pcp-card-engagement {
    display: flex;
    gap: 16px;
    align-items: center;
}

.pcp-comments,
.pcp-likes {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: #6c757d;
}

.pcp-comment-link {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #6c757d;
    text-decoration: none;
    transition: color 0.3s ease;
}

.pcp-comment-link:hover {
    color: #007cba;
}

.pcp-comment-icon {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
}

.pcp-comment-count {
    font-size: 11px;
    font-weight: 500;
}

.pcp-likes-placeholder {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Likes System Integration */
.pcp-likes-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pcp-like-button {
    background: transparent;
    border: none;
    padding: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pcp-like-button:hover {
    transform: scale(1.1);
}

.pcp-like-button.loading {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.like-icon {
    font-size: 20px;
    color: #6c757d;
    transition: all 0.3s ease;
}

/* Filled heart when liked */
.pcp-like-button.liked .like-icon {
    color: #dc3545;
}

.like-count {
    color: #6c757d;
    font-size: 12px;
    font-weight: 500;
}

/* Tooltips for likes system */
.pcp-tooltip {
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 10;
}

.pcp-tooltip.success {
    background: #28a745;
}

.pcp-tooltip.error {
    background: #dc3545;
}

/* Pagination */
.pcp-pagination {
    text-align: center;
    margin-top: 40px;
}

.pcp-pagination .page-numbers {
    display: inline-block;
    padding: 10px 15px;
    margin: 0 5px;
    border: 1px solid #e1e5e9;
    border-radius: 6px;
    text-decoration: none;
    color: #333;
    transition: all 0.3s ease;
}

.pcp-pagination .page-numbers:hover,
.pcp-pagination .page-numbers.current {
    background: #007cba;
    color: white;
    border-color: #007cba;
}

.pcp-pagination .prev,
.pcp-pagination .next {
    font-weight: 600;
}

/* No Posts */
.pcp-no-posts {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
}

.pcp-no-posts p {
    font-size: 18px;
    margin: 0;
}

/* Loading States */
.pcp-loading {
    opacity: 0.7;
    pointer-events: none;
}

.pcp-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Filter Loading State */
.pcp-filter-dropdown select:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Responsive Adjustments */
@media (max-width: 480px) {
    .pcp-completed-build-archive {
        padding: 10px;
    }
    
    .pcp-archive-layout {
        gap: 20px;
    }
    
    .pcp-posts-grid {
        gap: 15px;
    }
    
    .pcp-card-content {
        padding: 15px;
    }
    
    .pcp-card-footer {
        padding: 12px 15px;
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
        text-align: left;
    }
    
    .pcp-card-engagement {
        justify-content: flex-start;
    }
}

/* Accessibility */
.pcp-filter-dropdown select:focus-visible {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

.pcp-readmore-link:focus-visible {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .pcp-completed-build-card {
        border: 2px solid #000;
    }
    
    .pcp-card-category {
        border: 1px solid #fff;
    }
    
    .pcp-readmore-link {
        border: 2px solid #fff;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .pcp-completed-build-card,
    .pcp-card-main-image img,
    .pcp-create-build-btn,
    .pcp-readmore-link {
        transition: none;
    }
    
    .pcp-completed-build-card:hover {
        transform: none;
    }
    
    .pcp-completed-build-card:hover .pcp-card-main-image img {
        transform: none;
    }
    
    .pcp-create-build-btn:hover {
        transform: none;
    }
    
    .pcp-readmore-link:hover {
        transform: none;
    }
}
