/*Portfolio Styles - ULTRA STRONG Override - Version 2.3.2 */

.cpm-portfolio-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 20px;
    box-sizing: border-box;
}

/* Filter Buttons Container */
.cpm-filter-buttons {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 12px !important;
    margin-bottom: 50px !important;
    justify-content: center !important;
    padding: 8px 0 !important;
    align-items: center !important;
}

/* ULTRA STRONG Button Styles - Override Everything */
.cpm-portfolio-wrapper .cpm-filter-buttons .cpm-filter-btn,
.cpm-portfolio-wrapper button.cpm-filter-btn,
button.cpm-filter-btn {
    background: #ffffff !important;
    color: #1a1a1a !important;
    border: 2px solid #e0e0e0 !important;
    border-radius: 12px !important;
    
    /* CRITICAL: Zero vertical padding */
    padding: 0 28px !important;
    margin: 0 !important;
    
    font-size: 15px !important;
    font-weight: 700 !important;
    font-family: inherit !important;
    cursor: pointer !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    white-space: nowrap !important;
    text-transform: uppercase !important;
    letter-spacing: 0.8px !important;
    text-decoration: none !important;
    
    /* FLEX PERFECT CENTERING */
    height: 48px !important;
    min-height: 48px !important;
    max-height: 48px !important;
    line-height: normal !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    vertical-align: middle !important;
    
    position: relative !important;
    overflow: hidden !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
    z-index: 1 !important;
    transform: translateY(0) !important;
    box-sizing: border-box !important;
}

.cpm-filter-btn > br {
    display: none;
}

/* Force text centering */
.cpm-filter-btn *,
.cpm-filter-btn::before,
.cpm-filter-btn::after {
    line-height: normal !important;
    vertical-align: baseline !important;
}

.cpm-filter-btn span {
    display: inline !important;
    position: relative !important;
    z-index: 2 !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Shimmer effect */
.cpm-filter-btn::before {
    content: '' !important;
    position: absolute !important;
    top: 0 !important;
    left: -100% !important;
    width: 100% !important;
    height: 100% !important;
    background: linear-gradient(90deg, transparent, rgba(255, 107, 0, 0.1), transparent) !important;
    transition: left 0.5s ease !important;
    z-index: 0 !important;
    display: block !important;
}

.cpm-filter-btn:hover::before {
    left: 100% !important;
}

/* Hover and Active states */
.cpm-portfolio-wrapper .cpm-filter-buttons .cpm-filter-btn:hover,
.cpm-portfolio-wrapper .cpm-filter-buttons .cpm-filter-btn.active,
.cpm-filter-btn:hover,
.cpm-filter-btn.active {
    background: linear-gradient(135deg, #FF6B00 0%, #FF8E53 100%) !important;
    color: #ffffff !important;
    border: 2px solid #FF6B00 !important;
    transform: translateY(0) !important;
    box-shadow: 0 8px 20px rgba(255, 107, 0, 0.35) !important;
}

.cpm-filter-btn.active {
    animation: pulseGlow 2s ease-in-out infinite !important;
}

@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 8px 20px rgba(255, 107, 0, 0.45) !important;
    }
    50% {
        box-shadow: 0 10px 24px rgba(255, 107, 0, 0.55) !important;
    }
}

/* PORTFOLIO GRID - 3 COLUMNS */
.cpm-portfolio-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 30px !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* Portfolio Item - Remove all spacing */
.cpm-portfolio-item {
    width: 100% !important;
    box-sizing: border-box !important;
    transition: all 0.4s ease !important;
    opacity: 1 !important;
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: 0 !important;
}

.cpm-portfolio-item.hide {
    display: none !important;
}

.cpm-portfolio-link {
    text-decoration: none !important;
    display: block !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: 0 !important;
}

/* Portfolio Image - Fixed for 800x533 (3:2 Ratio) Images */
.cpm-portfolio-image {
    position: relative !important;
    overflow: hidden !important;
    border-radius: 20px !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15) !important;
    background: #f5f5f5 !important;
    width: 100% !important;
    height: 0 !important;
    padding-bottom: 66.67% !important; /* 533/800 = 0.6667 = 66.67% for 3:2 ratio */
    margin: 0 !important;
    line-height: 0 !important;
}

.cpm-portfolio-image::before {
    content: '';
    position: absolute;
    inset: -2px;
    background: linear-gradient(135deg, #FF6B00, #FF8E53, #FFB088);
    border-radius: 20px;
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: -1;
}

.cpm-portfolio-item:hover .cpm-portfolio-image::before {
    opacity: 1;
}

/* Image - FULL IMAGE VISIBLE (NO CROPPING) */
.cpm-portfolio-image img {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important; /* COVER se CONTAIN karo */
    object-position: center !important;
    display: block !important;
    transition: transform 0.5s ease !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    background: #ffffff !important; /* White background for empty space */
}



/* No Image Placeholder */
.cpm-no-image-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #FF6B00 0%, #FF8E53 50%, #FFB088 100%);
    color: #fff;
}

.cpm-no-image-placeholder span {
    font-size: 50px;
    margin-bottom: 10px;
}

.cpm-no-image-placeholder p {
    font-size: 14px;
    margin: 0;
    font-weight: 600;
}

/* Hover Effects - Only Image Scale */
.cpm-portfolio-item:hover {
    transform: translateY(-5px);
}

.cpm-portfolio-item:hover .cpm-portfolio-image {
    box-shadow: 0 12px 35px rgba(255, 107, 0, 0.35);
}

.cpm-portfolio-item:hover .cpm-portfolio-image img {
    transform: scale(1.05);
}

/* Overlay - ALWAYS VISIBLE (NO HOVER EFFECT) */
.cpm-portfolio-overlay {
    position: absolute !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    background: linear-gradient(to top, 
        rgba(0, 0, 0, 0.90) 0%, 
        rgba(0, 0, 0, 0.70) 60%,
        transparent 100%) !important;
    color: #fff !important;
    padding: 25px 20px 20px !important;
    opacity: 1 !important;
    transition: background 0.4s ease !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-end !important;
}

/* Hover - Just Slightly Change Background */
.cpm-portfolio-item:hover .cpm-portfolio-overlay {
    background: linear-gradient(to top, 
        rgba(0, 0, 0, 0.95) 0%, 
        rgba(255, 107, 0, 0.5) 70%,
        transparent 100%) !important;
}

/* Title - Always Visible */
.cpm-portfolio-overlay h3 {
    margin: 0 0 10px 0 !important;
    font-size: 20px !important;
    font-weight: 700 !important;
    line-height: 1.3 !important;
    color: #fff !important;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5) !important;
}

/* Category Badges - Always Visible */
.cpm-portfolio-cats {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    margin-bottom: 12px !important;
}

.cpm-cat-badge {
    background: linear-gradient(135deg, #FF6B00 0%, #FF8E53 100%) !important;
    color: #fff !important;
    padding: 6px 14px !important;
    border-radius: 20px !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    box-shadow: 0 2px 8px rgba(255, 107, 0, 0.4) !important;
    line-height: 1.4 !important;
    display: inline-block !important;
}

/* View More Button - Always Visible */
.cpm-view-more {
    font-size: 14px !important;
    color: #FFB088 !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3) !important;
}

/* No Posts */
.cpm-no-posts {
    grid-column: 1 / -1;
    text-align: center;
    padding: 80px 20px;
    background: linear-gradient(135deg, #fff 0%, #fff5f0 100%);
    border-radius: 20px;
    border: 2px solid #FFD0B3;
}

.cpm-no-posts p {
    font-size: 18px;
    color: #666;
    margin: 0;
}

/* Hide sidebar */
.single-cpm_portfolio aside,
.single-cpm_portfolio .sidebar,
.single-cpm_portfolio .widget-area,
.single-cpm_portfolio #secondary {
    display: none !important;
}

.single-cpm_portfolio .site-main,
.single-cpm_portfolio .content-area,
.single-cpm_portfolio #primary {
    width: 100% !important;
    max-width: 1200px !important;
    margin: 0 auto !important;
    float: none !important;
}

.post-type-archive-cpm_portfolio aside,
.post-type-archive-cpm_portfolio .sidebar {
    display: none !important;
}

.post-type-archive-cpm_portfolio .site-main {
    width: 100% !important;
    margin: 0 auto !important;
}

/* RESPONSIVE */
@media screen and (min-width: 1200px) {
    .cpm-portfolio-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 30px !important;
    }
}

@media screen and (max-width: 1199px) and (min-width: 992px) {
    .cpm-portfolio-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 25px !important;
    }
    
    .cpm-portfolio-image {
        padding-bottom: 90% !important;
    }
}

@media screen and (max-width: 991px) and (min-width: 768px) {
    .cpm-portfolio-wrapper {
        padding: 30px 15px;
    }
    
    .cpm-portfolio-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 20px !important;
    }
    
    .cpm-portfolio-image {
        padding-bottom: 95% !important;
    }
    
    .cpm-filter-btn {
        padding: 0 22px !important;
        font-size: 13px !important;
        height: 44px !important;
        min-height: 44px !important;
        max-height: 44px !important;
    }
    
    .cpm-portfolio-overlay h3 {
        font-size: 18px !important;
    }
}

@media screen and (max-width: 767px) {
    .cpm-portfolio-wrapper {
        padding: 20px 15px;
    }
    
    .cpm-filter-buttons {
        gap: 10px !important;
        margin-bottom: 30px !important;
        justify-content: flex-start !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        padding: 8px 5px !important;
    }
    
    .cpm-filter-btn {
        padding: 0 20px !important;
        font-size: 12px !important;
        flex-shrink: 0 !important;
        min-width: 80px !important;
        height: 40px !important;
        min-height: 40px !important;
        max-height: 40px !important;
    }
    
    .cpm-portfolio-grid {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }
    
    .cpm-portfolio-image {
        padding-bottom: 75% !important;
    }
    
    .cpm-portfolio-overlay h3 {
        font-size: 18px !important;
    }
    
    .cpm-view-more {
        font-size: 13px !important;
    }
}

/* Fade animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.cpm-portfolio-item {
    animation: fadeIn 0.4s ease;
}

/* Override conflicts */
.cpm-portfolio-grid .cpm-portfolio-item {
    float: none !important;
    width: auto !important;
    margin: 0 !important;
}

.cpm-portfolio-wrapper * {
    box-sizing: border-box;
}
