/* === استایل مدرن و خلاقانه WooCommerce Category Modal === */

/* --- کانتینر ویجت با افکت‌های مدرن --- */
.wcmw-image-container {
    cursor: pointer;
    overflow: hidden;
    display: inline-block;
    position: relative;
    border-radius: 24px;
    transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
    box-shadow: 
        0 10px 40px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.wcmw-image-container:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: conic-gradient(from 45deg, rgba(123, 97, 255, 0.1), rgba(255, 154, 158, 0.1), rgba(74, 222, 128, 0.1), rgba(123, 97, 255, 0.1));
    opacity: 0;
    transition: all 0.6s ease;
    border-radius: inherit;
    z-index: 1;
}

.wcmw-image-container:hover:before {
    opacity: 1;
    transform: rotate(180deg);
}

.wcmw-image-container img {
    display: block;
    max-width: 100%;
    height: auto;
    transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
    border-radius: inherit;
}

.wcmw-image-container:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 
        0 25px 60px rgba(0, 0, 0, 0.15),
        0 0 0 2px rgba(123, 97, 255, 0.2);
}

.wcmw-image-container:hover img {
    transform: scale(1.05);
}

/* --- بیس مودال با Glassmorphism --- */
.wcmw-modal {
    display: none;
    position: fixed;
    z-index: 99999;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    direction: rtl;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'IRANSans', sans-serif;
}

.wcmw-modal.wcmw-is-open {
    display: flex;
    animation: wcmw-modal-backdrop-enter 0.5s ease forwards;
}

.wcmw-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(123, 97, 255, 0.2), rgba(0, 0, 0, 0.7));
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    animation: wcmw-overlay-enter 0.6s ease forwards;
}

.wcmw-modal-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0;
    border-radius: 32px;
    box-shadow: 
        0 40px 80px rgba(0, 0, 0, 0.2),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    position: relative;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: wcmw-modal-enter 0.8s cubic-bezier(0.23, 1, 0.32, 1) forwards;
    opacity: 0;
    transform: scale(0.8) translateY(40px);
}

/* --- هدر مودال با toolbar مینیمال --- */
.wcmw-modal-toolbar {
    position: absolute;
    top: 20px;
    right: 20px;
    left: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
    pointer-events: none;
}

.wcmw-modal-toolbar > * {
    pointer-events: all;
}

/* دکمه بستن مینیمال */
.wcmw-close {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
    font-size: 16px;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.wcmw-close:hover {
    background: rgba(239, 68, 68, 0.9);
    transform: scale(1.1);
    box-shadow: 0 8px 25px rgba(239, 68, 68, 0.3);
}

.wcmw-close:active {
    transform: scale(0.95);
}

/* دکمه برگشت مینیمال */
.wcmw-back-btn {
    padding: 10px 16px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    display: flex;
    align-items: center;
    gap: 6px;
    opacity: 0;
    transform: translateX(-20px);
    animation: wcmw-back-btn-enter 0.4s ease 0.3s forwards;
}

.wcmw-back-btn:before {
    content: '←';
    font-size: 14px;
    transition: transform 0.3s ease;
}

.wcmw-back-btn:hover {
    background: rgba(102, 126, 234, 0.9);
    transform: translateX(-3px) scale(1.05);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.wcmw-back-btn:hover:before {
    transform: translateX(-2px);
}

.wcmw-back-btn:active {
    transform: translateX(-3px) scale(0.95);
}

/* --- عنوان مودال --- */
.wcmw-modal-title {
    text-align: center;
    font-size: 32px;
    font-weight: 800;
    margin: 80px 0 30px 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: wcmw-gradient-shift 3s ease-in-out infinite;
    position: relative;
    padding: 0 30px;
}

.wcmw-modal-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    width: 80px;
    height: 4px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    transform: translateX(-50%);
    border-radius: 2px;
    animation: wcmw-underline-pulse 2s ease-in-out infinite;
}

/* --- بریدکرامب تعاملی --- */
.wcmw-breadcrumb {
    padding: 20px 30px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    background: rgba(248, 250, 252, 0.8);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    margin: 0 30px 20px 30px;
    border: 1px solid rgba(226, 232, 240, 0.3);
    font-family: 'IRANSansX';
}

.wcmw-breadcrumb-item {
    padding: 10px 18px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.wcmw-breadcrumb-item:before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    transition: left 0.4s ease;
}

.wcmw-breadcrumb-item:hover:before {
    left: 0;
}

.wcmw-breadcrumb-item:not(.wcmw-current) {
    color: #64748b;
    border: 2px solid transparent;
}

.wcmw-breadcrumb-item:not(.wcmw-current):hover {
    color: #667eea;
    border-color: rgba(102, 126, 234, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.2);
}

.wcmw-breadcrumb-item.wcmw-current {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.wcmw-breadcrumb-separator {
    color: #94a3b8;
    font-size: 16px;
    animation: wcmw-separator-pulse 2s ease-in-out infinite;
}

/* --- بدنه مودال --- */
.wcmw-modal-body {
    padding: 20px 30px 40px 30px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(102, 126, 234, 0.3) transparent;
    flex: 1;
}

.wcmw-modal-body::-webkit-scrollbar {
    width: 6px;
}

.wcmw-modal-body::-webkit-scrollbar-track {
    background: transparent;
}

.wcmw-modal-body::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 10px;
}

.wcmw-modal-body::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #5a6fd8, #6b47a0);
}

/* --- گرید کارت‌های مدرن --- */
.wcmw-modal-categories {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
    padding: 10px 0;
}

/* --- کارت‌های دسته‌بندی پیشرفته --- */
.wcmw-category-item {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(226, 232, 240, 0.3);
    border-radius: 24px;
    padding: 24px;
    text-decoration: none;
    color: #1e293b;
    transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 80px;
    cursor: pointer;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}

.wcmw-category-item:before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: conic-gradient(from 45deg, rgba(102, 126, 234, 0.05), rgba(118, 75, 162, 0.05), rgba(240, 147, 251, 0.05));
    transition: left 0.6s ease;
    z-index: 0;
}

.wcmw-category-item:hover:before {
    left: 0;
}

.wcmw-category-item:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 
        0 20px 50px rgba(0, 0, 0, 0.15),
        0 0 0 2px rgba(102, 126, 234, 0.2);
    border-color: rgba(102, 126, 234, 0.3);
}

.wcmw-category-item * {
    position: relative;
    z-index: 1;
}

.wcmw-category-name {
    font-size: 18px;
    font-weight: 700;
    flex: 1;
    transition: all 0.3s ease;
    color: #1e293b;
}

.wcmw-category-item:hover .wcmw-category-name {
    color: #667eea;
    transform: translateX(8px);
}

.wcmw-category-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.wcmw-product-count {
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
    color: #64748b;
    font-size: 13px;
    font-weight: 700;
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid rgba(203, 213, 225, 0.5);
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.wcmw-category-item:hover .wcmw-product-count {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    transform: scale(1.1) translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

/* --- دکمه فلش مدرن و تعاملی --- */
.wcmw-arrow {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: 3px solid rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    box-shadow: 
        0 8px 25px rgba(102, 126, 234, 0.3),
        0 0 0 0 rgba(102, 126, 234, 0.2);
    position: relative;
    overflow: hidden;
}

.wcmw-arrow:before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transition: all 0.4s ease;
    transform: translate(-50%, -50%);
}

.wcmw-has-children:hover .wcmw-arrow {
    transform: scale(1.15) rotate(90deg);
    box-shadow: 
        0 12px 35px rgba(102, 126, 234, 0.4),
        0 0 0 10px rgba(102, 126, 234, 0.1);
    background: linear-gradient(135deg, #5a6fd8, #6b47a0);
}

.wcmw-has-children:hover .wcmw-arrow:before {
    width: 100%;
    height: 100%;
}

.wcmw-arrow:active {
    transform: scale(1.05) rotate(90deg);
}

/* --- پیام خالی بودن --- */
.wcmw-no-subcategories {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 40px;
    background: rgba(248, 250, 252, 0.8);
    backdrop-filter: blur(10px);
    border: 2px dashed rgba(203, 213, 225, 0.5);
    border-radius: 24px;
    color: #64748b;
    font-size: 18px;
    font-weight: 500;
    position: relative;
}

.wcmw-no-subcategories:before {
    content: '🔍';
    font-size: 48px;
    display: block;
    margin-bottom: 16px;
    opacity: 0.6;
    animation: wcmw-float 3s ease-in-out infinite;
}

/* --- انیمیشن‌های پیشرفته --- */
@keyframes wcmw-modal-backdrop-enter {
    from { backdrop-filter: blur(0px); }
    to { backdrop-filter: blur(15px); }
}

@keyframes wcmw-overlay-enter {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes wcmw-modal-enter {
    from { 
        opacity: 0;
        transform: scale(0.8) translateY(40px);
    }
    to { 
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes wcmw-back-btn-enter {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes wcmw-gradient-shift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

@keyframes wcmw-underline-pulse {
    0%, 100% { 
        opacity: 1; 
        transform: translateX(-50%) scaleX(1);
    }
    50% { 
        opacity: 0.7; 
        transform: translateX(-50%) scaleX(1.2);
    }
}

@keyframes wcmw-separator-pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

@keyframes wcmw-float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

@keyframes wcmw-card-enter {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* انیمیشن ورود کارت‌ها */
.wcmw-category-item {
    animation: wcmw-card-enter 0.6s ease forwards;
    opacity: 0;
}

/* --- ریسپانسیو تبلت --- */
@media (max-width: 1024px) {
    .wcmw-modal-categories {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 20px;
    }

    .wcmw-category-item {
        padding: 20px;
        min-height: 75px;
    }

    .wcmw-arrow {
        width: 48px;
        height: 48px;
        font-size: 18px;
    }
}

/* --- ریسپانسیو موبایل --- */
@media (max-width: 768px) {
    .wcmw-modal-content {
        width: 95%;
        max-height: 80vh;
        border-radius: 24px;
        margin: 20px;
    }

    .wcmw-modal-toolbar {
        top: 15px;
        right: 15px;
        left: 15px;
    }

    .wcmw-close {
        width: 36px;
        height: 36px;
        font-size: 14px;
        border-radius: 10px;
    }

    .wcmw-back-btn {
        padding: 8px 14px;
        font-size: 13px;
        border-radius: 10px;
    }

    .wcmw-modal-title {
        font-size: 26px;
        margin: 70px 0 25px 0;
        padding: 0 20px;
    }

    .wcmw-breadcrumb {
        margin: 0 20px 15px 20px;
        padding: 15px 20px;
        gap: 8px;
    }

    .wcmw-breadcrumb-item {
        padding: 8px 14px;
        font-size: 13px;
    }

    .wcmw-modal-body {
        padding: 15px 20px 30px 20px;
    }

    .wcmw-modal-categories {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .wcmw-category-item {
        padding: 20px;
        border-radius: 20px;
        min-height: 70px;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .wcmw-category-name {
        font-size: 16px;
        flex: 1;
        text-align: right;
    }

    .wcmw-category-meta {
        display: flex;
        align-items: center;
        gap: 12px;
        flex-shrink: 0;
    }

    .wcmw-product-count {
        font-size: 12px;
        padding: 6px 12px;
    }

    .wcmw-arrow {
        width: 46px;
        height: 46px;
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    .wcmw-modal-content {
        width: 98%;
        margin: 10px;
        border-radius: 20px;
    }

    .wcmw-modal-toolbar {
        top: 12px;
        right: 12px;
        left: 12px;
    }

    .wcmw-close {
        width: 34px;
        height: 34px;
        font-size: 13px;
        border-radius: 8px;
    }

    .wcmw-back-btn {
        padding: 7px 12px;
        font-size: 12px;
        border-radius: 8px;
    }

    .wcmw-modal-title {
        font-size: 24px;
        margin: 60px 0 20px 0;
        padding: 0 15px;
    }

    .wcmw-breadcrumb {
        margin: 0 15px 12px 15px;
        padding: 12px 16px;
    }

    .wcmw-breadcrumb-item {
        padding: 6px 12px;
        font-size: 12px;
    }

    .wcmw-modal-body {
        padding: 12px 15px 25px 15px;
    }

    .wcmw-category-item {
        padding: 18px;
        border-radius: 18px;
        min-height: 65px;
    }

    .wcmw-category-name {
        font-size: 15px;
    }

    .wcmw-product-count {
        font-size: 11px;
        padding: 5px 10px;
    }

    .wcmw-arrow {
        width: 44px;
        height: 44px;
        font-size: 16px;
    }

    .wcmw-no-subcategories {
        padding: 40px 20px;
        font-size: 16px;
    }

    .wcmw-no-subcategories:before {
        font-size: 36px;
        margin-bottom: 12px;
    }
}

/* --- مخفی کردن اسکریپت JSON --- */
.wcmw-category-data {
    display: none !important;
}