/* =========================================================
   Top Categories
   Automatically ranked by active offer count.
   ========================================================= */

.top-categories-directory {
    margin: 28px 0 34px;
}

.top-categories-directory-heading {
    margin-bottom: 14px;
}

.top-categories-directory-heading h2 {
    margin: 0 0 5px;
    color: #0f172a;
    font-size: 22px;
    line-height: 1.3;
}

.top-categories-directory-heading p {
    margin: 0;
    color: #64748b;
    font-size: 13px;
    line-height: 1.5;
}

.top-categories-directory-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.top-category-directory-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-height: 66px;
    padding: 13px 15px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #fff;
    color: #1e293b;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(15, 23, 42, .03);
    transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.top-category-directory-card:hover {
    transform: translateY(-2px);
    border-color: #ffd2b3;
    box-shadow: 0 8px 20px rgba(15, 23, 42, .07);
}

.top-category-directory-name {
    min-width: 0;
    overflow: hidden;
    font-size: 14px;
    font-weight: 750;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.top-category-directory-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    min-width: 28px;
    height: 26px;
    padding: 0 8px;
    border-radius: 999px;
    background: #fff1e8;
    color: #f97316;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
}

.top-category-directory-card:hover .top-category-directory-count {
    background: #f97316;
    color: #fff;
}

@media (max-width: 900px) {
    .top-categories-directory-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    .top-categories-directory {
        margin-top: 22px;
        margin-bottom: 28px;
    }

    .top-categories-directory-grid {
        grid-template-columns: 1fr;
    }
}

/* =========================================================
   Browse All Categories Heading
   ========================================================= */

.browse-all-categories-heading {
    margin: 8px 0 18px;
}

.browse-all-categories-heading h2 {
    margin: 0 0 5px;
    color: #0f172a;
    font-size: 22px;
    line-height: 1.3;
}

.browse-all-categories-heading p {
    margin: 0;
    color: #64748b;
    font-size: 13px;
    line-height: 1.5;
}

@media (max-width: 600px) {
    .browse-all-categories-heading {
        margin-top: 4px;
        margin-bottom: 16px;
    }
}

/* =========================================================
   Category Subcategory Pills + Active Offer Counts
   Pills size naturally to their content and wrap horizontally.
   ========================================================= */

.category-subcategory-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.category-subcategory-item {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    width: auto !important;
    max-width: 100%;
    flex: 0 0 auto;
}

.category-subcategory-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.category-subcategory-count {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border: 0;
    border-radius: 999px;
    background: #fff1e8 !important;
    color: #f97316 !important;
    font-family: inherit;
    font-size: 11px !important;
    font-weight: 800 !important;
    line-height: 1 !important;
    text-align: center;
    visibility: visible !important;
    opacity: 1 !important;
    box-sizing: border-box;
}

.category-subcategory-item:hover .category-subcategory-count {
    background: #f97316;
    color: #fff;
}

/* =========================================================
   CATEGORIES DIRECTORY PAGE
   ========================================================= */

.categories-directory-page {
    margin-bottom: 50px;
}


/* =========================================================
   PAGE HEADER
   ========================================================= */

.categories-directory-header {
    margin-bottom: 28px;
}

.categories-directory-header h1 {
    margin: 0 0 8px;

    color: #111827;

    font-size: 32px;
    line-height: 1.2;
    font-weight: 800;
}

.categories-directory-header p {
    margin: 0;

    color: #6b7280;

    font-size: 15px;
    line-height: 1.6;
}


/* =========================================================
   CATEGORY GRID
   ========================================================= */

.categories-directory-grid {
    display: grid;

    grid-template-columns: repeat(3, minmax(0, 1fr));

    gap: 18px;
}


/* =========================================================
   MAIN CATEGORY CARD
   ========================================================= */

.category-directory-card {
    min-width: 0;

    padding: 18px;

    background: #ffffff;

    border: 1px solid #e5e7eb;

    border-radius: 12px;

    box-shadow:
        0 2px 8px rgba(15, 23, 42, 0.03);

    transition:
        transform 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.category-directory-card:hover {
    transform: translateY(-2px);

    border-color: #fed7aa;

    box-shadow:
        0 8px 22px rgba(15, 23, 42, 0.07);
}


/* =========================================================
   MAIN CATEGORY LINK
   ========================================================= */

.category-directory-main-link {
    display: flex;

    align-items: center;

    gap: 13px;

    min-width: 0;

    padding: 0;

    color: inherit;

    text-decoration: none;
}

.category-directory-main-link:hover {
    color: inherit;

    text-decoration: none;
}


/* =========================================================
   CATEGORY ICON / LOGO TILE
   ========================================================= */

.category-directory-icon {
    width: 48px;
    height: 48px;

    flex: 0 0 48px;

    display: flex;

    align-items: center;
    justify-content: center;

    background: #fff7ed;

    border: 1px solid #fed7aa;

    border-radius: 10px;

    color: #f97316;

    transition:
        background 0.2s ease,
        border-color 0.2s ease,
        transform 0.2s ease;
}

.category-directory-icon svg {
    width: 25px;
    height: 25px;

    fill: none;

    stroke: currentColor;

    stroke-width: 1.8;

    stroke-linecap: round;
    stroke-linejoin: round;
}

.category-directory-main-link:hover .category-directory-icon {
    background: #ffedd5;

    border-color: #fdba74;

    transform: translateY(-1px);
}

.category-directory-main-link:hover .category-directory-icon {
    background: #ffedd5;

    border-color: #fdba74;

    transform: translateY(-1px);
}


/* =========================================================
   CATEGORY TITLE
   ========================================================= */

.category-directory-title {
    flex: 1;

    min-width: 0;
}

.category-directory-title h2 {
    margin: 0;

    color: #111827;

    font-size: 18px;

    line-height: 1.35;

    font-weight: 750;

    overflow: hidden;

    text-overflow: ellipsis;

    white-space: nowrap;

    transition: color 0.2s ease;
}

.category-directory-main-link:hover .category-directory-title h2 {
    color: #f97316;
}


/* =========================================================
   CATEGORY ARROW
   ========================================================= */

.category-directory-main-link .category-arrow {
    flex: 0 0 auto;

    margin-left: auto;

    color: #6b7280;

    font-size: 22px;

    line-height: 1;

    transition:
        color 0.2s ease,
        transform 0.2s ease;
}

.category-directory-main-link:hover .category-arrow {
    color: #f97316;

    transform: translateX(3px);
}

/* =========================================================
   SUBCATEGORY SECTION
   ========================================================= */

.category-subcategory-section {
    margin-top: 15px;

    padding-top: 14px;

    border-top: 1px solid #e5e7eb;
}

.category-subcategory-heading {
    margin-bottom: 10px;

    color: #6b7280;

    font-size: 10px;

    line-height: 1.3;

    font-weight: 800;

    letter-spacing: 0.08em;

    text-transform: uppercase;
}


/* =========================================================
   SUBCATEGORY LIST
   ========================================================= */

.category-subcategory-list {
    display: flex;

    flex-wrap: wrap;

    align-items: center;

    gap: 7px;
}


/* =========================================================
   SUBCATEGORY PILL
   ========================================================= */

.category-subcategory-item {
    display: inline-flex;

    align-items: center;

    gap: 0;

    max-width: 100%;

    padding: 7px 11px;

    background: #f8fafc;

    border: 1px solid #e5e7eb;

    border-radius: 999px;

    color: #4b5563;

    font-size: 12px;

    line-height: 1.3;

    font-weight: 500;

    text-decoration: none;

    transition:
        background 0.2s ease,
        border-color 0.2s ease,
        color 0.2s ease,
        transform 0.2s ease;
}

.category-subcategory-item:hover {
    background: #fff7ed;

    border-color: #fdba74;

    color: #f97316;

    text-decoration: none;

    transform: translateY(-1px);
}


.category-subcategory-name {
    min-width: 0;

    overflow: hidden;

    text-overflow: ellipsis;

    white-space: nowrap;
}


/* =========================================================
   EMPTY STATE
   ========================================================= */

.categories-empty-state {
    padding: 50px 25px;

    background: #ffffff;

    border: 1px solid #e5e7eb;

    border-radius: 12px;

    text-align: center;

    box-shadow:
        0 2px 8px rgba(15, 23, 42, 0.03);
}

.categories-empty-state h2 {
    margin: 0 0 8px;

    color: #111827;

    font-size: 22px;

    line-height: 1.3;
}

.categories-empty-state p {
    margin: 0 0 20px;

    color: #6b7280;

    font-size: 14px;

    line-height: 1.6;
}

.categories-empty-button {
    display: inline-flex;

    align-items: center;
    justify-content: center;

    padding: 10px 16px;

    background: #f97316;

    border: 1px solid #f97316;

    border-radius: 7px;

    color: #ffffff;

    font-size: 13px;

    font-weight: 700;

    text-decoration: none;
}

.categories-empty-button:hover {
    background: #ea580c;

    border-color: #ea580c;

    color: #ffffff;

    text-decoration: none;
}


/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 1000px) {

    .categories-directory-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

}


@media (max-width: 700px) {

    .categories-directory-grid {
        grid-template-columns: 1fr;
    }

}


@media (max-width: 600px) {

    .categories-directory-page {
        margin-bottom: 35px;
    }

    .categories-directory-header {
        margin-bottom: 24px;
    }

    .categories-directory-header h1 {
        font-size: 28px;
    }

    .category-directory-card {
        padding: 16px;
    }

}

@media (max-width: 450px) {

    .categories-directory-header h1 {
        font-size: 25px;
    }

    .category-directory-icon {
        width: 44px;
        height: 44px;

        flex-basis: 44px;
    }

    .category-directory-icon svg {
        width: 23px;
        height: 23px;
    }

    .category-directory-title h2 {
        font-size: 17px;
    }

    .category-subcategory-item {
        padding: 7px 10px;

        font-size: 12px;
    }

}

@media (max-width: 450px) {

    .categories-directory-header h1 {
        font-size: 25px;
    }

    .category-directory-icon {
        width: 44px;
        height: 44px;

        flex-basis: 44px;

        font-size: 16px;
    }

    .category-directory-title h2 {
        font-size: 17px;
    }

    .category-subcategory-item {
        padding: 7px 10px;

        font-size: 12px;
    }

}


@media (max-width: 600px) {
    .category-subcategory-list {
        gap: 7px;
    }

    .category-subcategory-item {
        gap: 7px;
    }

    .category-subcategory-count {
        min-width: 21px;
        height: 21px;
        padding: 0 6px;
        font-size: 11px;
    }
}

/* =========================================================
   ACCESSIBILITY
   ========================================================= */

.top-category-directory-card:focus-visible,
.category-directory-main-link:focus-visible,
.category-subcategory-item:focus-visible,
.categories-empty-button:focus-visible {
    outline: 2px solid #f97316;
    outline-offset: 2px;
}
