/**
 * Build Guide Archive Styles
 * Responsive design for the build guide archive page
 */

/* Parametric Filter Links Styles */
.pc-builder-view-similar-enhanced {
    position: relative;
    display: inline-block;
    margin-top: 8px;
}

.pc-builder-view-similar-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    text-decoration: none;
    color: #0073aa;
    font-size: 12px;
    padding: 4px 8px;
    border: 1px solid #0073aa;
    border-radius: 3px;
    background: white;
    transition: all 0.2s ease;
    cursor: pointer;
}

.pc-builder-view-similar-link:hover {
    background: #0073aa;
    color: white;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 115, 170, 0.2);
}

.dropdown-arrow {
    font-size: 10px;
    transition: transform 0.2s ease;
    user-select: none;
}

.pc-builder-view-similar-enhanced:hover .dropdown-arrow,
.dropdown-arrow.rotated {
    transform: rotate(180deg);
}

.view-similar-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    padding: 10px;
    min-width: 200px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    margin-top: 5px;
}

.pc-builder-view-similar-enhanced:hover .view-similar-dropdown,
.view-similar-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-header {
    font-weight: bold;
    margin-bottom: 8px;
    color: #333;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
    font-size: 12px;
}

.filter-item {
    margin-bottom: 4px;
    font-size: 11px;
    color: #666;
    line-height: 1.3;
}

.filter-item strong {
    color: #333;
}

/* Archive page parametric filter message */
#parametric-filters-applied-message {
    margin: 20px 0;
    padding: 15px;
    background: #e7f3ff;
    border-left: 4px solid #0073aa;
    border-radius: 4px;
}

#parametric-filters-applied-message p {
    margin: 0 0 8px 0;
    font-size: 14px;
    line-height: 1.4;
}

#parametric-filters-applied-message p:last-child {
    margin-bottom: 0;
}

#parametric-filters-applied-message strong {
    color: #0073aa;
}

#parametric-filters-applied-message em {
    color: #666;
    font-style: italic;
}

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

/* Category Filter */
.pcp-category-filter {
    margin-bottom: 30px;
    text-align: center;
}

/* Filter Header */
.pcp-filter-header {
    text-align: center;
    margin-bottom: 2rem;
}

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

.pcp-filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.pcp-filter-btn {
    padding: 10px 20px;
    border: 2px solid #007cba;
    background: transparent;
    color: #007cba;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.pcp-filter-btn:hover,
.pcp-filter-btn.active {
    background: #007cba;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 124, 186, 0.3);
}

.pcp-filter-btn.loading {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* 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-posts-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

/* Build Guide Card */
.pcp-build-guide-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: 480px; /* Fixed height for consistent layout */
    display: flex;
    flex-direction: column;
}

.pcp-build-guide-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: #007cba;
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(0, 124, 186, 0.3);
}

/* Images Section */
.pcp-card-images {
    display: flex;
    height: 160px;
    position: relative;
}

.pcp-card-main-image {
    flex: 2;
    position: relative;
    overflow: hidden;
}

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

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

.pcp-card-component-images {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.pcp-component-image {
    flex: 1;
    position: relative;
    overflow: hidden;
}

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

.pcp-component-image:hover img {
    transform: scale(1.1);
}

/* No Image Placeholder */
.pcp-no-image {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    background: #f8f9fa;
    color: #6c757d;
    font-size: 12px;
    text-align: center;
    padding: 10px;
    border: 1px dashed #dee2e6;
}

/* 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-build-guide-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 */
}

/* Excerpt styles removed - replaced with component titles */
/* .pcp-card-excerpt {
    color: #666;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 20px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
} */

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

.pcp-readmore-btn {
    color: #007cba;
    text-decoration: none;
    font-weight: 500;
    font-size: 13px;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
}

.pcp-readmore-btn:hover {
    color: #005a87;
    transform: translateX(5px);
}

/* 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: 12px;
}

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

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

.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: 12px;
    font-weight: 500;
}

/* Likes System */
.pcp-likes {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #6c757d;
    font-size: 12px;
}

.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: 13px;
    font-weight: 500;
}

/* Tooltips */
.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;
}

/* Comment form customization */
.logged-in-as {
    margin-bottom: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 5px;
    color: #6c757d;
    font-size: 14px;
    border-left: 3px solid #007cba;
}

/* Comment Actions */
.pcp-comment-actions {
    display: inline;
    vertical-align: middle;
}

.pcp-comment-delete,
.pcp-comment-report {
    display: inline-flex;
    align-items: center;
    height: 25px;
    padding: 0 10px;
    border-radius: 3px;
    transition: color .12s cubic-bezier(0.455, 0.03, 0.515, 0.955), background .12s cubic-bezier(0.455, 0.03, 0.515, 0.955);
    color: #000000;
    text-decoration: none;
    font-size: 11px;
    background: transparent;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    vertical-align: middle;
}

.pcp-comment-delete:hover,
.pcp-comment-report:hover {
    color: #ffffff;
    background: #2872fa;
}

.pcp-comment-delete:disabled,
.pcp-comment-report:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    color: #6c757d;
}

/* Report Modal */
.pcp-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Ensure modal is properly positioned on all devices */
.pcp-modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
}

/* Mobile viewport fixes */
@media (max-width: 768px) {
    .pcp-modal {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        min-height: 100vh !important;
        overflow: hidden;
    }
    
    .pcp-modal-content {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        margin: 0;
        max-height: 90vh;
        overflow-y: auto;
    }
}

.pcp-modal-content {
    background: white;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.pcp-modal-header {
    padding: 20px 20px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 15px;
}

.pcp-modal-header h3 {
    margin: 0;
    color: #333;
    font-size: 18px;
}

.pcp-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #6c757d;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pcp-modal-close:hover {
    color: #333;
}

#pcp-report-form {
    padding: 20px;
}

.pcp-form-group {
    margin-bottom: 20px;
}

.pcp-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

.pcp-form-group > label:first-child,
.pcp-form-label {
    display: block;
    margin-bottom: 15px;
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

.pcp-radio-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.pcp-radio-option {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 8px 0;
}

.pcp-radio-option input[type="radio"] {
    margin: 0;
    width: 18px;
    height: 18px;
    accent-color: #007cba;
}

.pcp-radio-option label {
    font-size: 14px;
    color: #333;
    line-height: 1.4;
    cursor: pointer;
    margin: 0;
}

.pcp-form-group select,
.pcp-form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
}

.pcp-form-group select:focus,
.pcp-form-group textarea:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.2);
}

.pcp-form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 25px;
}

.pcp-btn-primary,
.pcp-btn-secondary {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 100px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pcp-btn-primary {
    background: #007cba;
    color: white;
}

.pcp-btn-primary:hover {
    background: #005a87;
}

.pcp-btn-secondary {
    background: #6c757d;
    color: white;
}

.pcp-btn-secondary:hover {
    background: #545b62;
}

/* Messages */
.pcp-message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 4px;
    color: white;
    font-weight: 500;
    z-index: 10001;
    max-width: 300px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

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

.pcp-message-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 #dee2e6;
    border-radius: 5px;
    text-decoration: none;
    color: #007cba;
    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: 500;
}

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

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

/* Responsive Design */
@media (max-width: 768px) {
    .pcp-build-guide-archive {
        padding: 15px;
    }
    
    .pcp-posts-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .pcp-card-images {
        height: 180px;
    }
    
    .pcp-filter-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .pcp-filter-btn {
        width: 100%;
        max-width: 250px;
    }
    
    .pcp-card-footer {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    
    .pcp-card-engagement {
        gap: 15px;
    }
    
    /* Tablet and small mobile modal adjustments */
    .pcp-modal-content {
        max-width: calc(100vw - 40px);
        width: 90%;
        margin: 0;
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
    }
    
    .pcp-modal-header {
        padding: 18px 18px 0;
    }
    
    .pcp-modal-header h3 {
        font-size: 17px;
    }
    
    #pcp-report-form {
        padding: 18px;
    }
    
    .pcp-form-group {
        margin-bottom: 18px;
    }
    
    .pcp-radio-options {
        gap: 12px;
    }
    
    .pcp-radio-option {
        padding: 8px 0;
    }
    
    .pcp-radio-option input[type="radio"] {
        width: 18px;
        height: 18px;
    }
    
    .pcp-radio-option label {
        font-size: 15px;
    }
    
    .pcp-form-actions {
        gap: 12px;
    }
    
    .pcp-form-actions button {
        padding: 12px 18px;
        font-size: 15px;
    }
}

@media (max-width: 480px) {
    .pcp-build-guide-archive {
        padding: 10px;
    }
    
    .pcp-card-content {
        padding: 15px;
    }
    
    .pcp-card-footer {
        padding: 12px 15px;
    }
    
    .pcp-card-title {
        font-size: 16px;
    }
    
    /* .pcp-card-excerpt {
        font-size: 13px;
    } */
    
    /* Mobile-specific modal adjustments */
    .pcp-modal {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
    }
    
    .pcp-modal-content {
        max-width: calc(100vw - 20px);
        width: 95%;
        max-height: 90vh;
        margin: 0;
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
    }
    
    .pcp-modal-header {
        padding: 15px 15px 0;
    }
    
    .pcp-modal-header h3 {
        font-size: 16px;
    }
    
    #pcp-report-form {
        padding: 15px;
    }
    
    .pcp-form-group {
        margin-bottom: 15px;
    }
    
    .pcp-radio-options {
        gap: 10px;
    }
    
    .pcp-radio-option {
        padding: 6px 0;
    }
    
    .pcp-radio-option input[type="radio"] {
        width: 16px;
        height: 16px;
    }
    
    .pcp-radio-option label {
        font-size: 14px;
    }
    
    .pcp-form-actions {
        gap: 10px;
    }
    
    .pcp-form-actions button {
        padding: 10px 15px;
        font-size: 14px;
    }
}

/* Loading States */
.pcp-loading {
    opacity: 0.6;
    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); }
}

/* Smooth Transitions */
.pcp-build-guide-card,
.pcp-filter-btn,
.pcp-like-button {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Focus States for Accessibility */
.pcp-filter-btn:focus,
.pcp-like-button:focus,
.pcp-readmore-btn:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .pcp-category-filter,
    .pcp-pagination,
    .pcp-like-button {
        display: none;
    }
    
    .pcp-build-guide-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
}

/* View Similar Links Styling */
.pc-builder-view-similar {
    margin-top: 8px;
    padding: 6px 0;
}

.pc-builder-view-similar-link {
    display: inline-block;
    padding: 6px 12px;
    background: #007cba;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 1px solid #007cba;
}

.pc-builder-view-similar-link:hover {
    background: #005a87;
    border-color: #005a87;
    color: white;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 124, 186, 0.3);
}

.pc-builder-view-similar-link:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(0, 124, 186, 0.3);
}

/* Responsive adjustments for View Similar links */
@media (max-width: 768px) {
    .pc-builder-view-similar-link {
        font-size: 11px;
        padding: 5px 10px;
    }
    
    .pc-builder-view-similar {
        margin-top: 6px;
        padding: 4px 0;
    }
}

/* Admin meta box styling */
#pcp-parametric-filters-container {
    padding: 10px 0;
}

#pcp-auto-populate-btn {
    width: 100%;
    margin-bottom: 10px;
}

#pcp-populate-status .notice {
    margin: 0;
    padding: 8px 12px;
}

#pcp-populate-status .notice p {
    margin: 0 0 5px 0;
}

#pcp-populate-status .notice p:last-child {
    margin-bottom: 0;
}
