/* Brand footer (Figma 978:11355) — replaces legacy footer.css usage */
.footer-brand {
    --fb-blue: #0048aa;
    --fb-on-surface: #2a2d33;
    --fb-muted: #55575c;
    --fb-muted-2: #aaabad;
    --fb-features-bg: #f4f9ff;
    --fb-badge-bg: #fafafa;
    --fb-divider: #e9eaeb;
    direction: rtl;
    background: #fff;
    margin-top: 0;
    padding: 0;
    border: 0;
    position: relative;
}

.footer-brand .container {
    max-width: 1266px;
    padding-left: 15px;
    padding-right: 15px;
    margin: 0 auto;
}

/* Partner brands bar — Figma 978:11496 / row 978:11497 */
.fb-brands {
    position: relative;
    background: #0048aa;
    height: 88px;
    width: 100%;
    direction: ltr; /* keep snom → Panasonic order from Figma */
    margin-bottom: 48px; /* room for 978:11552 curve hanging below the bar */
    overflow: visible;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Figma 978:11497 exact layout */
.fb-brands__row {
    display: flex;
    width: 1374px;
    max-width: calc(100% - 66px);
    height: 41px;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0;
    opacity: 0.3;
    mix-blend-mode: luminosity;
    pointer-events: none;
    flex-shrink: 0;
}

/* Figma 978:11498 — logos row: 1374×21, gap 84, side inset 93 */
.fb-brands__inner {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    gap: 84px;
    width: 100%;
    height: 21px;
}

.fb-brand {
    position: relative;
    flex-shrink: 0;
    overflow: hidden;
    display: block;
}

/* Figma 978:11499–11505 — img fills (object-bottom / contain), no lightgray boxes */
.fb-brand img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: contain;
    object-position: bottom;
    pointer-events: none;
    display: block;
}

.fb-brand--snom { width: 60px; height: 21px; aspect-ratio: 20 / 7; }
.fb-brand--tplink { width: 141px; height: 19px; aspect-ratio: 141 / 19; }
.fb-brand--panalink { width: 104px; height: 21px; aspect-ratio: 104 / 21; }
.fb-brand--gigaset { width: 68px; height: 19px; aspect-ratio: 68 / 19; }
.fb-brand--grandstream { width: 118px; height: 21px; aspect-ratio: 118 / 21; }
.fb-brand--yealink { width: 82px; height: 19px; aspect-ratio: 82 / 19; }
.fb-brand--panasonic { width: 111px; height: 21px; aspect-ratio: 37 / 7; }

.fb-brand--gigaset img {
    object-fit: contain;
    object-position: center;
}

/* Panasonic — Figma absolute crop h 150.37%, top 3.98% */
.fb-brand--panasonic img {
    inset: auto;
    left: 0;
    top: 3.98%;
    width: 100%;
    height: 150.37%;
    object-fit: cover;
    object-position: center top;
}

/* Back-to-top — Figma 978:11552 (181×48 curve + 21×24 arrow) */
.fb-back-top {
    position: absolute;
    left: 50%;
    top: 88px;
    transform: translateX(-50%);
    width: 181px;
    height: 48px;
    display: block;
    z-index: 2;
    line-height: 0;
}

.fb-back-top__curve {
    position: absolute;
    inset: 0;
    width: 181px;
    height: 48px;
    display: block;
    pointer-events: none;
}

.fb-back-top__arrow {
    position: absolute;
    left: 80px; /* 709 - 629 from Figma metadata */
    top: 12px;  /* ~99.84 - 88 */
    width: 21px;
    height: 24px;
    display: block;
    pointer-events: none;
}

/* Main white section */
.fb-main {
    padding-bottom: 20px;
}

.fb-features {
    /* Figma 978:11626 — LTR order matches design (discount…location left→right) */
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: var(--fb-features-bg);
    border-radius: 12px;
    margin-bottom: 20px;
    direction: ltr;
    overflow: hidden;
}

.fb-feature {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-sizing: border-box;
    width: 224px;
    max-width: 224px;
    min-width: 0;
    flex: 0 0 224px;
    padding: 24px 32px;
    border-radius: 20px;
}

.fb-feature--tight {
    padding: 24px;
}

.fb-feature__label {
    font-family: "Yekan Bakh FaNum", "Yekan Bakh", sans-serif;
    font-size: 14px;
    font-weight: 600;
    font-style: normal;
    line-height: 24px;
    color: var(--fb-on-surface);
    white-space: nowrap;
    text-transform: capitalize;
    direction: rtl;
}

.fb-glass-icon {
    position: relative;
    width: 38px;
    height: 36px;
    flex-shrink: 0;
    overflow: visible;
    display: block;
}

.fb-glass-icon--activity {
    width: 40px;
    height: 36px;
}

.fb-glass-icon img {
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: contain;
    pointer-events: none;
}

/* About + link columns */
.fb-stack {
    width: 100%;
}

.fb-content {
    display: flex;
    flex-wrap: wrap;
    gap: 32px;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 20px;
}

.fb-about {
    flex: 1 1 320px;
    max-width: 591px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
}

.fb-about__logo img {
    display: block;
    width: 140px;
    height: 45px;
}

.fb-about__text {
    margin: 0;
    font-size: 12px;
    line-height: 24px;
    color: var(--fb-muted);
    text-align: justify;
    max-height: 120px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 5;
    line-clamp: 5;
}

.fb-about__text p {
    margin: 0 0 12px;
}

.fb-about__text p:last-child {
    margin-bottom: 0;
}

.fb-about__text.is-expanded {
    display: block !important;
    max-height: none !important;
    overflow: visible !important;
    -webkit-line-clamp: unset !important;
    line-clamp: unset !important;
}

.fb-about__more {
    appearance: none;
    border: 0;
    background: transparent;
    padding: 0;
    font-size: 12px;
    line-height: 24px;
    color: var(--fb-on-surface);
    cursor: pointer;
    text-decoration: none;
    text-align: inherit;
}

.fb-about__more:hover {
    color: var(--fb-blue);
}

.fb-links {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    flex: 1 1 320px;
    max-width: 613px;
    justify-content: flex-end;
}

.fb-links__col {
    flex: 1 1 160px;
    max-width: 190px;
}

.fb-links__title {
    margin: 0 0 12px;
    font-size: 14px;
    font-weight: 700;
    line-height: 20px;
    color: var(--fb-on-surface);
}

.fb-links__col ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.fb-links__col ul li a {
    font-size: 14px;
    line-height: 20px;
    color: var(--fb-muted);
    text-decoration: none;
    transition: color 0.2s ease;
}

.fb-links__col ul li a:hover {
    color: var(--fb-blue);
}

.fb-divider {
    height: 1px;
    background: var(--fb-divider);
    border: 0;
    margin: 0 0 20px;
}

/* Contact + badges */
.fb-bottom {
    display: flex;
    flex-wrap: wrap;
    gap: 40px 48px;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

.fb-contact {
    flex: 1 1 360px;
    max-width: 680px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
}

.fb-contact__rows {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
}

.fb-contact__social {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
}

.fb-contact__heading {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: #131414;
}

.fb-contact__heading--social {
    margin-top: 0;
}

.fb-contact__row {
    display: flex;
    flex-direction: row; /* icon then text; with RTL page icon sits on the right */
    align-items: flex-start;
    justify-content: flex-start;
    gap: 12px;
    width: 100%;
}

.fb-contact__icon {
    position: relative;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    margin-top: 2px;
    overflow: hidden;
    display: block;
}

/* Full framed icon exports from Figma (978:11478 / 11481 / 11484) */
.fb-contact__icon img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.fb-contact__texts,
.fb-contact__row > p {
    flex: 1;
    margin: 0;
    font-size: 14px;
    line-height: 24px;
    text-align: right;
}

.fb-contact__texts {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.fb-contact__texts p,
.fb-contact p {
    margin: 0;
}

.fb-contact__texts p:last-child {
    margin-bottom: 0;
}

.fb-contact__label {
    color: var(--fb-muted-2);
}

.fb-contact__value {
    color: var(--fb-muted);
    text-decoration: none;
}

.fb-social {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 24px;
}

.fb-social a {
    display: block;
    width: 40px;
    height: 40px;
    overflow: hidden;
}

.fb-social a img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.fb-badges {
    display: grid;
    grid-template-columns: repeat(3, 114px);
    gap: 20px;
    justify-content: start;
}

.fb-badge {
    width: 114px;
    height: 114px;
    background: var(--fb-badge-bg);
    border-radius: 20px;
    padding: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.fb-badge img {
    max-width: 94px;
    max-height: 94px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.fb-badge--torob {
    flex-direction: column;
    gap: 4px;
}

.fb-badge--torob span {
    font-size: 12px;
    line-height: 20px;
    color: #000;
}

.fb-copyright {
    text-align: center;
    padding-top: 8px;
}

.fb-copyright p {
    margin: 0;
    font-size: 14px;
    line-height: 24px;
    color: var(--fb-muted);
}

@media (max-width: 991.98px) {
    /* Mobile footer — Figma 1003:14798 */
    .footer-brand {
        /* Body already reserves space for hp-mobile-nav; avoid double gap under copyright */
        padding-bottom: 0;
    }

    /* Brands strip — Figma 1003:14800 / 1045:9345 (full-size logos, cropped by overflow) */
    .fb-brands {
        display: flex;
        height: 75px;
        min-height: 75px;
        padding: 17px 0;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        align-self: stretch;
        background: #0048aa;
        margin-bottom: 0;
        overflow: hidden;
        position: relative;
    }

    .fb-brands__row {
        position: absolute;
        left: 50%;
        top: 17px;
        transform: translateX(-50%);
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        width: 1374px;
        max-width: none;
        height: 41px;
        min-height: 41px;
        opacity: 0.3;
        mix-blend-mode: luminosity;
        pointer-events: none;
        flex-shrink: 0;
    }

    .fb-brands__inner {
        display: flex;
        flex-wrap: nowrap;
        align-items: center;
        justify-content: center;
        gap: 20px;
        align-self: stretch;
        width: 100%;
        max-width: none;
        height: 21px;
        padding: 0;
        transform: none;
    }

    .fb-brand--snom { width: 60px; height: 21px; }
    .fb-brand--tplink { width: 141px; height: 19px; }
    .fb-brand--panalink { width: 104px; height: 21px; }
    .fb-brand--gigaset { width: 68px; height: 19px; }
    .fb-brand--yealink { width: 82px; height: 19px; }
    .fb-brand--grandstream { width: 118px; height: 21px; }
    .fb-brand--panasonic { width: 111px; height: 21px; }

    .fb-back-top {
        display: none !important;
    }

    .footer-brand .fb-main {
        padding-top: 0;
        padding-bottom: 0;
    }

    .footer-brand .fb-main > .container,
    .footer-brand .fb-main__inner {
        display: flex;
        flex-direction: column;
        align-items: center;
        /* Outer rhythm: brands→features already separate; features → stack → copyright = 32 */
        gap: 32px;
        width: 100%;
        max-width: 403px;
        padding-top: 32px;
        padding-left: 16px;
        padding-right: 16px;
        margin: 0 auto;
        box-sizing: border-box;
    }

    /* Figma 1003:14807 — equal 28px between links / contact / badges / about */
    .footer-brand .fb-stack {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 28px;
        width: 100%;
        max-width: 337px;
        margin: 0 auto;
        padding: 0;
        box-sizing: border-box;
    }

    /* Flatten nested wrappers so stack children participate in the 28px gap */
    .footer-brand .fb-content,
    .footer-brand .fb-bottom {
        display: contents;
        margin: 0;
        padding: 0;
        gap: 0;
    }

    .fb-features {
        display: flex;
        flex-wrap: wrap;
        width: 100%;
        max-width: 345px;
        margin: 0;
        gap: 0;
        border-radius: 12px;
        background: var(--fb-features-bg);
        overflow: hidden;
        /* Figma 1048:9476 is LTR: activity|chat / shield|location; each cell is label then icon */
        direction: ltr;
    }

    .fb-feature--discount {
        display: none !important;
    }

    .fb-feature {
        box-sizing: border-box;
        flex: 0 0 50%;
        width: 50%;
        max-width: 50%;
        min-width: 0;
        height: 68px;
        padding: 12px;
        margin: 0;
        border-radius: 20px;
        background: transparent;
        /* label (DOM first) left, icon right — same as Figma flex gap-8 justify-end */
        flex-direction: row;
        justify-content: flex-end;
        align-items: center;
        gap: 8px;
        direction: ltr;
    }

    .fb-feature--activity { order: 1; }
    .fb-feature--chat { order: 2; }
    .fb-feature--shield { order: 3; }
    .fb-feature--location { order: 4; }

    .fb-feature__label {
        order: 1;
        font-family: "Yekan Bakh FaNum", "Yekan Bakh", sans-serif;
        font-size: 12px;
        font-weight: 400;
        line-height: 20px;
        white-space: nowrap;
        text-align: right;
        color: var(--fb-on-surface);
        direction: rtl;
        text-transform: capitalize;
    }

    .fb-glass-icon,
    .fb-glass-icon--activity {
        order: 2;
        width: 28px;
        height: 26px;
        flex-shrink: 0;
    }

    /* 1003:14807 stack: links → contact → badges → about */
    .fb-links {
        order: 1;
        width: 100%;
        max-width: 337px;
        margin: 0;
        display: flex;
        flex-wrap: wrap;
        gap: 20px;
        justify-content: flex-start; /* RTL: packs to the right */
        direction: rtl;
    }

    .fb-links__col {
        flex: 0 0 calc(50% - 10px);
        max-width: calc(50% - 10px);
        width: auto;
    }

    .fb-links__col:nth-child(3) {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .fb-links__title {
        margin: 0 0 12px;
        text-align: right;
    }

    .fb-links__col ul {
        align-items: flex-start; /* RTL: right edge */
    }

    .fb-links__col ul li,
    .fb-links__col ul li a {
        width: 100%;
        text-align: right;
    }

    .fb-divider {
        display: none !important;
        margin: 0 !important;
        height: 0 !important;
        padding: 0 !important;
    }

    /* Figma 1003:14911 — only the 3 rows; no heading/social box after phone */
    .footer-brand .fb-contact {
        order: 2;
        width: 100%;
        max-width: 337px;
        margin: 0 !important;
        padding: 0 !important;
        display: contents; /* children join .fb-stack; contact wrapper cannot add space */
    }

    .footer-brand .fb-contact > .fb-contact__heading,
    .footer-brand .fb-contact__social,
    .footer-brand .fb-contact__social * {
        display: none !important;
        margin: 0 !important;
        padding: 0 !important;
        height: 0 !important;
        max-height: 0 !important;
        overflow: hidden !important;
        border: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }

    .footer-brand .fb-contact__rows {
        order: 2;
        display: flex;
        flex-direction: column;
        gap: 12px;
        width: 100%;
        max-width: 337px;
        margin: 0 !important;
        padding: 0 !important;
        align-self: stretch;
    }

    .footer-brand .fb-contact__row {
        display: flex;
        flex-direction: row;
        justify-content: flex-start;
        align-items: flex-start;
        gap: 12px;
        width: 100%;
        margin: 0 !important;
        padding: 0 !important;
    }

    .footer-brand .fb-contact__row:last-child {
        margin-bottom: 0 !important;
        padding-bottom: 0 !important;
    }

    .fb-contact__texts,
    .fb-contact__row > p {
        margin: 0 !important;
        text-align: right;
        line-height: 24px;
    }

    .fb-contact__texts {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .fb-contact__texts p,
    .fb-contact p {
        margin: 0 !important;
        padding: 0;
    }

    .fb-badges {
        order: 3;
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        justify-content: flex-end;
        align-items: flex-start;
        gap: 16px;
        width: 100%;
        max-width: 337px;
        margin: 0;
        padding: 0;
        direction: ltr; /* badges order left→right like Figma; end-aligned */
    }

    .fb-badge {
        width: 72px;
        height: 72px;
        padding: 0;
        background: transparent;
        border: 0;
        box-shadow: none;
    }

    .fb-badge img {
        width: 72px;
        height: 72px;
        object-fit: contain;
    }

    .fb-badge--desktop-only,
    .fb-badge--torob {
        display: none !important;
    }

    .fb-about {
        order: 4;
        width: 100%;
        max-width: 337px;
        margin: 0;
        padding: 0;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .fb-about__logo {
        display: block;
        width: 140px;
        height: 45px;
        margin-left: auto; /* pin to visual right */
        margin-right: 0;
        align-self: auto;
    }

    .fb-about__logo img {
        width: 140px;
        height: 45px;
        display: block;
    }

    .fb-about__text {
        width: 100%;
        text-align: right;
        max-height: 168px;
        -webkit-line-clamp: 7;
        line-clamp: 7;
    }

    .fb-about__text p {
        margin: 0 0 12px;
    }

    .fb-about__text p:last-child {
        margin-bottom: 0;
    }

    .fb-about__text a {
        color: var(--fb-muted);
        text-decoration: underline;
    }

    .fb-about__more {
        display: block;
        width: auto;
        max-width: 100%;
        margin-left: auto; /* pin «مشاهده بیشتر» to visual right */
        margin-right: 0;
        padding: 0;
        color: var(--fb-on-surface);
        text-align: right;
        align-self: auto;
    }

    .fb-copyright {
        width: 100%;
        max-width: 337px;
        margin: 0;
        text-align: center;
        padding: 0;
    }

    .fb-copyright p {
        margin: 0 auto;
        max-width: 272px;
        font-size: 14px;
        line-height: 24px;
        color: var(--fb-muted);
        text-align: center;
    }
}

/* Kill legacy double bottom spacer under sticky hp-mobile-nav (body margin-bottom:82 + padding-bottom:76) */
@media (max-width: 991.98px) {
    body:has(.hp-mobile-nav) {
        margin-bottom: 0 !important;
    }
}

@media (max-width: 575px) {
    .fb-feature__label {
        font-size: 11px;
        white-space: normal;
    }
}

