/* Main Layout */
body {
    background-color: #ffffff;
}

/* Store Page */
.store-page {
    max-width: 1320px;
}

.store-toolbar {
    margin-top: 2px;
}

.store-title-box,
.store-tools-box,
.filters-panel {
    background: #ffffff;
    border: 1px solid #e2e7ef;
    border-radius: 14px;
    box-shadow: 0 8px 22px rgba(12, 24, 36, 0.06);
}

.store-title-box {
    height: 100%;
    padding: 16px 18px;
}

.store-title-box h1 {
    font-weight: 800;
    color: #1e2a36;
}

.store-subtitle {
    color: #637181;
    font-size: 0.95rem;
}

.store-tools-box {
    height: 100%;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.store-tools-box .search-form {
    flex: 1;
    margin: 0;
}

.store-tools-box .search-form .form-control {
    min-height: 46px;
    border-radius: 11px;
    border-color: #d7dfeb;
}

.store-tools-box .search-form .btn {
    min-height: 46px;
    min-width: 48px;
    border-radius: 11px;
}

.sort-form {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
}

.sort-combo {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
}

.sort-label {
    margin: 0;
    font-weight: 700;
    color: #4a5a6a;
    font-size: 0.9rem;
    white-space: nowrap;
}

.sort-form .form-select {
    min-width: 145px;
    min-height: 46px;
    border-radius: 11px;
    border-color: #d7dfeb;
    font-weight: 600;
}

@media (max-width: 991.98px) {
    .store-tools-box {
        flex-wrap: wrap;
        gap: 8px;
        padding: 9px;
    }

    .store-tools-box .search-form {
        width: 100%;
    }

    .store-tools-box .search-form .form-control,
    .store-tools-box .search-form .btn,
    .sort-form .form-select {
        min-height: 40px;
        font-size: 0.9rem;
    }

    .sort-form {
        width: 100%;
        justify-content: space-between;
        gap: 8px;
    }

    .sort-combo {
        flex: 1 1 48%;
        gap: 5px;
    }

    .sort-combo .form-select {
        width: 100%;
        min-width: 0;
    }

    .sort-label {
        display: none;
    }
}

/* Filters */
.filters-panel {
    padding: 14px;
}

.filters-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.filters-title {
    margin: 0;
    font-size: 1.02rem;
    font-weight: 800;
    color: #1f2c38;
}

.filters-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    border-radius: 999px;
    background: #eef3fb;
    color: #3d5268;
    font-size: 0.76rem;
    font-weight: 700;
}

.filters-help {
    margin: 0 0 10px;
    color: #7a8896;
    font-size: 0.84rem;
}

.categories-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.category-card {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    text-decoration: none;
    border: 1px solid #d7e1ef;
    border-radius: 13px;
    padding: 11px 12px;
    font-size: 0.9rem;
    font-weight: 700;
    color: #eaf3fb;
    background: linear-gradient(135deg, #0a5879, #0a4866);
    box-shadow: 0 10px 20px rgba(10, 72, 102, 0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.category-main {
    display: flex;
    align-items: center;
    gap: 9px;
}

.category-card i {
    width: 20px;
    text-align: center;
    color: #dbeaf6;
    flex-shrink: 0;
    font-size: 0.95rem;
}

.category-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #ffffff;
    font-size: 0.92rem;
}

.category-count {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    max-width: 100%;
    border-radius: 999px;
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.14);
    color: #f4f9ff;
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
}

.category-card:hover {
    border-color: #0a4967;
    transform: translateY(-1px);
    box-shadow: 0 14px 24px rgba(10, 72, 102, 0.24);
}

.category-card.active {
    background: linear-gradient(135deg, #d20a11, #ae080f);
    border-color: #aa090f;
    color: #ffffff;
    box-shadow: 0 12px 24px rgba(210, 10, 17, 0.28);
}

.category-card.active i {
    color: #ffffff;
}

.category-card.active .category-count {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

/* Products and pagination */
.store-page .col-lg-9 .product-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.store-page .col-lg-9 .product-grid .product-card {
    flex: 0 0 220px;
    max-width: 220px;
}

.store-page .pagination .page-link {
    border-radius: 10px;
    margin: 0 3px;
    border: 1px solid #d6deea;
    color: #314355;
    min-width: 42px;
    text-align: center;
    font-weight: 700;
}

.store-page .pagination .page-item.active .page-link {
    background-color: #d20a11;
    border-color: #d20a11;
    color: #fff;
}

/* Match homepage product-card look, especially price block */
.store-page .product-grid .product-card {
    direction: rtl;
    text-align: right;
}

.store-page .product-grid .product-card .product-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.store-page .product-grid .product-card .product-title {
    min-height: 38px;
    line-height: 1.25;
    margin-bottom: 0;
}

.store-page .product-grid .product-card .price-container {
    gap: 5px;
    margin: 1px 0;
    min-height: 0;
    overflow: visible;
    flex-wrap: wrap;
    align-items: baseline;
    direction: rtl;
}

.store-page .product-grid .product-card .current-price {
    display: inline-flex;
    align-items: baseline;
    gap: 2px;
    direction: rtl;
    unicode-bidi: plaintext;
    font-size: 1.35rem;
    line-height: 1.05;
}

.store-page .product-grid .product-card .old-price {
    display: inline-flex;
    align-items: baseline;
    gap: 2px;
    direction: rtl;
    unicode-bidi: plaintext;
    font-size: 0.95rem;
}

.store-page .product-grid .product-card .price-amount,
.store-page .product-grid .product-card .save-amount {
    direction: ltr;
    unicode-bidi: isolate;
}

.store-page .product-grid .product-card .tags-container {
    gap: 5px;
    margin: 2px 0 4px;
    min-height: 0;
    flex-wrap: wrap;
    overflow: visible;
}

.store-page .product-grid .product-card .savings-text {
    margin-top: 1px;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    line-height: 1.3;
    direction: rtl;
    unicode-bidi: plaintext;
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 3px;
    font-size: 11px;
    font-weight: 700;
}

.store-page .product-grid .product-card .save-inline {
    display: inline-flex;
    align-items: baseline;
    gap: 2px;
    direction: rtl;
    unicode-bidi: plaintext;
}

@media (max-width: 576px) {
    .store-page .product-grid .product-card .current-price {
        font-size: 1.15rem;
    }

    .store-page .product-grid .product-card .old-price {
        font-size: 0.82rem;
    }

    .store-page .product-grid .product-card .savings-text {
        font-size: 10.5px;
    }
}

/* Mobile-first category usability */
@media (max-width: 991.98px) {
    .store-toolbar {
        margin-bottom: 0.45rem !important;
    }

    .store-tools-box {
        align-items: stretch;
    }

    .sort-form {
        min-width: 0;
        width: 100%;
    }

    .filters-panel {
        padding: 12px;
    }

    .filters-help {
        margin-bottom: 8px;
    }

    .categories-grid {
        display: flex;
        gap: 8px;
        overflow-x: auto;
        overflow-y: hidden;
        padding-bottom: 6px;
        scrollbar-width: thin;
        -webkit-overflow-scrolling: touch;
    }

    .categories-grid::-webkit-scrollbar {
        height: 6px;
    }

    .categories-grid::-webkit-scrollbar-thumb {
        background: #c6d1df;
        border-radius: 999px;
    }

    .category-card {
        min-width: 170px;
        max-width: 220px;
        padding: 10px 11px;
        border-radius: 12px;
        white-space: normal;
    }

    .category-name {
        font-size: 0.86rem;
    }

    .store-page .col-lg-9 .product-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .store-page .col-lg-9 .product-grid .product-card {
        flex: initial;
        max-width: none;
    }
}

@media (max-width: 576px) {
    .store-title-box {
        padding: 13px 14px;
    }

    .store-subtitle {
        font-size: 0.86rem;
    }

    .store-tools-box {
        padding: 8px;
    }

    .store-tools-box .search-form .form-control,
    .store-tools-box .search-form .btn,
    .sort-form .form-select {
        min-height: 38px;
        font-size: 0.86rem;
    }

    .store-tools-box .search-form .btn {
        min-width: 42px;
    }

    .filters-title {
        font-size: 0.98rem;
    }

    .category-card {
        min-width: 158px;
        padding: 9px 10px;
    }

    .category-name {
        font-size: 0.82rem;
    }

    .category-count {
        font-size: 0.7rem;
        padding: 3px 9px;
    }
}

/* =========================================
   Categories Image Grid (Final)
   ========================================= */

.store-page .categories-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    overflow: visible;
    padding-bottom: 0;
}

.store-page .category-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 7px;
    min-width: 0;
    max-width: none;
    padding: 7px;
    border-radius: 12px;
    border: 1px solid #d6e0ec;
    background: #ffffff;
    box-shadow: 0 6px 16px rgba(14, 35, 56, 0.08);
    color: #2e3d4d;
    overflow: visible;
    text-decoration: none;
    transform: none;
}

.store-page .category-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 28px rgba(14, 35, 56, 0.14);
    border-color: #c3d0e0;
}

.store-page .category-visual {
    position: relative;
    width: 58px;
    min-width: 58px;
    height: 46px;
    border-radius: 9px;
    background: #eaf0f7;
    overflow: hidden;
}

.store-page .category-visual img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.store-page .category-visual-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0.38));
}

.store-page .category-visual-placeholder {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6d8094;
    font-size: 1.4rem;
    background: linear-gradient(135deg, #edf2f8, #e3ebf4);
}

.store-page .category-body {
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 5px;
    min-width: 0;
}

.store-page .category-name {
    color: #243445;
    font-size: 0.8rem;
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
}

.store-page .category-count {
    padding: 3px 8px;
    border-radius: 999px;
    background: #eef3f9;
    color: #47617a;
    font-size: 0.68rem;
    font-weight: 700;
    white-space: nowrap;
}

.store-page .filters-panel {
    position: sticky;
    top: 16px;
}

.store-page .category-card.active {
    border-color: #d20a11;
    background: #ffffff;
    box-shadow: 0 12px 24px rgba(210, 10, 17, 0.16);
}

.store-page .category-card.active .category-name {
    color: #c00f16;
}

.store-page .category-card.active .category-count {
    background: #ffe9ea;
    color: #b40f15;
}

@media (max-width: 991.98px) {
    .store-page .filters-panel {
        position: static;
    }

    .store-page .categories-grid {
        display: flex;
        flex-wrap: nowrap;
        gap: 10px;
        overflow-x: auto;
        overflow-y: hidden;
        padding-bottom: 6px;
        scrollbar-width: thin;
        -webkit-overflow-scrolling: touch;
    }

    .store-page .categories-grid::-webkit-scrollbar {
        height: 6px;
    }

    .store-page .categories-grid::-webkit-scrollbar-thumb {
        background: #c6d1df;
        border-radius: 999px;
    }

    .store-page .category-card {
        min-width: max-content;
        max-width: none;
        padding: 8px 12px;
        border-radius: 999px;
        gap: 6px;
        box-shadow: none;
        border-color: #d8e0ea;
    }

    .store-page .category-visual {
        display: none;
    }

    .store-page .category-body {
        flex-direction: row;
        align-items: center;
        gap: 6px;
    }

    .store-page .category-name {
        font-size: 0.83rem;
        width: auto;
        max-width: none;
    }

    .store-page .category-count {
        font-size: 0.66rem;
        padding: 2px 8px;
        background: #eef2f7;
    }

    .store-page .category-card.active {
        background: #d20a11;
        border-color: #d20a11;
        box-shadow: none;
    }

    .store-page .category-card.active .category-name,
    .store-page .category-card.active .category-count {
        color: #ffffff;
    }

    .store-page .category-card.active .category-count {
        background: rgba(255, 255, 255, 0.22);
    }
}

@media (max-width: 575.98px) {
    .store-page .category-card {
        padding: 7px 10px;
    }

    .store-page .category-name {
        font-size: 0.79rem;
    }
}

.store-page .category-card .category-count {
    display: none;
}