/* ==========================================================================
   Prop Firms Showcase - Compact Styles (40% smaller)
   ========================================================================== */

:root {
    --pfs-primary: #f4f4f5;
    --pfs-primary-hover: #ffffff;
    --pfs-secondary: #1c1c1f;
    --pfs-dark: #08080a;
    --pfs-card-bg: #131316;
    --pfs-border: #2a2a2e;
    --pfs-text: #f4f4f5;
    --pfs-text-muted: #9a9aa2;
    --pfs-success: #22c55e;
    --pfs-warning: #f5f5f5;
    --pfs-star-gold: #f4f4f5;
    --pfs-gradient: linear-gradient(135deg, #3f3f46 0%, #e4e4e7 50%, #3f3f46 100%);
    --pfs-shine: linear-gradient(115deg, transparent 20%, rgba(255,255,255,0.12) 40%, rgba(255,255,255,0.28) 50%, rgba(255,255,255,0.12) 60%, transparent 80%);
}

/* Hide author boxes and meta that might appear in shortcode content */
.pfs-wrapper .author-box,
.pfs-wrapper .post-author,
.pfs-wrapper .entry-meta,
.pfs-wrapper .post-meta,
.pfs-wrapper .pp-multiple-authors-wrapper,
.pfs-wrapper .publishpress-authors-box,
.pfs-wrapper [class*="author"],
.pfs-wrapper [class*="byline"] {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
}

/* Target PublishPress specific classes */
.pfs-grid + .pp-multiple-authors-wrapper,
.pfs-grid + .publishpress-authors-box,
.pfs-detail + .pp-multiple-authors-wrapper,
.pfs-detail + .publishpress-authors-box,
.pfs-grid ~ .pp-multiple-authors-wrapper,
.pfs-grid ~ .publishpress-authors-box,
.pfs-detail ~ .pp-multiple-authors-wrapper,
.pfs-detail ~ .publishpress-authors-box,
div[class*="pp-multiple-authors"],
div[class*="publishpress-authors"],
.ppma-authors-list,
.ppma-author-box {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
}

.pfs-grid + .author-box,
.pfs-grid + .post-author,
.pfs-detail + .author-box,
.pfs-detail + .post-author,
.pfs-grid ~ .author-box,
.pfs-grid ~ .post-author,
.pfs-detail ~ .author-box,
.pfs-detail ~ .post-author {
    display: none !important;
}

/* Hide author box that might be inserted before shortcode */
.author-box + .pfs-grid,
.post-author + .pfs-grid,
.author-box + .pfs-detail,
.post-author + .pfs-detail {
    margin-top: 0 !important;
}

.author-box:has(+ .pfs-grid),
.post-author:has(+ .pfs-grid),
.author-box:has(+ .pfs-detail),
.post-author:has(+ .pfs-detail) {
    display: none !important;
}

/* Grid Layout */
.pfs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 18px;
    padding: 18px 0;
}

/* List Layout - full width rows, one after another */
.pfs-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 18px 0;
    width: 100%;
}

.pfs-row {
    width: 100%;
    background: var(--pfs-card-bg);
    border: 1px solid var(--pfs-border);
    border-radius: 12px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.pfs-row::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 2px;
    background: var(--pfs-gradient);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.pfs-row:hover {
    border-color: #52525b;
    background: #17171a;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.pfs-row:hover::before {
    opacity: 1;
}

.pfs-row .pfs-firm-logo {
    flex: 0 0 52px;
}

.pfs-row-main {
    flex: 1 1 220px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pfs-row-heading {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
}

.pfs-row-heading .pfs-firm-name {
    white-space: nowrap;
}

.pfs-row-excerpt {
    color: var(--pfs-text-muted);
    font-size: 12px;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.pfs-row-offer {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.pfs-row .pfs-rating-badge {
    flex: 0 0 auto;
    margin-left: 0;
    min-width: 70px;
}

.pfs-row-btn {
    flex: 0 0 auto !important;
    width: auto !important;
    padding: 10px 24px;
    white-space: nowrap;
}

@media (max-width: 640px) {
    .pfs-row {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .pfs-row-btn {
        width: 100% !important;
    }
}

@media (max-width: 768px) {
    .pfs-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

/* Card Component */
.pfs-card {
    background: var(--pfs-card-bg);
    border-radius: 12px;
    overflow: hidden !important;
    border: 1px solid var(--pfs-border);
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    max-width: 100%;
}

.pfs-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.55),
                0 0 0 1px rgba(244, 244, 245, 0.15);
    border-color: #52525b;
}

/* Top hairline that lights up on hover */
.pfs-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--pfs-gradient);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 2;
}

.pfs-card:hover::before {
    opacity: 1;
}

/* Glossy sheen sweep across the whole card on hover */
.pfs-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--pfs-shine);
    transform: translateX(-120%);
    pointer-events: none;
    z-index: 1;
}

.pfs-card:hover::after {
    transform: translateX(120%);
    transition: transform 0.9s ease;
}

/* Card Header */
.pfs-card-header {
    padding: 18px 18px 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-start;
    position: relative;
}

.pfs-firm-logo {
    flex: 0 0 52px;
    width: 52px !important;
    height: 52px !important;
    aspect-ratio: 1 / 1;
    border-radius: 10px;
    overflow: hidden !important;
    background: var(--pfs-secondary);
    border: 1px solid var(--pfs-border);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.pfs-card:hover .pfs-firm-logo {
    border-color: #71717a;
    box-shadow: 0 0 14px rgba(244, 244, 245, 0.15);
}

.pfs-firm-logo img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    max-width: none !important;
}

.pfs-logo-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 700;
    color: var(--pfs-text);
    background: var(--pfs-secondary);
}

.pfs-firm-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1 1 100px;
    min-width: 0;
}

.pfs-firm-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--pfs-text) !important;
    margin: 0;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pfs-firm-meta {
    display: flex;
    gap: 9px;
    flex-wrap: wrap;
    font-size: 11px;
    color: var(--pfs-text-muted);
}

.pfs-country,
.pfs-trust-pilot {
    display: flex;
    align-items: center;
    gap: 3px;
}

.pfs-country::before {
    content: '🌍';
    font-size: 10px;
}

/* Rating Badge */
.pfs-rating-badge {
    flex: 0 0 auto;
    margin-left: auto;
    text-align: center;
    padding: 8px 12px;
    background: var(--pfs-secondary);
    border-radius: 8px;
    border: 1px solid var(--pfs-border);
}

.pfs-rating-number {
    font-size: 20px;
    font-weight: 700;
    color: var(--pfs-text);
    line-height: 1;
    margin-bottom: 4px;
}

.pfs-rating-stars {
    font-size: 11px;
    margin-bottom: 3px;
    letter-spacing: 1px;
}

.pfs-rating-reviews {
    font-size: 9px;
    color: var(--pfs-text-muted);
    white-space: nowrap;
}

/* Star Rating */
.pfs-star {
    color: #3f3f46;
    font-size: inherit;
}

.pfs-star-full {
    color: var(--pfs-star-gold);
}

.pfs-star-half {
    color: var(--pfs-star-gold);
    opacity: 0.5;
}

/* Offer Banner */
.pfs-offer-banner {
    background: #ffffff;
    padding: 10px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.pfs-offer-banner::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.08), transparent);
    animation: shimmer 2.5s infinite;
}

@keyframes shimmer {
    to {
        left: 100%;
    }
}

.pfs-offer-badge {
    background: rgba(0, 0, 0, 0.85);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 9px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.pfs-offer-discount {
    font-size: 18px;
    font-weight: 800;
    color: #0a0a0a;
}

/* Card Content */
.pfs-card-content {
    padding: 12px 18px;
    color: var(--pfs-text-muted);
    line-height: 1.55;
    font-size: 12px;
}

/* Card Footer */
.pfs-card-footer {
    padding: 12px 18px 18px;
    display: flex;
    gap: 7px;
}

/* Buttons */
.pfs-btn {
    flex: 1;
    padding: 10px 14px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 12px;
    text-align: center;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    position: relative;
    overflow: hidden;
}

.pfs-btn-primary {
    background: #ffffff;
    color: #0a0a0a;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

.pfs-btn-primary:hover {
    box-shadow: 0 4px 18px rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
    background: #f4f4f5;
}

.pfs-btn-secondary {
    background: transparent;
    color: var(--pfs-text);
    border: 1px solid var(--pfs-border);
}

.pfs-btn-secondary:hover {
    background: var(--pfs-secondary);
    border-color: #71717a;
}


/* Detail Page Styles */
.pfs-detail {
    background: var(--pfs-card-bg);
    border-radius: 12px;
    padding: 24px;
    border: 1px solid var(--pfs-border);
    margin: 18px 0;
}

.pfs-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--pfs-border);
    margin-bottom: 18px;
}

.pfs-detail-header h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--pfs-text);
    margin: 0;
}

.pfs-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.pfs-detail-section {
    background: var(--pfs-secondary);
    padding: 15px;
    border-radius: 10px;
    border: 1px solid var(--pfs-border);
}

.pfs-detail-section h3 {
    font-size: 12px;
    font-weight: 600;
    color: var(--pfs-primary);
    margin: 0 0 9px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pfs-detail-section p {
    color: var(--pfs-text);
    margin: 0;
    font-size: 13px;
}

/* Badges */
.pfs-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.pfs-badge {
    display: inline-flex;
    align-items: center;
    padding: 5px 10px;
    background: var(--pfs-secondary);
    color: var(--pfs-text);
    border-radius: 5px;
    font-size: 11px;
    font-weight: 500;
    border: 1px solid var(--pfs-border);
    transition: all 0.3s ease;
}

.pfs-badge:hover {
    background: #27272a;
    border-color: #52525b;
    transform: translateY(-1px);
}

.pfs-detail-content {
    color: var(--pfs-text-muted);
    line-height: 1.6;
    font-size: 14px;
}

.pfs-detail-content h1,
.pfs-detail-content h2,
.pfs-detail-content h3 {
    color: var(--pfs-text);
    margin-top: 18px;
    margin-bottom: 9px;
}

.pfs-detail-content p {
    margin-bottom: 9px;
}

.pfs-detail-content a {
    color: var(--pfs-primary);
    text-decoration: none;
    transition: all 0.3s ease;
}

.pfs-detail-content a:hover {
    color: var(--pfs-primary-hover);
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
    .pfs-rating-badge {
        flex-basis: 100%;
        margin-left: 0;
        text-align: left;
        display: flex;
        align-items: center;
        gap: 9px;
        padding: 9px;
    }
    
    .pfs-rating-number {
        font-size: 17px;
    }
    
    .pfs-firm-logo {
        width: 36px;
        height: 36px;
        flex-basis: 36px;
    }
    
    .pfs-firm-name {
        font-size: 14px;
    }
    
    .pfs-card-footer {
        flex-direction: column;
    }
    
    .pfs-detail {
        padding: 15px;
    }
    
    .pfs-detail-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 9px;
    }
    
    .pfs-detail-header h2 {
        font-size: 17px;
    }
}

/* Loading Animation */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.pfs-loading {
    animation: pulse 1.5s ease-in-out infinite;
}

/* Dark Theme Optimizations - scoped to the plugin's own wrapper only,
   never the site body, so it can't paint other pages black */
.pfs-wrapper {
    background: var(--pfs-dark);
    padding: 18px;
    border-radius: 14px;
}

.pfs-no-results {
    color: var(--pfs-text-muted);
    text-align: center;
    padding: 30px;
    font-size: 13px;
}

.pfs-firm-name a {
    color: inherit !important;
    text-decoration: none !important;
}

.pfs-firm-name a:hover {
    color: var(--pfs-primary-hover) !important;
    text-decoration: underline !important;
}

@media (max-width: 600px) {
    .pfs-detail-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
}

/* Accessibility */
.pfs-btn:focus,
.pfs-card:focus-within {
    outline: 2px solid var(--pfs-primary);
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .pfs-card {
        page-break-inside: avoid;
        border: 1px solid #000;
    }
    
    .pfs-btn {
        display: none;
    }
}