/* Custom CSS Overrides - AFM Digital */
/* Fix untuk menghilangkan referensi madebydesignesia.com */

/* Override breadcrumb styles */
.breadcrumb-item + .breadcrumb-item::before {
    content: ">" !important;
    padding-right: 0.5rem !important;
    padding-left: 0.5rem !important;
    color: #6c757d !important;
}

/* Override crumb styles */
.crumb li:after {
    font-family: "FontAwesome" !important;
    content: "\f054" !important;
    font-size: 10px !important;
    margin: 0 10px 0 10px !important;
    opacity: .5 !important;
}

/* Menghilangkan any potential URL references */
*[href*="madebydesignesia"],
*[src*="madebydesignesia"],
*::before[content*="madebydesignesia"],
*::after[content*="madebydesignesia"] {
    display: none !important;
    visibility: hidden !important;
    content: "" !important;
}

/* Custom breadcrumb untuk AFM Digital */
.breadcrumb-afm {
    display: flex;
    flex-wrap: wrap;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    list-style: none;
    background-color: #f8f9fa;
    border-radius: 0.375rem;
}

.breadcrumb-afm .breadcrumb-item + .breadcrumb-item {
    padding-left: 0.5rem;
}

.breadcrumb-afm .breadcrumb-item + .breadcrumb-item::before {
    float: left;
    padding-right: 0.5rem;
    color: #6c757d;
    content: "→";
}

.breadcrumb-afm .breadcrumb-item.active {
    color: #6c757d;
}

/* Force clean navigation */
nav[aria-label="breadcrumb"] ol li::before,
nav[aria-label="breadcrumb"] ol li::after {
    content: "" !important;
}

nav[aria-label="breadcrumb"] ol li + li::before {
    content: "→" !important;
    margin: 0 0.5rem !important;
    color: #6c757d !important;
}

/* Fix for product detail buttons */
.btn-main {
    position: relative !important;
    display: inline-block !important;
    padding: 12px 24px !important;
    text-decoration: none !important;
    border: none !important;
    border-radius: 5px !important;
    font-weight: 500 !important;
    text-align: center !important;
    transition: all 0.3s ease !important;
    cursor: pointer !important;
    white-space: nowrap !important;
    line-height: 1.5 !important;
    min-width: auto !important;
    max-width: none !important;
}

.btn-main:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2) !important;
    text-decoration: none !important;
}

.btn-main:active {
    transform: translateY(0) !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
}

.btn-main.bg-success {
    background-color: #28a745 !important;
    color: white !important;
}

.btn-main.bg-color-2 {
    background-color: var(--primary-color, #007bff) !important;
    color: white !important;
}

.btn-main.bg-dark {
    background-color: #343a40 !important;
    color: white !important;
}

/* Action buttons container fix */
.d-flex.gap-3 {
    display: flex !important;
    gap: 1rem !important;
    flex-wrap: wrap !important;
    align-items: center !important;
}

/* Responsive button adjustments */
@media (max-width: 768px) {
    .btn-main {
        padding: 10px 20px !important;
        font-size: 14px !important;
        margin-bottom: 0.5rem !important;
    }
    
    .d-flex.gap-3 {
        flex-direction: column !important;
        align-items: stretch !important;
    }
}

/* Specific fix for back button */
.afm-back-button {
    pointer-events: auto !important;
    position: relative !important;
    z-index: 10 !important;
    overflow: visible !important;
    width: auto !important;
    min-width: auto !important;
    max-width: none !important;
    flex: none !important;
}

.afm-back-button:before,
.afm-back-button:after {
    display: none !important;
    content: none !important;
}

.afm-back-button:hover {
    background-color: #23272b !important;
    color: white !important;
    text-decoration: none !important;
}

.afm-back-button:active,
.afm-back-button:focus {
    background-color: #1d2124 !important;
    color: white !important;
    text-decoration: none !important;
    outline: none !important;
    box-shadow: 0 0 0 0.2rem rgba(52, 58, 64, 0.25) !important;
}

/* Card button fixes */
.card-body .btn-main {
    display: block !important;
    width: 100% !important;
    text-align: center !important;
    padding: 12px 24px !important;
    margin-top: auto !important;
    flex-shrink: 0 !important;
    border: none !important;
    box-sizing: border-box !important;
}

.card-body .btn-main:hover {
    transform: none !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
}

.card-body .btn-main:active {
    transform: none !important;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1) !important;
}

/* Card hover effects */
.hover-shadow-lg {
    transition: all 0.3s ease !important;
}

.hover-shadow-lg:hover {
    box-shadow: 0 10px 25px rgba(0,0,0,0.15) !important;
    transform: translateY(-2px) !important;
}

/* Bootstrap card body flex fixes */
.card-body.d-flex.flex-column {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
}

.card-body .flex-grow-1 {
    flex-grow: 1 !important;
    margin-bottom: 1rem !important;
}

/* Category description text handling */
.category-description {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 4 !important;
    line-clamp: 4 !important;
    -webkit-box-orient: vertical !important;
    line-height: 1.5 !important;
    max-height: 6em !important; /* 4 lines * 1.5 line-height */
    word-wrap: break-word !important;
    hyphens: auto !important;
}

/* Card height consistency */
.card.h-100 {
    height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
}

.card.h-100 .card-body {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
}

/* Card title consistency */
.card-title {
    margin-bottom: 0.75rem !important;
    font-size: 1.25rem !important;
    font-weight: 600 !important;
    line-height: 1.2 !important;
    min-height: 1.5em !important;
}

/* Gallery Styles */
.gallery-lightbox {
    display: block;
    text-decoration: none;
    color: inherit;
}

.gallery-lightbox:hover {
    text-decoration: none;
    color: inherit;
}

.gallery-overlay {
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0) 0%,
        rgba(0, 0, 0, 0.3) 60%,
        rgba(0, 0, 0, 0.7) 100%
    );
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-item:hover .gallery-overlay {
    opacity: 1;
}

.gallery-info {
    transform: translateY(100%);
    transition: transform 0.3s ease;
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.8) 0%,
        rgba(0, 0, 0, 0.4) 70%,
        rgba(0, 0, 0, 0) 100%
    );
}

.gallery-item:hover .gallery-info {
    transform: translateY(0);
}

/* Gallery Filter Button Stabilization - FIXED VERSION */
.gallery-filters {
    margin-bottom: 3rem !important;
    text-align: center !important;
}

.gallery-filters .btn {
    border-radius: 25px !important;
    padding: 8px 20px !important;
    font-weight: 500 !important;
    transition: all 0.3s ease !important;
    border: 2px solid #007bff !important;
    background-color: transparent !important;
    color: #007bff !important;
    white-space: nowrap !important;
    min-width: auto !important;
    max-width: none !important;
    width: auto !important;
    height: 40px !important;
    min-height: 40px !important;
    max-height: 40px !important;
    display: inline-block !important;
    box-sizing: border-box !important;
    text-align: center !important;
    vertical-align: middle !important;
    position: relative !important;
    overflow: hidden !important;
    flex: none !important;
    line-height: 1.5 !important;
    margin: 0 0.25rem 0.5rem 0 !important;
}

.gallery-filters .btn:hover,
.gallery-filters .btn.active {
    background-color: #007bff !important;
    color: white !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3) !important;
    border: 2px solid #007bff !important;
    padding: 8px 20px !important;
    white-space: nowrap !important;
    min-width: auto !important;
    max-width: none !important;
    width: auto !important;
    height: 40px !important;
    min-height: 40px !important;
    max-height: 40px !important;
    display: inline-block !important;
    box-sizing: border-box !important;
    text-align: center !important;
    vertical-align: middle !important;
    position: relative !important;
    overflow: hidden !important;
    flex: none !important;
    line-height: 1.5 !important;
}

.gallery-filters .btn:active,
.gallery-filters .btn:focus {
    background-color: #0056b3 !important;
    color: white !important;
    border: 2px solid #0056b3 !important;
    padding: 8px 20px !important;
    white-space: nowrap !important;
    min-width: auto !important;
    max-width: none !important;
    width: auto !important;
    height: 40px !important;
    min-height: 40px !important;
    max-height: 40px !important;
    display: inline-block !important;
    box-sizing: border-box !important;
    text-align: center !important;
    vertical-align: middle !important;
    transform: translateY(0) !important;
    outline: none !important;
    box-shadow: 0 2px 6px rgba(0, 123, 255, 0.3) !important;
    overflow: hidden !important;
    flex: none !important;
    line-height: 1.5 !important;
}

.gallery-filters .btn:before,
.gallery-filters .btn:after {
    display: none !important;
    content: none !important;
}

/* Prevent any Bootstrap/template conflicts */
.gallery-filters .btn {
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
}

/* Disable any potential pseudo-element interference */
.gallery-filters .btn::before,
.gallery-filters .btn::after {
    display: none !important;
    content: none !important;
    width: 0 !important;
    height: 0 !important;
}

/* Force consistent layout - ENHANCED */
.gallery-filters .btn-outline-primary {
    border-radius: 25px !important;
    padding: 8px 20px !important;
    font-weight: 500 !important;
    transition: all 0.3s ease !important;
    border: 2px solid #007bff !important;
    background-color: transparent !important;
    color: #007bff !important;
    white-space: nowrap !important;
    min-width: auto !important;
    max-width: none !important;
    width: auto !important;
    height: 40px !important;
    min-height: 40px !important;
    max-height: 40px !important;
    display: inline-block !important;
    box-sizing: border-box !important;
    text-align: center !important;
    vertical-align: middle !important;
    position: relative !important;
    overflow: hidden !important;
    flex: none !important;
    margin: 0 0.25rem 0.5rem 0 !important;
    line-height: 1.5 !important;
    font-size: 0.9375rem !important;
}

.gallery-filters .btn-outline-primary:hover,
.gallery-filters .btn-outline-primary.active {
    background-color: #007bff !important;
    color: white !important;
    border: 2px solid #007bff !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3) !important;
    padding: 8px 20px !important;
    white-space: nowrap !important;
    min-width: auto !important;
    max-width: none !important;
    width: auto !important;
    height: 40px !important;
    min-height: 40px !important;
    max-height: 40px !important;
    display: inline-block !important;
    box-sizing: border-box !important;
    text-align: center !important;
    vertical-align: middle !important;
    position: relative !important;
    overflow: hidden !important;
    flex: none !important;
    line-height: 1.5 !important;
    font-size: 0.9375rem !important;
}

.gallery-filters .btn-outline-primary:active,
.gallery-filters .btn-outline-primary:focus {
    background-color: #0056b3 !important;
    color: white !important;
    border: 2px solid #0056b3 !important;
    padding: 8px 20px !important;
    white-space: nowrap !important;
    min-width: auto !important;
    max-width: none !important;
    width: auto !important;
    height: 40px !important;
    min-height: 40px !important;
    max-height: 40px !important;
    display: inline-block !important;
    box-sizing: border-box !important;
    text-align: center !important;
    vertical-align: middle !important;
    transform: translateY(0) !important;
    outline: none !important;
    box-shadow: 0 2px 6px rgba(0, 123, 255, 0.3) !important;
    overflow: hidden !important;
    flex: none !important;
    line-height: 1.5 !important;
    font-size: 0.9375rem !important;
}

/* ULTRA AGGRESSIVE Button Stabilization for Gallery Filters */
.gallery-filters .btn,
.gallery-filters .btn-outline-primary,
.gallery-filters button {
    /* Absolutely prevent any dimension changes */
    contain: layout style !important;
    will-change: transform, background-color, color !important;
    transform-style: preserve-3d !important;
    backface-visibility: hidden !important;
    
    /* Force fixed dimensions with calc() to prevent browser recalculation */
    width: auto !important;
    height: 40px !important;
    min-height: 40px !important;
    max-height: 40px !important;
    
    /* Prevent any text reflow */
    text-overflow: clip !important;
    word-wrap: normal !important;
    word-break: keep-all !important;
    hyphens: none !important;
    
    /* Absolutely prevent any overflow that could change dimensions */
    overflow: hidden !important;
    overflow-x: hidden !important;
    overflow-y: hidden !important;
    
    /* Force GPU acceleration */
    transform: translateZ(0) !important;
}

.gallery-filters .btn:hover,
.gallery-filters .btn:active, 
.gallery-filters .btn:focus,
.gallery-filters .btn.active,
.gallery-filters .btn-outline-primary:hover,
.gallery-filters .btn-outline-primary:active,
.gallery-filters .btn-outline-primary:focus,
.gallery-filters .btn-outline-primary.active {
    /* Same exact dimensions in all states */
    width: auto !important;
    height: 40px !important;
    min-height: 40px !important;
    max-height: 40px !important;
    
    /* Prevent any text reflow in active states */
    text-overflow: clip !important;
    word-wrap: normal !important;
    word-break: keep-all !important;
    hyphens: none !important;
    
    /* Force containment */
    contain: layout style !important;
    overflow: hidden !important;
    overflow-x: hidden !important;
    overflow-y: hidden !important;
    
    /* Maintain GPU acceleration */
    transform: translateZ(0) translateY(-2px) !important;
}

/* Mobile version with same ultra-aggressive approach */
@media (max-width: 768px) {
    .gallery-filters .btn,
    .gallery-filters .btn-outline-primary,
    .gallery-filters button {
        height: 36px !important;
        min-height: 36px !important;
        max-height: 36px !important;
        contain: layout style !important;
        overflow: hidden !important;
        transform: translateZ(0) !important;
    }
    
    .gallery-filters .btn:hover,
    .gallery-filters .btn:active, 
    .gallery-filters .btn:focus,
    .gallery-filters .btn.active,
    .gallery-filters .btn-outline-primary:hover,
    .gallery-filters .btn-outline-primary:active,
    .gallery-filters .btn-outline-primary:focus,
    .gallery-filters .btn-outline-primary.active {
        height: 36px !important;
        min-height: 36px !important;
        max-height: 36px !important;
        contain: layout style !important;
        overflow: hidden !important;
        transform: translateZ(0) translateY(-2px) !important;
    }
}

/* FINAL SOLUTION - CSS Grid Layout untuk Gallery Filters */
.gallery-filters {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 0.5rem !important;
    margin-bottom: 3rem !important;
}

.gallery-filters .btn,
.gallery-filters .btn-outline-primary {
    /* Remove all Bootstrap flex properties */
    flex: none !important;
    flex-grow: 0 !important;
    flex-shrink: 0 !important;
    flex-basis: auto !important;
    
    /* Force static positioning */
    position: static !important;
    float: none !important;
    
    /* Ultra-specific dimensions */
    width: fit-content !important;
    height: 40px !important;
    min-width: fit-content !important;
    max-width: max-content !important;
    min-height: 40px !important;
    max-height: 40px !important;
    
    /* Prevent any bootstrap interference */
    margin: 0 !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
    
    /* Force content to not wrap or change */
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    
    /* Absolutely prevent content overflow */
    text-overflow: ellipsis !important;
    overflow: hidden !important;
    white-space: nowrap !important;
    
    /* Force browser not to recalculate */
    contain: layout !important;
    will-change: background-color, color !important;
}

.gallery-filters .btn:hover,
.gallery-filters .btn:active,
.gallery-filters .btn:focus,
.gallery-filters .btn.active,
.gallery-filters .btn-outline-primary:hover,
.gallery-filters .btn-outline-primary:active,
.gallery-filters .btn-outline-primary:focus,
.gallery-filters .btn-outline-primary.active {
    /* Exact same layout properties */
    flex: none !important;
    flex-grow: 0 !important;
    flex-shrink: 0 !important;
    flex-basis: auto !important;
    
    position: static !important;
    float: none !important;
    
    width: fit-content !important;
    height: 40px !important;
    min-width: fit-content !important;
    max-width: max-content !important;
    min-height: 40px !important;
    max-height: 40px !important;
    
    margin: 0 !important;
    
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    
    text-overflow: ellipsis !important;
    overflow: hidden !important;
    white-space: nowrap !important;
    
    contain: layout !important;
}

/* Mobile version */
@media (max-width: 768px) {
    .gallery-filters .btn,
    .gallery-filters .btn-outline-primary {
        height: 36px !important;
        min-height: 36px !important;
        max-height: 36px !important;
    }
    
    .gallery-filters .btn:hover,
    .gallery-filters .btn:active,
    .gallery-filters .btn:focus,
    .gallery-filters .btn.active,
    .gallery-filters .btn-outline-primary:hover,
    .gallery-filters .btn-outline-primary:active,
    .gallery-filters .btn-outline-primary:focus,
    .gallery-filters .btn-outline-primary.active {
        height: 36px !important;
        min-height: 36px !important;
        max-height: 36px !important;
    }
}

/* Gallery Item Animation */
.gallery-item {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease forwards;
}

.gallery-item:nth-child(1) { animation-delay: 0.1s; }
.gallery-item:nth-child(2) { animation-delay: 0.2s; }
.gallery-item:nth-child(3) { animation-delay: 0.3s; }
.gallery-item:nth-child(4) { animation-delay: 0.4s; }
.gallery-item:nth-child(5) { animation-delay: 0.5s; }
.gallery-item:nth-child(6) { animation-delay: 0.6s; }

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Lightbox Enhancement */
.gallery-lightbox img {
    transition: transform 0.3s ease;
}

.gallery-lightbox:hover img {
    transform: scale(1.05);
}
