/**
 * Symmetrical & Equal Subcategories Grid
 * Clean, uniform cards for category pages
 */

.widget-categories-or-subcategories {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)) !important;
    gap: 10px !important;
    margin-top: 15px !important;
    margin-bottom: 25px !important;
    width: 100% !important;
}

.widget-categories-or-subcategories a {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background-color: #f7f8fa !important;
    border: 1px solid #eef0f4 !important;
    border-radius: 12px !important;
    padding: 12px 16px !important;
    min-height: 48px !important;
    width: 100% !important;
    max-width: none !important;
    box-sizing: border-box !important;
    position: relative !important;
    text-decoration: none !important;
    flex-grow: 0 !important;
    flex-shrink: 0 !important;
    transition: all 0.15s ease !important;
}

.widget-categories-or-subcategories a:hover {
    background-color: #eff6ff !important;
    border-color: #93c5fd !important;
    color: #186aff !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 2px 8px rgba(24, 106, 255, 0.08) !important;
}

.widget-categories-or-subcategories a.active {
    background-color: #186aff !important;
    border-color: #186aff !important;
}

.widget-categories-or-subcategories a.active > div {
    color: #ffffff !important;
    font-weight: 600 !important;
}

.widget-categories-or-subcategories a div {
    color: #1f2937 !important;
    font-size: 13.5px !important;
    font-weight: 500 !important;
    text-align: center !important;
    width: 100% !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    z-index: 2 !important;
}

.widget-categories-or-subcategories a:hover div {
    color: #186aff !important;
}

.widget-categories-or-subcategories a img {
    display: none !important;
}

.widget-categories-or-subcategories-counter {
    position: absolute !important;
    top: -6px !important;
    right: -4px !important;
    background-color: #111827 !important;
    color: #ffffff !important;
    font-size: 10.5px !important;
    font-weight: 700 !important;
    border-radius: 10px !important;
    height: 18px !important;
    min-width: 18px !important;
    padding: 0 5px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2) !important;
    z-index: 3 !important;
}

.widget-categories-or-subcategories a.active .widget-categories-or-subcategories-counter {
    background-color: #ffffff !important;
    color: #186aff !important;
}

@media (max-width: 767px) {
    .widget-categories-or-subcategories {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)) !important;
        gap: 8px !important;
    }
    .widget-categories-or-subcategories a {
        padding: 10px 10px !important;
        min-height: 42px !important;
    }
    .widget-categories-or-subcategories a div {
        font-size: 12.5px !important;
    }
}


/* ==========================================================================
   Ad Create - Variant 2: Two Side-by-Side Scroll Panels
   ========================================================================== */

.ad-create-categories-container {
    margin-top: 15px;
    margin-bottom: 30px;
}

.ad-create-scroll-card {
    background-color: #ffffff;
    border: 1px solid #eef0f4;
    border-radius: 14px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.ad-create-scroll-header {
    background-color: #ffffff;
    padding: 14px 18px;
    border-bottom: 1px solid #f1f3f7;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ad-create-scroll-title {
    font-size: 15px;
    font-weight: 700;
    color: #111827;
    letter-spacing: -0.01em;
}

.ad-create-scroll-body {
    padding: 10px;
    max-height: 400px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.ad-create-scroll-body::-webkit-scrollbar {
    width: 4px;
}
.ad-create-scroll-body::-webkit-scrollbar-track {
    background: transparent;
}
.ad-create-scroll-body::-webkit-scrollbar-thumb {
    background: #e2e8f0;
    border-radius: 10px;
}
.ad-create-scroll-body::-webkit-scrollbar-thumb:hover {
    background: #cbd5e1;
}

/* Left List: Main Categories */
.ad-create-main-cats-list .ad-create-categories-item {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 9px 14px !important;
    border-radius: 8px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    color: #374151 !important;
    background: transparent !important;
    border: none !important;
    margin: 0 !important;
    cursor: pointer !important;
    transition: all 0.15s ease !important;
    box-sizing: border-box !important;
    width: 100% !important;
    position: relative !important;
}

.ad-create-main-cats-list .ad-create-categories-item::after {
    content: "›";
    font-size: 18px;
    font-weight: 600;
    color: #9ca3af;
    transition: transform 0.15s ease, color 0.15s ease;
    margin-left: auto;
}

.ad-create-main-cats-list .ad-create-categories-item:hover {
    background-color: #f7f8fa !important;
    color: #186aff !important;
    padding-left: 17px !important;
}

.ad-create-main-cats-list .ad-create-categories-item:hover::after {
    color: #186aff;
    transform: translateX(3px);
}

.ad-create-main-cats-list .ad-create-categories-item.active {
    background-color: #eff6ff !important;
    color: #186aff !important;
    font-weight: 700 !important;
    border-left: 3px solid #186aff !important;
    border-radius: 0 8px 8px 0 !important;
    padding-left: 13px !important;
}

.ad-create-main-cats-list .ad-create-categories-item.active::after {
    color: #186aff;
}

/* Right List: Subcategories */
.ad-create-subcats-list .ad-create-categories-item {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 10px 14px !important;
    border-radius: 8px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    color: #374151 !important;
    background-color: #f8fafc !important;
    border: 1px solid #f1f3f7 !important;
    margin: 0 !important;
    cursor: pointer !important;
    transition: all 0.15s ease !important;
    box-sizing: border-box !important;
    width: 100% !important;
    position: relative !important;
}

.ad-create-subcats-list .ad-create-categories-item:hover {
    background-color: #eff6ff !important;
    border-color: #93c5fd !important;
    color: #186aff !important;
    padding-left: 17px !important;
}

.ad-create-subcats-list .ad-create-categories-item.active {
    background-color: #186aff !important;
    border-color: #186aff !important;
    color: #ffffff !important;
    font-weight: 600 !important;
}

.ad-create-subcats-list .ad-create-categories-item.active::after {
    content: "✓";
    font-size: 13px;
    font-weight: 700;
    color: #ffffff;
    margin-left: auto;
}

/* Hide back button when at top level of subcategories (data-id=0) because left panel is always visible */
.ad-create-subcats-list .ad-create-categories-back[data-id="0"],
.ad-create-subcats-list .ad-create-categories-back-box:has([data-id="0"]) {
    display: none !important;
}

/* Back button when nested in deeper subcategories */
.ad-create-categories-back-box {
    margin-bottom: 4px;
}

.ad-create-categories-back {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    background-color: #f1f5f9 !important;
    border: 1px solid #e2e8f0 !important;
    color: #334151 !important;
    padding: 7px 15px !important;
    border-radius: 8px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.15s ease !important;
}

.ad-create-categories-back:hover {
    background-color: #e2e8f0 !important;
    color: #0f172a !important;
}

.ad-create-categories-back::before {
    content: "←";
    font-size: 14px;
    font-weight: 700;
}

/* Empty State Placeholder in Right Panel */
.ad-create-empty-hint {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: #94a3b8;
    height: 100%;
}

.ad-create-empty-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.ad-create-empty-text {
    font-size: 14px;
    font-weight: 500;
    color: #64748b;
    margin: 0;
}

@media (max-width: 767px) {
    .ad-create-scroll-body {
        max-height: 280px;
    }
}

/* ==========================================================================
   Homepage Categories - Modern Symmetrical Grid
   ========================================================================== */

.widget-categories-container {
    display: grid !important;
    grid-template-columns: repeat(8, 1fr) !important;
    gap: 10px !important;
    margin: 0 0 35px 0 !important;
    width: 100% !important;
}

.home-widget-categories-item {
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    background-color: #ffffff !important;
    border: 1px solid #eef0f4 !important;
    border-radius: 14px !important;
    padding: 11px 9px !important;
    height: 100px !important;
    min-height: 100px !important;
    max-height: 100px !important;
    min-width: 0 !important;
    max-width: none !important;
    width: 100% !important;
    position: relative !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
    text-decoration: none !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02) !important;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
    flex-grow: 0 !important;
    flex-shrink: 0 !important;
    grid-row: auto !important;
    grid-column: auto !important;
}

.home-widget-categories-item:hover {
    background-color: #ffffff !important;
    border-color: #93c5fd !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 20px rgba(24, 106, 255, 0.08) !important;
}

.home-widget-categories-item div {
    font-size: 14px !important;
    font-weight: 600 !important;
    color: #1f2937 !important;
    line-height: 1.3 !important;
    z-index: 3 !important;
    max-width: 65% !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    transition: color 0.15s ease !important;
}

.home-widget-categories-item:hover div {
    color: #186aff !important;
}

.home-widget-categories-item img {
    position: absolute !important;
    right: 6px !important;
    bottom: 5px !important;
    height: 70px !important;
    max-width: 70px !important;
    object-fit: contain !important;
    z-index: 2 !important;
    transition: transform 0.2s ease !important;
    pointer-events: none !important;
}

.home-widget-categories-item:hover img {
    transform: scale(1.08) !important;
}

/* Responsive adjustments */
@media (max-width: 991px) {
    .widget-categories-container {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)) !important;
        gap: 10px !important;
    }
    .home-widget-categories-item {
        height: 90px !important;
        min-height: 90px !important;
        padding: 11px 10px !important;
    }
    .home-widget-categories-item div {
        font-size: 12.5px !important;
    }
    .home-widget-categories-item img {
        height: 44px !important;
        max-width: 44px !important;
        right: 6px !important;
        bottom: 6px !important;
    }
}

@media (max-width: 767px) {
    .widget-categories-container {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 8px !important;
        margin-bottom: 25px !important;
    }
    .home-widget-categories-item {
        display: block !important;
        background-color: #f7f8fa !important;
        border: none !important;
        border-radius: 15px !important;
        padding: 12px 10px 8px 10px !important;
        overflow: hidden !important;
        height: 115px !important;
        min-height: 115px !important;
        max-height: 115px !important;
        position: relative !important;
        word-break: break-word !important;
        box-shadow: none !important;
        transform: none !important;
    }
    .home-widget-categories-item:hover {
        background-color: #f7f8fa !important;
        border-color: transparent !important;
        box-shadow: none !important;
        transform: none !important;
    }
    .home-widget-categories-item div {
        z-index: 5 !important;
        color: black !important;
        position: relative !important;
        font-size: 14px !important;
        font-weight: 400 !important;
        line-height: 1.15 !important;
        max-width: 100% !important;
        display: -webkit-box !important;
        -webkit-line-clamp: 2 !important;
        -webkit-box-orient: vertical !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }
    .home-widget-categories-item:hover div {
        color: black !important;
    }
    .home-widget-categories-item img {
        position: absolute !important;
        right: 0 !important;
        bottom: 0px !important;
        height: 70px !important;
        max-width: none !important;
        width: auto !important;
        object-fit: contain !important;
        z-index: 2 !important;
        transform: none !important;
    }
    .home-widget-categories-item:hover img {
        transform: none !important;
    }
}
