/* =========================================================
   Masar-style storefront theme
   Loaded after style.css; rules are prefixed with `body` so
   they also win over page-level <style> blocks (index.php).
   ========================================================= */

:root,
[data-theme="dark"] {
    --mq-bg: #002b38;
    --mq-surface: #17485e;
    --mq-surface-2: #0d3a4a;
    --mq-input: #123f50;
    --mq-active: rgba(255, 255, 255, 0.12);
    --mq-green: #00e676;
    --mq-green-hover: #00c865;
    --mq-text: #ffffff;
    --mq-muted: #9fb7c0;
    --mq-line: rgba(255, 255, 255, 0.08);

    --primary: var(--mq-green);
    --primary-hover: var(--mq-green-hover);
    --primary-glow: rgba(0, 230, 118, 0.35);
    --primary-color: var(--mq-green);
    --bg-main: var(--mq-bg);
    --bg-card: var(--mq-surface);
    --card-bg: var(--mq-surface);
    --bg-overlay: var(--mq-bg);
    --bg-secondary: var(--mq-surface-2);
    --text-main: var(--mq-text);
    --text-primary: var(--mq-text);
    --text-muted: var(--mq-muted);
    --text-secondary: var(--mq-muted);
    --border-color: var(--mq-line);
    --header-height: 64px;
}

[data-theme="light"] {
    --mq-bg: #f1f1f1;
    --mq-surface: #ffffff;
    --mq-surface-2: #e4e4e4;
    --mq-input: rgba(0, 0, 0, 0.06);
    --mq-active: rgba(0, 0, 0, 0.1);
    --mq-green: #00c865;
    --mq-green-hover: #00a854;
    --mq-text: rgba(0, 0, 0, 0.87);
    --mq-muted: #6b6b6b;
    --mq-line: rgba(0, 0, 0, 0.1);

    --primary: var(--mq-green);
    --primary-hover: var(--mq-green-hover);
    --primary-color: var(--mq-green);
    --bg-main: var(--mq-bg);
    --bg-card: var(--mq-surface);
    --card-bg: var(--mq-surface);
    --bg-overlay: #ffffff;
    --bg-secondary: var(--mq-surface-2);
    --text-main: var(--mq-text);
    --text-primary: var(--mq-text);
    --text-muted: var(--mq-muted);
    --text-secondary: var(--mq-muted);
    --border-color: var(--mq-line);
}

html,
body {
    background: var(--mq-bg) !important;
}

body {
    background-image: none !important;
    font-family: 'Tajawal', 'Inter', sans-serif;
}

/* ---------- App bar ---------- */
body header {
    height: 64px;
    background: var(--mq-bg);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-bottom: none;
    box-shadow: none;
}

[data-theme="light"] body header {
    background: #002b38;
    --text-main: #ffffff;
    color: #ffffff;
}

body header .nav-container {
    justify-content: flex-start;
    gap: 6px;
    width: 100%;
    max-width: 100%;
    padding: 0 16px;
}

body header .nav-menu,
body header .theme-dropdown,
body header .currency-dropdown,
body header .nav-auth {
    display: none !important;
}

body header .nav-actions {
    gap: 6px;
}

body header .nav-logo {
    margin-inline-start: auto;
    font-size: 1.05rem;
    font-weight: 800;
    gap: 8px;
    color: #fff;
}

body header .nav-logo .dynamic-logo {
    max-height: 34px;
    width: auto;
}

body .account-sidebar-toggle {
    border: none !important;
    padding: 8px !important;
    border-radius: 50%;
    color: #fff !important;
}

body .account-sidebar-toggle:hover {
    background: var(--mq-active) !important;
}

body .account-sidebar-toggle .toggle-bars {
    width: 20px;
    gap: 4px;
}

body .account-sidebar-toggle .toggle-bars span:nth-child(2) {
    width: 100%;
}

.mq-icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.05rem;
    transition: background 0.2s;
}

.mq-icon-btn:hover {
    background: var(--mq-active);
    color: #fff;
}

body header .balance-pill {
    background: var(--mq-surface);
    border: none;
    color: #fff;
    padding: 5px 12px;
    font-size: 0.8rem;
}

body header .balance-pill .fa-plus-circle {
    color: var(--mq-green) !important;
}

/* ---------- Sidebar (drawer) ---------- */
body .account-sidebar {
    width: 280px;
    background: var(--mq-bg);
    border: none !important;
    border-end-start-radius: 8px;
    box-shadow: 0 4px 20px -8px rgba(20, 20, 20, 0.6);
}

[data-theme="light"] body .account-sidebar {
    background: #f1f1f1;
}

body .account-sidebar-overlay {
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

body .accsb-header {
    display: block;
    padding: 8px;
    border-bottom: 1px solid var(--mq-line);
    position: relative;
}

body .accsb-close {
    position: absolute;
    top: 18px;
    inset-inline-end: 18px;
    z-index: 2;
    background: transparent;
    border: none;
    color: var(--mq-text);
    opacity: 0.7;
}

.mq-account-card {
    background: var(--mq-surface);
    border-radius: 24px;
    padding: 18px 16px 16px;
    margin-top: 12px;
    color: var(--mq-text);
}

[data-theme="light"] .mq-account-card {
    background: #002b38;
    color: #fff;
}

.mq-account-card h3 {
    font-size: 1.45rem;
    font-weight: 800;
    margin: 0 0 10px;
    padding-inline-end: 28px;
}

.mq-account-card p {
    font-size: 0.85rem;
    opacity: 0.85;
    margin: 0 0 14px;
    line-height: 1.6;
}

.mq-account-user {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    padding-inline-end: 28px;
}

.mq-account-user .accsb-avatar {
    width: 46px;
    height: 46px;
    flex-shrink: 0;
}

.mq-account-user .mq-name {
    font-weight: 800;
    font-size: 1.05rem;
    line-height: 1.3;
}

.mq-account-user .mq-balance {
    font-size: 0.85rem;
    opacity: 0.9;
}

.mq-account-user .mq-balance b {
    color: var(--mq-green);
}

.mq-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 30px;
    border-radius: 28px;
    font-size: 0.8rem;
    font-weight: 700;
    text-decoration: none;
    margin-top: 8px;
    transition: background 0.2s, transform 0.2s;
}

.mq-btn-green {
    background: var(--mq-green);
    color: #002b38;
}

.mq-btn-green:hover {
    background: var(--mq-green-hover);
    color: #002b38;
}

.mq-btn-white {
    background: #ffffff;
    color: #002b38;
}

.mq-btn-white:hover {
    background: #e9eef0;
    color: #002b38;
}

body .accsb-nav {
    padding: 24px 8px 8px;
    gap: 2px;
}

body .accsb-nav-item {
    min-height: 46px;
    border-radius: 7px;
    padding: 0 16px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--mq-text);
    gap: 14px;
}

body .accsb-nav-item i {
    color: var(--mq-green);
    width: 18px;
    text-align: center;
}

body .accsb-nav-item:hover {
    background: var(--mq-active);
    color: var(--mq-text);
}

body .accsb-nav-item.active {
    background: var(--mq-active);
    color: var(--mq-text);
}

body .accsb-nav-item.active::before {
    display: none;
}

body .accsb-nav-item.logout,
body .accsb-nav-item.logout i {
    color: #ff6b6b;
}

body .accsb-divider {
    background: var(--mq-line);
}

body .accsb-footer {
    border-top: 1px solid var(--mq-line);
    padding: 10px 8px 16px;
}

body .accsb-footer .mobile-only {
    display: flex !important;
}

body .accsb-footer-btn {
    background: transparent;
    border: none;
    color: var(--mq-text);
    font-size: 0.85rem;
    font-weight: 700;
    border-radius: 7px;
}

body .accsb-footer-btn:hover {
    background: var(--mq-active);
}

.mq-social {
    display: flex;
    justify-content: center;
    gap: 22px;
    padding: 14px 0 4px;
    font-size: 1.15rem;
}

.mq-social a {
    color: var(--mq-green);
    transition: transform 0.2s;
}

.mq-social a:hover {
    transform: translateY(-2px);
}

/* ---------- Home: banner / slogan / search ---------- */
/* One content width for the whole storefront (masar: 83.33% of the page, 8px gutters on phones) */
body .mq-home-wrap,
body .mq-page,
body .search-bar-module .container {
    width: calc(100% - 16px);
    max-width: 1480px;
    margin-inline: auto;
    padding-inline: 0;
}

@media (min-width: 600px) {
    body .mq-home-wrap,
    body .mq-page,
    body .search-bar-module .container {
        width: 83.333%;
    }
}

.mq-home-wrap {
    padding-top: 12px;
}

body .banner-slider {
    border-radius: 4px;
    margin-bottom: 12px;
    aspect-ratio: 3 / 1;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

body .banner-slider .swiper-wrapper,
body .banner-slider .swiper-slide {
    height: 100%;
}

body .banner-slider .swiper-slide img {
    width: 100%;
    height: 100% !important;
    max-height: none !important;
    object-fit: cover;
}

.mq-slogan {
    height: 32px;
    line-height: 32px;
    margin: 0 0 8px;
    padding: 0 12px;
    border-radius: 4px;
    background: var(--mq-surface);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--mq-text);
    overflow: hidden;
    white-space: nowrap;
}

.mq-slogan span {
    display: inline-block;
    padding-inline-start: 100%;
    animation: mq-marquee 18s linear infinite;
}

html[dir="rtl"] .mq-slogan span {
    animation-name: mq-marquee-rtl;
}

@keyframes mq-marquee {
    from { transform: translateX(0); }
    to { transform: translateX(-100%); }
}

@keyframes mq-marquee-rtl {
    from { transform: translateX(0); }
    to { transform: translateX(100%); }
}

body .search-bar-module {
    background: transparent !important;
    border: none !important;
    padding: 8px 0 !important;
    margin: 0 !important;
    position: relative;
}


body .search-input-container {
    background: var(--mq-input) !important;
    border: none !important;
    border-radius: 28px !important;
    box-shadow: none !important;
    min-height: 46px;
}

body .search-bar-module .search-input-container input {
    background: transparent !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    color: var(--mq-text) !important;
    font-size: 0.9rem;
}

body .search-input-container input::placeholder {
    color: var(--mq-muted);
}

body .search-input-container .search-icon {
    color: var(--mq-muted) !important;
}

/* ---------- Sections, sub-categories and product tiles (masar sizes) ---------- */
/* Home sections: 4 per row (2 on phones), landscape art.
   Sub-category and product pages: 6 per row on desktop, 4 on tablet, 3 on phones, square art. */
body #main-content {
    max-width: none;
    width: 100%;
    margin: 0;
}

body .home-section-header {
    margin: 22px 4px 4px;
}

body .home-section-header h2 {
    font-size: 1rem;
}

body .home-section-header h2 i {
    color: var(--mq-green);
    font-size: 1rem;
}

body .home-section-line {
    background: var(--mq-line);
    opacity: 1;
    height: 1px;
}

body .categories-grid,
body .products-grid,
body .products-list {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
    margin: 16px 0 48px !important;
    padding: 0 !important;
    max-width: none !important;
}

body .mq-cat-page .categories-grid,
body .mq-cat-page .products-grid,
body .mq-cat-page .products-list {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}

@media (min-width: 600px) {
    body .mq-home-page .categories-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    }

    body .mq-cat-page .categories-grid,
    body .mq-cat-page .products-grid,
    body .mq-cat-page .products-list {
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    }
}

@media (min-width: 960px) {
    body .mq-cat-page .categories-grid,
    body .mq-cat-page .products-grid,
    body .mq-cat-page .products-list {
        grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
    }
}

/* tile = image + name under it */
body .categories-grid .category-card,
body .products-grid .product-card {
    display: flex !important;
    flex-direction: column !important;
    background: transparent !important;
    border: none !important;
    border-radius: 8px !important;
    padding: 0 !important;
    min-height: 0 !important;
    height: auto !important;
    box-shadow: none !important;
    transform: none !important;
    overflow: visible !important;
    text-align: center;
}

body .categories-grid .category-card:hover,
body .products-grid .product-card:hover {
    transform: translateY(-3px) !important;
}

body .categories-grid .cat-img-wrapper,
body .products-grid .product-img-wrapper {
    position: relative;
    width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    border-radius: 8px !important;
    overflow: hidden;
    background: var(--mq-surface);
    aspect-ratio: 1 / 1 !important;
}

body .mq-home-page .categories-grid .cat-img-wrapper {
    aspect-ratio: 29 / 20 !important;
}

body .categories-grid .cat-img-wrapper img,
body .products-grid .product-img-wrapper img {
    width: 100%;
    height: 100% !important;
    object-fit: cover;
    border-radius: 8px !important;
    transform: none !important;
    filter: none !important;
}

body .categories-grid .cat-info,
body .products-grid .product-content {
    padding: 8px 2px 4px !important;
    width: 100%;
    text-align: center;
    flex-direction: column;
    align-items: center;
}

body .categories-grid .cat-info h3,
body .products-grid .product-title {
    font-size: 0.75rem !important;
    font-weight: 700 !important;
    color: var(--mq-text) !important;
    line-height: 1.35 !important;
    margin: 0 !important;
    white-space: normal !important;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

body .products-grid .product-meta {
    margin: 2px 0 0 !important;
    padding: 0 !important;
    justify-content: center;
    width: 100%;
}

body .products-grid .price,
body .products-grid .price-tag {
    font-size: 0.8rem !important;
    font-weight: 800;
    color: var(--mq-green) !important;
    direction: ltr;
}

body .products-grid .info-btn {
    top: 6px;
    inset-inline-end: 6px;
    right: auto;
    width: 26px;
    height: 26px;
    font-size: 0.7rem;
}

/* the whole tile is a link: no buy / login button inside it (masar shows name + price only) */
body .products-grid .product-card .btn,
body .products-grid .product-card button.btn {
    display: none !important;
}

/* Category page heading */
body .category-header {
    padding: 14px 0 0 !important;
    margin: 0 !important;
    max-width: none !important;
    text-align: start !important;
}

body .category-header h1 {
    font-size: 1.15rem !important;
    margin-bottom: 4px !important;
}

body .category-header a {
    color: var(--mq-muted) !important;
    font-size: 0.85rem;
    margin-bottom: 6px !important;
}

body .category-header p:empty {
    display: none;
}

/* Search: full content width and not sticky (like masar) */
body .search-bar-module {
    position: static !important;
    backdrop-filter: none !important;
}

body .search-bar-module .search-bar-wrapper {
    max-width: none !important;
    width: 100%;
}

/* ---------- Generic buttons / footer ---------- */
body .btn-primary {
    background: var(--mq-green);
    border-color: var(--mq-green);
    color: #002b38;
}

body .btn-primary:hover {
    background: var(--mq-green-hover);
    color: #002b38;
}

body .site-footer {
    background: var(--mq-bg);
    border-top: 1px solid var(--mq-line);
}

body #page-loader {
    background: var(--mq-bg) !important;
}

.mq-account-card .accsb-name,
.mq-account-card .mq-name {
    color: inherit !important;
}

/* Drawer behaviour (same as masar):
   - desktop (>= 700px): drawer sits beside the page and pushes the content, no dimming
   - smaller screens: drawer slides over the page with a dimmed overlay */
body .account-sidebar {
    top: 0;
    height: 100vh;
    height: 100dvh;
}

body.mq-no-anim,
body.mq-no-anim .account-sidebar {
    transition: none !important;
}

@media (min-width: 700px) {
    body {
        transition: padding 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    }

    body.mq-drawer-open {
        padding-inline-start: 280px;
    }

    body.mq-drawer-open .account-sidebar-overlay {
        display: none !important;
    }

    body .account-sidebar {
        z-index: 1001;
    }
}


/* =========================================================
   Logged-in app bar + drawer (masar layout)
   ========================================================= */
body header .currency-dropdown.mq-lang {
    display: block !important;
    order: -2;
}

body header .mq-guest-user {
    order: -1;
}

.mq-lang-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
}

.mq-lang-btn img {
    width: 22px;
    height: 15px;
    object-fit: cover;
    border-radius: 2px;
    display: block;
}

.mq-hbal {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #fff !important;
    font-size: 0.8rem;
    font-weight: 700;
    direction: ltr;
    padding: 0 6px;
    white-space: nowrap;
}

.mq-hbal i {
    font-size: 0.85rem;
    color: #fff;
}

.mq-hbadge {
    display: inline-flex;
    align-items: center;
    height: 18px;
    padding: 0 5px;
    border: 1.5px solid #f5b301;
    border-radius: 3px;
    color: #f5b301;
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    white-space: nowrap;
}

.mq-bell {
    position: relative;
    color: #9e9e9e !important;
}

.mq-dot {
    position: absolute;
    top: 4px;
    inset-inline-end: 4px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    background: #ef5350;
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
}

body header .mq-back {
    margin-inline-start: 4px;
}

/* Drawer: user head */
.mq-user-head {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 10px 8px 12px;
    color: var(--mq-text);
}

.mq-user-avatar {
    width: 65px;
    height: 65px;
    border-radius: 50%;
    overflow: hidden;
    background: #6d4c41;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.mq-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mq-user-name {
    font-size: 0.8rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: center;
}

.mq-user-name small {
    font-size: 0.65rem;
    font-weight: 700;
    opacity: 0.75;
}

.mq-user-name i {
    font-size: 0.7rem;
    opacity: 0.45;
}

.mq-user-chip {
    margin-top: 8px;
    height: 16px;
    padding: 0 8px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.15);
    font-size: 0.6rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

[data-theme="light"] .mq-user-chip {
    background: #e0e0e0;
}

.mq-user-balances {
    margin-top: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px 12px;
}

.mq-user-balances .mq-user-balance {
    margin-top: 0;
}

.mq-user-stars {
    font-size: 0.85rem;
    font-weight: 800;
    direction: ltr;
    color: #f5b301;
}

.mq-user-balance {
    margin-top: 6px;
    font-size: 0.9rem;
    font-weight: 800;
    direction: ltr;
}

.mq-user-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    padding: 8px 6px 6px;
    border-radius: 10px;
    color: inherit;
    text-decoration: none;
    transition: background 0.15s;
}

.mq-user-link:hover {
    background: var(--mq-active);
}

.accsb-nav-item.mq-logout,
.accsb-nav-item.mq-logout i {
    color: #e53935;
}

/* Drawer: nav list (icon at start, title centred, small coloured icons) */
body .accsb-nav-item {
    font-size: 0.8rem;
    font-weight: 600;
}

body .accsb-nav-item > span:first-of-type {
    flex: 1;
    text-align: center;
}

body .accsb-nav-item i {
    font-size: 0.9rem;
}

body .accsb-nav-item i.mq-ic-green { color: #69cb69; }
body .accsb-nav-item i.mq-ic-blue { color: #42a5f5; }
body .accsb-nav-item i.mq-ic-yellow { color: #ffc030; }
body .accsb-nav-item i.mq-ic-red { color: #ef5350; }

body .accsb-nav-item i.mq-ic-text {
    font-style: normal;
    font-size: 0.55rem;
    font-weight: 800;
}

body .accsb-nav-badge.mq-badge-soft {
    background: rgba(245, 179, 1, 0.15);
    color: #f5b301;
}

[data-theme="light"] body .accsb-nav-item {
    color: rgba(0, 0, 0, 0.87);
}

@media (min-width: 700px) {
    body .accsb-close {
        display: none;
    }
}


/* Brand logo: round emblem + wordmark beside it (wordmark hidden on very small screens) */
body header .nav-logo {
    gap: 8px;
}

body header .nav-logo .dynamic-logo {
    height: 40px;
    width: auto;
    max-height: 40px;
    max-width: 190px;
    object-fit: contain;
    border-radius: 0;
}

body header .nav-logo .mq-wordmark {
    height: 22px;
    width: auto;
    display: block;
}

@media (max-width: 520px) {
    body header .nav-logo .mq-wordmark {
        display: none;
    }
}


/* Footer (masar style): only legal links + copyright */
.mq-footer {
    background: transparent;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    margin-top: 40px;
    padding: 22px 16px;
}
.mq-footer-inner { max-width: 1100px; margin: 0 auto; text-align: center; }
.mq-footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 26px; }
.mq-footer-links a { color: var(--text-muted, #9ca3af); font-size: .92rem; text-decoration: none; }
.mq-footer-links a:hover { color: #fff; }
.mq-footer-copy { margin: 12px 0 0; color: var(--text-muted, #9ca3af); font-size: .8rem; opacity: .8; }


/* Reseller sections under the "Reseller panel" entry */
.accsb-nav-item.mq-sub {
    padding-inline-start: 30px;
    font-size: 0.9rem;
}

.accsb-section-title {
    padding: 10px 14px 4px;
    text-align: center;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    opacity: 0.55;
}
