/* WiseCloud — tema "fresh" (mobile-first), personalizabila prin variabile.
   Culorile de brand se pot suprascrie din .env (THEME_*), vezi base.html. */

:root {
    --gm-primary: #5dbff9;        /* accentul WiseCloud */
    --gm-primary-text: #17141a;   /* textul de pe butoanele primare */
    --gm-bg: #ececec;             /* fundalul paginii */
    --gm-item-bg: #ffffff;        /* carduri, antet, panouri */
    --gm-text: #212121;
    --gm-muted: #6f6f6f;
    --gm-border: #e2e2e2;
    --gm-header-bg: var(--gm-item-bg);
    --gm-shadow: 0 4px 12px rgba(20, 40, 89, 0.08);
    --gm-shadow-lg: 0 10px 30px rgba(20, 40, 89, 0.16);
    --gm-radius: 16px;
    --gm-font: "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --gm-header-h: 64px;
    --gm-nav-h: 68px;

    /* aliasuri pentru clasele mai vechi */
    --gm-accent: var(--gm-primary);
    --gm-dark: var(--gm-bg);
    --gm-panel: var(--gm-item-bg);
}

[data-theme="dark"] {
    --gm-bg: #17141a;
    --gm-item-bg: #221e26;
    --gm-text: #f1ece4;
    --gm-muted: #9b93a5;
    --gm-border: #332c3a;
    --gm-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
    --gm-shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5);
}

html { scroll-behavior: smooth; }

body {
    background: var(--gm-bg);
    color: var(--gm-text);
    font-family: var(--gm-font);
}

a { color: inherit; }
.gm-accent { color: var(--gm-primary); }
.gm-link { color: var(--gm-primary); font-weight: 600; text-decoration: none; }
.gm-link:hover { text-decoration: underline; color: var(--gm-primary); }

/* ---------- antet ---------- */
.gm-header {
    background: var(--gm-header-bg);
    box-shadow: var(--gm-shadow);
    z-index: 1030;
}
.gm-header__inner {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "logo lang cart";
    align-items: center;
    column-gap: 0.75rem;
    row-gap: 0.35rem;
    padding: 0.5rem 1rem;
    max-width: 1320px;
    margin: 0 auto;
}
.gm-header__inner.has-info {
    grid-template-areas:
        "logo lang cart"
        "info info info";
}
.gm-header__logo { grid-area: logo; }
.gm-header__lang { grid-area: lang; justify-self: start; }
.gm-header__cart { grid-area: cart; justify-self: end; }
.gm-header__info { grid-area: info; justify-self: start; max-width: 100%; }
.gm-logo {
    display: flex;
    align-items: center;
    min-height: 40px;
    text-decoration: none;
    min-width: 0;
}
.gm-logo img {
    /* inaltime fixa + latime din proportia imaginii: la fel in toate browserele,
       fara flash la marimea reala a fisierului inainte de CSS */
    display: block;
    height: 36px;
    width: auto;
    max-width: 150px;
    object-fit: contain;
}
.gm-logo__text { font-weight: 800; font-size: 1.25rem; letter-spacing: -0.01em; }

.gm-info {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 0;
    padding: 0.35rem 0.75rem;
    border: 0;
    border-radius: 999px;
    background: color-mix(in srgb, var(--gm-text) 6%, transparent);
    color: var(--gm-text);
    font-size: 0.85rem;
    font-weight: 600;
    text-align: left;
}
.gm-info:hover { background: color-mix(in srgb, var(--gm-text) 10%, transparent); }
.gm-info__text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: calc(100vw - 4rem);
}
.gm-lang-switch { display: flex; gap: 0.25rem; }
.gm-lang {
    border: 1px solid var(--gm-border);
    background: transparent;
    color: var(--gm-muted);
    border-radius: 999px;
    padding: 0.15rem 0.6rem;
    font-size: 0.8rem;
    font-weight: 700;
}
.gm-lang.is-active {
    background: var(--gm-primary);
    border-color: var(--gm-primary);
    color: var(--gm-primary-text);
}
.gm-cart-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid var(--gm-border);
    text-decoration: none;
    font-size: 1.15rem;
}
.gm-cart-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--gm-primary);
    color: var(--gm-primary-text);
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
}

.gm-table-banner {
    background: var(--gm-item-bg);
    border-bottom: 1px solid var(--gm-border);
    font-size: 0.95rem;
}
.gm-table-clear {
    color: var(--gm-primary);
    font-size: 0.85rem;
    text-decoration: underline;
    margin-left: 0.5rem;
}

/* ---------- pagina de meniu ---------- */
.gm-page {
    max-width: 1320px;
    margin: 0 auto;
    padding: 0 1rem;
}
.gm-nav {
    position: sticky;
    top: var(--gm-header-h);   /* actualizat din JS dupa inaltimea reala a antetului */
    z-index: 1020;
    margin: 0 -1rem;
    background: var(--gm-bg);
}
.gm-nav__scroller {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    height: var(--gm-nav-h);
    padding: 0 1rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.gm-nav__scroller::-webkit-scrollbar { display: none; }
.gm-nav__btn {
    flex: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    height: 44px;
    max-width: 260px;
    padding: 6px 14px 6px 6px;
    border-radius: 24px;
    background: var(--gm-item-bg);
    box-shadow: var(--gm-shadow);
    color: var(--gm-text);
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}
.gm-nav__btn.is-active {
    background: var(--gm-primary);
    color: var(--gm-primary-text);
}
.gm-nav__img {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    background: color-mix(in srgb, var(--gm-text) 6%, transparent);
    font-size: 1rem;
}
.gm-nav__img img { width: 100%; height: 100%; object-fit: cover; }
.gm-nav__title { overflow: hidden; text-overflow: ellipsis; }

.gm-content { padding-top: 0.5rem; }

.gm-search {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    height: 46px;
    padding: 0 0.9rem;
    margin-bottom: 1.25rem;
    border-radius: 14px;
    background: var(--gm-item-bg);
    box-shadow: var(--gm-shadow);
    color: var(--gm-muted);
}
.gm-search__field {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--gm-text);
    font-family: inherit;
    font-size: 0.95rem;
}
.gm-search__field::placeholder { color: var(--gm-muted); }

.gm-section { scroll-margin-top: calc(var(--gm-header-h) + var(--gm-nav-h) + 8px); margin-bottom: 2rem; }
.gm-section__title {
    font-size: 1.35rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.01em;
    margin: 0 0 0.9rem;
}
.gm-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}
.gm-empty { text-align: center; color: var(--gm-muted); padding: 3rem 0; }

/* ---------- card de produs ---------- */
.gm-card {
    display: flex;
    flex-direction: column;
    background: var(--gm-item-bg);
    border-radius: var(--gm-radius);
    box-shadow: var(--gm-shadow);
    overflow: hidden;
    transition: transform 0.15s, box-shadow 0.15s;
}
@media (hover: hover) {
    .gm-card:hover { transform: translateY(-2px); box-shadow: var(--gm-shadow-lg); }
}
.gm-card__photo {
    position: relative;
    display: block;
    aspect-ratio: 4 / 3;
    background: color-mix(in srgb, var(--gm-text) 5%, transparent);
    overflow: hidden;
}
.gm-card__photolink { display: block; width: 100%; height: 100%; }
.gm-card__photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gm-card__badges {
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
    pointer-events: none;
}
.gm-card__badges > * { pointer-events: auto; }
.gm-card__placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 2.2rem;
    opacity: 0.5;
}
.gm-card__body {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 0.2rem;
    padding: 0.65rem 0.75rem 0.75rem;
}
.gm-card__title {
    overflow-wrap: anywhere;
    font-weight: 600;
    font-size: 0.92rem;
    line-height: 1.3;
    text-decoration: none;
    color: var(--gm-text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.gm-card__badge {
    padding: 0.3rem 0.8rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.9);
    color: #212121;
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1.2;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}
.gm-card__incart {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 27px;
    padding: 0 0.6rem 0 0.25rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1;
}
.gm-card__minus {
    width: 22px;
    height: 22px;
    border: 0;
    border-radius: 50%;
    background: var(--gm-primary);
    color: var(--gm-primary-text);
    font-size: 1rem;
    font-weight: 700;
    line-height: 1;
    padding: 0;
}
.gm-card__qty { color: var(--gm-primary); min-width: 0.9em; text-align: center; }
.gm-card.in-cart { box-shadow: 0 0 0 2px var(--gm-primary), var(--gm-shadow); }

/* ---------- cardul extins (detalii pe loc, fara alta pagina) ---------- */
.gm-card__close { display: none; }
.gm-card__details, .gm-card__buy { display: none; }
.gm-card.is-expanded {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    scroll-margin-top: 140px;
}
.gm-card.is-expanded .gm-card__photo { aspect-ratio: 4 / 3; }
.gm-card.is-expanded .gm-card__close {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 10px;
    right: 10px;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    color: #212121;
    font-size: 1.3rem;
    line-height: 1;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.gm-card.is-expanded .gm-card__body { padding: 1rem; gap: 0.5rem; }
.gm-card.is-expanded .gm-card__title {
    font-size: 1.35rem;
    font-weight: 800;
    -webkit-line-clamp: unset;
    display: block;
}
.gm-card.is-expanded .gm-card__desc,
.gm-card.is-expanded .gm-card__bottom { display: none; }
.gm-card.is-expanded .gm-card__details { display: block; }
.gm-card__fulldesc { margin: 0.25rem 0 0.5rem; white-space: pre-line; }
.gm-card.is-expanded .gm-card__buy {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: auto;
    padding-top: 0.75rem;
}
.gm-stepper {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 4px;
    border-radius: 14px;
    background: color-mix(in srgb, var(--gm-primary) 14%, transparent);
}
.gm-stepper__btn {
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 10px;
    background: var(--gm-primary);
    color: var(--gm-primary-text);
    font-size: 1.3rem;
    font-weight: 700;
    line-height: 1;
}
.gm-stepper__qty {
    min-width: 2.2rem;
    text-align: center;
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--gm-primary);
}
@media (min-width: 768px) {
    .gm-card.is-expanded { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
    .gm-card.is-expanded .gm-card__photo { aspect-ratio: auto; min-height: 100%; }
    .gm-card.is-expanded .gm-card__photo img { position: absolute; inset: 0; }
    .gm-card.is-expanded .gm-card__body { padding: 1.5rem; }
    .gm-card.is-expanded .gm-card__title { font-size: 1.7rem; }
}
.gm-card.in-cart .gm-card__title { color: var(--gm-primary); }
.gm-card__desc {
    font-size: 0.78rem;
    line-height: 1.35;
    color: var(--gm-muted);
    overflow-wrap: anywhere;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.gm-card__bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: auto;
    padding-top: 0.5rem;
}
.gm-card.is-stopped .gm-card__photo { filter: grayscale(0.8); opacity: 0.55; }
.gm-card.is-stopped .gm-card__title { color: var(--gm-muted); }

.gm-price { font-weight: 700; white-space: nowrap; }
.gm-price--lg { font-size: 1.5rem; }
.gm-add-btn {
    flex: none;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 10px;
    background: var(--gm-primary);
    color: var(--gm-primary-text);
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1;
    transition: filter 0.15s;
}
.gm-add-btn:hover { filter: brightness(1.08); }
.gm-add-btn:disabled { opacity: 0.7; }
.gm-badge {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--gm-text) 8%, transparent);
    color: var(--gm-muted);
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
}

/* ---------- cosul plutitor ---------- */
.gm-basket-fab {
    position: fixed;
    right: 16px;
    bottom: 20px;
    z-index: 1040;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    height: 48px;
    padding: 0 1.1rem;
    border-radius: 14px;
    background: var(--gm-primary);
    color: var(--gm-primary-text);
    box-shadow: var(--gm-shadow-lg);
    font-weight: 700;
    text-decoration: none;
}
.gm-basket-fab:hover { color: var(--gm-primary-text); filter: brightness(1.05); }
.gm-basket-fab__sep { opacity: 0.6; }

/* ---------- pagina produsului ---------- */
.gm-detail { padding-top: 1rem; }
.gm-detail__wrap {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
    margin: 1rem 0 2rem;
    padding: 1rem;
    background: var(--gm-item-bg);
    border-radius: var(--gm-radius);
    box-shadow: var(--gm-shadow);
}
.gm-detail__photo {
    aspect-ratio: 4 / 3;
    border-radius: 12px;
    overflow: hidden;
    background: color-mix(in srgb, var(--gm-text) 5%, transparent);
}
.gm-detail__photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gm-detail__title { font-size: 1.5rem; font-weight: 800; margin-bottom: 0.5rem; }
.gm-detail__meta { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.75rem; }
.gm-chip {
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--gm-text) 7%, transparent);
    font-size: 0.8rem;
    font-weight: 600;
}
.gm-tag {
    display: inline-block;
    margin-bottom: 0.6rem;
    padding: 0.35rem 0.7rem;
    border-radius: 10px;
    background: rgba(255, 170, 0, 0.14);
    font-size: 0.82rem;
    font-weight: 600;
}
.gm-detail__text { white-space: pre-line; }
.gm-detail__allergens { font-size: 0.88rem; color: var(--gm-muted); }
.gm-detail__buy {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1rem;
}
.gm-detail__form { display: flex; gap: 0.5rem; margin: 0; }
.gm-detail__add { white-space: nowrap; }
.gm-qty { width: 4.5rem; text-align: center; }
.gm-section--related { margin-top: 1rem; }

/* ---------- cosul ---------- */
.gm-cart-row {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr) auto;
    grid-template-areas:
        "img info remove"
        "img qty total";
    column-gap: 0.75rem;
    row-gap: 0.5rem;
    align-items: center;
    padding: 0.75rem 0;
}
.gm-cart-row--divided { border-bottom: 1px solid var(--gm-border); }
.gm-cart-row__img {
    grid-area: img;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 12px;
    overflow: hidden;
    background: color-mix(in srgb, var(--gm-text) 5%, transparent);
    text-decoration: none;
}
.gm-cart-row__img img { width: 100%; height: 100%; object-fit: cover; }
.gm-cart-row__info { grid-area: info; min-width: 0; }
.gm-cart-row__name { font-weight: 600; text-decoration: none; color: var(--gm-text); }
.gm-cart-row__unit { font-size: 0.8rem; color: var(--gm-muted); }
.gm-cart-row__remove { grid-area: remove; justify-self: end; }
.gm-cart-row__qty { grid-area: qty; display: flex; align-items: center; gap: 0.5rem; }
.gm-cart-row__count { min-width: 1.5rem; text-align: center; font-weight: 600; }
.gm-cart-row__total { grid-area: total; justify-self: end; }
.gm-add-btn--sm { width: 32px; height: 32px; font-size: 1.1rem; border-radius: 9px; }
.gm-icon-btn {
    width: 32px;
    height: 32px;
    border: 1px solid var(--gm-border);
    border-radius: 9px;
    background: transparent;
    color: var(--gm-muted);
    line-height: 1;
}
.gm-icon-btn:hover { color: #d9534f; border-color: #d9534f; }
@media (min-width: 576px) {
    .gm-cart-row {
        grid-template-columns: 56px minmax(0, 1fr) auto auto auto;
        grid-template-areas: "img info qty total remove";
        column-gap: 1rem;
    }
    .gm-cart-row__total { min-width: 6.5rem; text-align: right; }
}

/* ---------- panouri, formulare, butoane ---------- */
.gm-card-panel {
    background: var(--gm-item-bg);
    border-radius: var(--gm-radius);
    box-shadow: var(--gm-shadow);
    padding: 1rem;
}
.gm-accent-btn {
    background: var(--gm-primary);
    border: 0;
    color: var(--gm-primary-text);
    font-weight: 700;
    border-radius: 12px;
}
.gm-accent-btn:hover, .gm-accent-btn:focus {
    background: var(--gm-primary);
    color: var(--gm-primary-text);
    filter: brightness(1.08);
}
.gm-back {
    display: inline-block;
    margin-bottom: 0.25rem;
    color: var(--gm-muted);
    font-weight: 600;
    text-decoration: none;
}
.gm-back:hover { color: var(--gm-primary); }
.gm-footer { border-top: 1px solid var(--gm-border); color: var(--gm-muted); }

.table { color: var(--gm-text); }
.form-control, .form-select {
    background: var(--gm-item-bg);
    border-color: var(--gm-border);
    color: var(--gm-text);
    border-radius: 10px;
}
.form-control:focus, .form-select:focus {
    background: var(--gm-item-bg);
    color: var(--gm-text);
    border-color: var(--gm-primary);
    box-shadow: 0 0 0 0.2rem color-mix(in srgb, var(--gm-primary) 25%, transparent);
}
[data-theme="dark"] .text-muted { color: var(--gm-muted) !important; }
[data-theme="dark"] .form-control::placeholder { color: var(--gm-muted); }
.gm-modal { background: var(--gm-item-bg); color: var(--gm-text); border-radius: var(--gm-radius); }
[data-theme="dark"] .btn-close { filter: invert(1); }

/* pagina de plata */
.gm-qr-box {
    background: #fff;
    border-radius: 0.75rem;
    padding: 1rem;
    display: inline-block;
    box-shadow: var(--gm-shadow);
}
.gm-qr-box img { width: 260px; height: 260px; }
.gm-countdown { color: var(--gm-primary); font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- ecrane medii si mari ---------- */
@media (min-width: 576px) {
    .gm-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
}
@media (min-width: 768px) {
    .gm-detail__wrap { grid-template-columns: 5fr 7fr; padding: 1.5rem; gap: 2rem; }
    .gm-detail__title { font-size: 1.9rem; }
}
@media (min-width: 992px) {
    .gm-header__inner,
    .gm-header__inner.has-info {
        grid-template-columns: auto minmax(0, 1fr) auto auto;
        grid-template-areas: "logo info lang cart";
        min-height: var(--gm-header-h);
        padding: 0.35rem 1rem;
    }
    .gm-logo img { height: 52px; max-width: 200px; }
    .gm-info__text { max-width: 320px; }
    .gm-page {
        display: grid;
        grid-template-columns: 240px minmax(0, 1fr);
        gap: 1.5rem;
        align-items: start;
        padding-top: 1rem;
    }
    .gm-nav { margin: 0; background: transparent; z-index: 1; }
    .gm-nav__scroller {
        flex-direction: column;
        align-items: stretch;
        height: auto;
        max-height: calc(100vh - var(--gm-header-h) - 2rem);
        padding: 0;
        overflow-y: auto;
        gap: 0.35rem;
    }
    .gm-nav__btn {
        height: 56px;
        max-width: none;
        padding: 8px;
        border-radius: 16px;
        box-shadow: none;
        background: transparent;
        font-size: 0.9rem;
    }
    .gm-nav__btn:hover { background: var(--gm-item-bg); }
    .gm-nav__btn.is-active { background: var(--gm-primary); color: var(--gm-primary-text); }
    .gm-nav__img { width: 40px; height: 40px; border-radius: 12px; }
    .gm-content { padding-top: 0; }
    .gm-section { scroll-margin-top: calc(var(--gm-header-h) + 16px); }
    .gm-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1200px) {
    .gm-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
