/* 
 * Zhex Category Card - Scoped CSS Styles
 * TAM İZOLASYON: Tüm kurallar .zhex ana kapsayıcı altında scope edilmiştir
 * Flatsome tema çakışmalarını önlemek için güçlü specificity kullanılmıştır
 */

/* ========================================
   CSS DEĞİŞKENLERİ VE TEMEL WRAPPER
======================================== */

.zhex {
    /* CSS Custom Properties - Dark theme optimized */
    --zhex-bg: #0a0a0a;
    --zhex-card: #1a1a1a;
    --zhex-soft: #2a2a2a;
    --zhex-text: #ffffff;
    --zhex-dim: #b0b0b0;
    --zhex-accent: #4a9eff;
    --zhex-accent-hover: #3a8eef;
    --zhex-green: #00d4aa;
    --zhex-orange: #ff9500;
    --zhex-red: #ff3b30;
    --zhex-yellow: #ffcc00;
    --zhex-border: #333333;
    --zhex-shadow: rgba(0, 0, 0, 0.5);
    
    /* Temel stil ayarları */
    color: var(--zhex-text) !important;
    font: 500 14px/1.5 ui-sans-serif, system-ui, Segoe UI, Roboto, Inter !important;
    
    /* Flatsome tema çakışmalarını önlemek için */
    position: relative !important;
    z-index: 1 !important;
    isolation: isolate !important;
}

/* ========================================
   CSS RESET - SADECE .zhex İÇİNDEKİ ELEMENTLER İÇİN
======================================== */

.zhex *,
.zhex *::before,
.zhex *::after {
    box-sizing: border-box !important;
}

/* Flatsome'ın h1-h6 stillerini override et */
.zhex h1,
.zhex h2,
.zhex h3,
.zhex h4,
.zhex h5,
.zhex h6 {
    margin: 0 !important;
    padding: 0 !important;
    font-weight: inherit !important;
    font-size: inherit !important;
    line-height: inherit !important;
    color: inherit !important;
}

/* Flatsome'ın ul/ol stillerini override et */
.zhex ul,
.zhex ol {
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
}

/* Flatsome'ın link stillerini override et */
.zhex a {
    text-decoration: none !important;
    color: inherit !important;
    border: none !important;
    outline: none !important;
}

/* Flatsome'ın button stillerini override et */
.zhex button {
    background: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    font: inherit !important;
    cursor: pointer !important;
    outline: none !important;
    box-shadow: none !important;
    text-shadow: none !important;
}

/* Flatsome'ın img stillerini override et */
.zhex img {
    max-width: 100% !important;
    height: auto !important;
    display: block !important;
    border: none !important;
}

/* ========================================
   CATEGORY CARD CONTAINER
======================================== */

.zhex .category-card {
    background: linear-gradient(145deg, var(--zhex-card), #222222) !important;
    border: 1px solid var(--zhex-border) !important;
    border-radius: 16px !important;
    overflow: hidden !important;
    box-shadow: 0 8px 32px var(--zhex-shadow) !important;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
    display: block !important;
    box-sizing: border-box !important;
    position: relative !important;
    width: 312px !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    backdrop-filter: blur(10px) !important;
}

.zhex .category-card:hover {
    transform: translateY(-8px) scale(1.02) !important;
    box-shadow: 0 20px 40px var(--zhex-shadow) !important;
    border-color: var(--zhex-accent) !important;
    background: linear-gradient(145deg, #2a2a2a, #1a1a1a) !important;
}

/* ========================================
   CARD HEADER DESIGN
======================================== */

.zhex .category-card .card-header-design {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: 4px !important;
    z-index: 10 !important;
    overflow: hidden !important;
    border-radius: 16px 16px 0 0 !important;
}

.zhex .category-card .header-accent-line {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: 4px !important;
    background: linear-gradient(90deg, #93c5fd, #60a5fa, #3b82f6, #1d4ed8) !important;
    background-size: 200% 100% !important;
    animation: zhex-header-shimmer 3s ease-in-out infinite !important;
}

@keyframes zhex-header-shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* ========================================
   CARD IMAGE SECTION
======================================== */

.zhex .category-card .image {
    position: relative !important;
    width: 100% !important;
    height: 460px !important;
    overflow: hidden !important;
    background: var(--zhex-soft) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.zhex .category-card .image img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
    transition: transform 0.3s ease !important;
    position: relative !important;
    z-index: 2 !important;
}

.zhex .category-card:hover .image img {
    transform: scale(1.05) !important;
}

/* Image placeholder when no image */
.zhex .category-card .image::before {
    content: '📷' !important;
    font-size: 48px !important;
    color: var(--zhex-dim) !important;
    opacity: 0.5 !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    z-index: 1 !important;
}

/* Hide placeholder when image exists */
.zhex .category-card .image:has(img)::before {
    display: none !important;
}

/* Fallback for browsers that don't support :has() */
.zhex .category-card .image img {
    position: relative !important;
    z-index: 2 !important;
}

/* Image overlay gradient */
.zhex .category-card .image::after {
    content: '' !important;
    position: absolute !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: 60px !important;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7)) !important;
    z-index: 2 !important;
    pointer-events: none !important;
}

/* ========================================
   CARD CONTENT SECTION
======================================== */

.zhex .category-card .content {
    padding: 20px !important;
    background: var(--zhex-card) !important;
    position: relative !important;
    z-index: 3 !important;
}

.zhex .category-card .title {
    font-size: 16px !important;
    font-weight: 900 !important;
    color: #ffffff !important;
    margin: 0 0 12px 0 !important;
    background: linear-gradient(135deg, #93c5fd, #60a5fa, #3b82f6) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    background-clip: text !important;
    letter-spacing: -0.5px !important;
    line-height: 1.2 !important;
    text-align: center !important;
    text-transform: uppercase !important;
}

.zhex .category-card .excerpt {
    font-size: 12px !important;
    color: var(--zhex-dim) !important;
    line-height: 1.4 !important;
    margin: 0 0 16px 0 !important;
    text-align: center !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

/* ========================================
   READ MORE BUTTON
======================================== */

.zhex .category-card .readmore {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 10px !important;
    width: 100% !important;
    padding: 10px 16px !important;
    background: linear-gradient(135deg, var(--zhex-accent), var(--zhex-accent-hover)) !important;
    color: #ffffff !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    border-radius: 12px !important;
    cursor: pointer !important;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
    text-decoration: none !important;
    border: none !important;
    outline: none !important;
    box-shadow: 0 4px 16px rgba(74, 158, 255, 0.4) !important;
    position: relative !important;
    overflow: hidden !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
}

.zhex .category-card .readmore::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, 255, 255, 0.2), transparent) !important;
    transition: left 0.6s ease !important;
}

.zhex .category-card .readmore:hover::before {
    left: 100% !important;
}

.zhex .category-card .readmore:hover {
    transform: translateY(-3px) scale(1.05) !important;
    box-shadow: 0 8px 24px rgba(74, 158, 255, 0.6) !important;
    background: linear-gradient(135deg, var(--zhex-accent-hover), var(--zhex-accent)) !important;
}

.zhex .category-card .readmore:active {
    transform: translateY(0) !important;
    box-shadow: 0 2px 8px rgba(106, 169, 255, 0.3) !important;
}

.zhex .category-card .readmore .icon {
    width: 16px !important;
    height: 16px !important;
    transition: transform 0.3s ease !important;
}

.zhex .category-card .readmore:hover .icon {
    transform: translateX(2px) !important;
}

/* ========================================
   LIGHTBOX POPUP CONTENT
======================================== */

.zhex .popup {
    display: none !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.8) !important;
    z-index: 9999 !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 20px !important;
    box-sizing: border-box !important;
}

.zhex .popup.is-active {
    display: flex !important;
}

.zhex .popup .popup-content {
    background: var(--zhex-card) !important;
    border-radius: 16px !important;
    padding: 30px !important;
    max-width: 600px !important;
    width: 100% !important;
    max-height: 80vh !important;
    overflow-y: auto !important;
    position: relative !important;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5) !important;
    border: 1px solid #202020 !important;
}

.zhex .popup .popup-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    margin-bottom: 20px !important;
    padding-bottom: 15px !important;
    border-bottom: 1px solid #202020 !important;
}

.zhex .popup .popup-title {
    font-size: 24px !important;
    font-weight: 700 !important;
    color: var(--zhex-text) !important;
    margin: 0 !important;
}

.zhex .popup .popup-close {
    width: 32px !important;
    height: 32px !important;
    border-radius: 50% !important;
    background: #202020 !important;
    color: var(--zhex-dim) !important;
    border: none !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s ease !important;
    font-size: 18px !important;
    line-height: 1 !important;
}

.zhex .popup .popup-close:hover {
    background: var(--zhex-accent) !important;
    color: #ffffff !important;
    transform: scale(1.1) !important;
}

.zhex .popup .popup-body {
    color: var(--zhex-text) !important;
    line-height: 1.6 !important;
}

.zhex .popup .popup-body h1,
.zhex .popup .popup-body h2,
.zhex .popup .popup-body h3,
.zhex .popup .popup-body h4,
.zhex .popup .popup-body h5,
.zhex .popup .popup-body h6 {
    color: var(--zhex-text) !important;
    margin: 20px 0 10px 0 !important;
    font-weight: 600 !important;
}

.zhex .popup .popup-body p {
    margin: 0 0 15px 0 !important;
}

.zhex .popup .popup-body ul,
.zhex .popup .popup-body ol {
    margin: 0 0 15px 0 !important;
    padding-left: 20px !important;
    list-style: disc !important;
}

.zhex .popup .popup-body ol {
    list-style: decimal !important;
}

.zhex .popup .popup-body a {
    color: var(--zhex-accent) !important;
    text-decoration: underline !important;
}

.zhex .popup .popup-body a:hover {
    color: #4f9eff !important;
}

/* ========================================
   GRID LAYOUT
======================================== */

.zhex .category-cards-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(312px, 1fr)) !important;
    gap: 24px !important;
    padding: 20px 0 !important;
    justify-items: stretch !important;
    align-items: start !important;
}

/* ========================================
   RESPONSIVE DESIGN
======================================== */

@media (max-width: 768px) {
    .zhex .category-card {
        width: 100% !important;
        max-width: 350px !important;
    }
    
    .zhex .category-card .image {
        height: 400px !important;
    }
    
    .zhex .category-cards-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
        padding: 16px 0 !important;
    }
    
    .zhex .popup .popup-content {
        margin: 10px !important;
        padding: 20px !important;
        max-height: 90vh !important;
    }
    
    .zhex .popup .popup-title {
        font-size: 20px !important;
    }
}

@media (max-width: 480px) {
    .zhex .category-card .image {
        height: 350px !important;
    }
    
    .zhex .category-card .content {
        padding: 16px !important;
    }
    
    .zhex .category-card .title {
        font-size: 16px !important;
    }
    
    .zhex .category-card .excerpt {
        font-size: 13px !important;
    }
    
    .zhex .category-card .readmore {
        padding: 10px 16px !important;
        font-size: 13px !important;
    }
}

/* ========================================
   FLATSOME TEMA ÇAKIŞMALARINI ÖNLEME
======================================== */

/* Flatsome'ın col-inner sınıfını override et */
.zhex.col-inner,
.zhex .col-inner {
    padding: 0 !important;
    margin: 0 !important;
    background: none !important;
    border: none !important;
}

/* Flatsome'ın button sınıflarını override et - readmore button'ını hariç tut */
.zhex .button:not(.readmore),
.zhex button.button:not(.readmore) {
    all: unset !important;
    padding: 6px 10px !important;
    background: #151a24 !important;
    color: var(--zhex-dim) !important;
    border: 1px solid #202020 !important;
    border-radius: 999px !important;
    cursor: pointer !important;
    display: inline-block !important;
    font-family: inherit !important;
    font-size: inherit !important;
    line-height: inherit !important;
    text-align: center !important;
    box-sizing: border-box !important;
}

/* Flatsome'ın flex container'larını override et */
.zhex .flex,
.zhex [class*="flex"] {
    display: flex !important;
}

/* Flatsome'ın text-align stillerini override et */
.zhex .text-left { text-align: left !important; }
.zhex .text-center { text-align: center !important; }
.zhex .text-right { text-align: right !important; }

/* ========================================
   SEO CONTENT (Hidden but accessible to search engines)
======================================== */

.zhex .seo-content {
    position: absolute !important;
    left: -9999px !important;
    top: -9999px !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    font-size: 1px !important;
    line-height: 1px !important;
    color: transparent !important;
    background: transparent !important;
    /* SEO-friendly: content is in HTML but visually hidden */
}

.zhex .seo-content .seo-title {
    font-size: 1px !important;
    line-height: 1px !important;
    margin: 0 !important;
    padding: 0 !important;
}

.zhex .seo-content .seo-excerpt {
    font-size: 1px !important;
    line-height: 1px !important;
    margin: 0 !important;
    padding: 0 !important;
}

.zhex .seo-content .seo-body {
    font-size: 1px !important;
    line-height: 1px !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* ========================================
   ERROR HANDLING
======================================== */

.zhex .zhex-error {
    background: #ffebee !important;
    color: #c62828 !important;
    padding: 15px !important;
    border: 1px solid #ffcdd2 !important;
    border-radius: 8px !important;
    margin: 10px 0 !important;
    text-align: center !important;
    font-weight: 500 !important;
}

.zhex .zhex-warning {
    background: #fff3e0 !important;
    color: #ef6c00 !important;
    padding: 15px !important;
    border: 1px solid #ffcc02 !important;
    border-radius: 8px !important;
    margin: 10px 0 !important;
    text-align: center !important;
    font-weight: 500 !important;
}

/* ========================================
   ACCESSIBILITY
======================================== */

.zhex .category-card .readmore:focus,
.zhex .popup .popup-close:focus {
    outline: 2px solid var(--zhex-accent) !important;
    outline-offset: 2px !important;
}

/* Screen reader only text */
.zhex .sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* ========================================
   ANIMATIONS
======================================== */

@keyframes zhex-fade-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.zhex .category-card {
    animation: zhex-fade-in 0.6s ease-out !important;
}

.zhex .popup.is-active .popup-content {
    animation: zhex-fade-in 0.3s ease-out !important;
}

/* ========================================
   REDUCED MOTION SUPPORT
======================================== */

@media (prefers-reduced-motion: reduce) {
    .zhex .category-card,
    .zhex .category-card .readmore,
    .zhex .category-card .image img,
    .zhex .popup .popup-content {
        transition: none !important;
        animation: none !important;
    }
    
    .zhex .category-card:hover {
        transform: none !important;
    }
    
    .zhex .category-card .readmore:hover {
        transform: none !important;
    }
    
    .zhex .category-card:hover .image img {
        transform: none !important;
    }
}
