:root {
    --samta-green: #0f766e;
    --samta-green-dark: #0b5f59;
    --samta-gold: #c8a24a;
    --samta-ink: #17302e;
    --samta-muted: #60716f;
    --samta-line: #dce8e6;
    --samta-bg: #f5f9f8;
    --samta-edge: 5px;
    --samta-card-width: clamp(410px, 43vw, 560px);
    --samta-sticky-top: 0px;
}

body.admin-bar { --samta-sticky-top: 32px; }

body.samta-tools-hub-page {
    overflow-x: hidden;
}

body.samta-tools-hub-page .entry-content,
body.samta-tools-hub-page .wp-block-post-content,
body.samta-tools-hub-page .site-main,
body.samta-tools-hub-page .content-area {
    overflow: visible !important;
}

.samta-tools-hub,
.samta-tools-hub * {
    box-sizing: border-box;
}

.samta-tools-hub {
    position: relative;
    left: auto !important;
    right: auto !important;
    transform: none !important;
    width: calc(100vw - (var(--samta-edge) * 2)) !important;
    max-width: none !important;
    margin-block: 18px 46px !important;
    margin-inline: calc((100% - 100vw) / 2 + var(--samta-edge)) !important;
    color: var(--samta-ink);
    font-family: Tahoma, Arial, sans-serif;
}

/* رأس البوابة ثابت، بينما تتغير الأداة أسفله. */
.samta-tools-hub__head {
    position: sticky;
    top: var(--samta-sticky-top);
    z-index: 90;
    padding: clamp(16px, 2vw, 26px) clamp(8px, 1.6vw, 22px) 12px;
    border: 1px solid rgba(15, 118, 110, .16);
    border-radius: 28px 28px 18px 18px;
    background:
        radial-gradient(circle at 85% 0%, rgba(200, 162, 74, .11), transparent 28%),
        radial-gradient(circle at 0% 20%, rgba(15, 118, 110, .10), transparent 30%),
        rgba(245, 249, 248, .97);
    box-shadow: 0 16px 42px rgba(24, 60, 56, .13);
    backdrop-filter: blur(14px);
    overflow: hidden;
}

.samta-tools-hub__intro {
    position: relative;
    z-index: 30;
    max-width: 860px;
    margin: 0 auto 8px;
    padding-inline: 8px;
    text-align: center;
}

.samta-tools-hub__eyebrow {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 3px 12px;
    border: 1px solid rgba(200, 162, 74, .45);
    border-radius: 999px;
    color: #8a691c;
    background: rgba(255, 255, 255, .82);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.6px;
}

.samta-tools-hub h1 {
    margin: 8px 0 4px;
    color: var(--samta-ink);
    font-size: clamp(25px, 2.8vw, 40px);
    line-height: 1.15;
}

.samta-tools-hub__intro p {
    margin: 0;
    color: var(--samta-muted);
    font-size: clamp(13px, 1.2vw, 16px);
    line-height: 1.7;
}

.samta-tools-carousel {
    position: relative;
    width: 100%;
}

.samta-tools-carousel__viewport {
    position: relative;
    width: 100%;
    height: clamp(145px, 16vw, 190px);
    overflow: hidden;
    isolation: isolate;
    touch-action: pan-y;
    user-select: none;
}

.samta-tools-track {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.samta-tool-card {
    appearance: none;
    position: absolute;
    top: 50%;
    left: 50%;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    width: var(--samta-card-width);
    min-height: 122px;
    gap: 15px;
    padding: 18px 23px;
    border: 1px solid var(--samta-line);
    border-radius: 23px;
    background: rgba(255, 255, 255, .98);
    color: var(--samta-ink);
    text-align: right;
    text-decoration: none;
    box-shadow: 0 12px 30px rgba(20, 72, 67, .10);
    opacity: 0;
    transform: translate3d(-50%, -50%, 0) scale(.72);
    transform-origin: center center;
    transition: transform .48s cubic-bezier(.22, .78, .24, 1), opacity .34s ease, filter .34s ease, border-color .25s ease, box-shadow .25s ease;
    will-change: transform, opacity;
    cursor: pointer;
    overflow: hidden;
}

.samta-tool-card::after {
    content: "";
    position: absolute;
    inset: -1px;
    z-index: 4;
    border-radius: inherit;
    pointer-events: none;
    opacity: 0;
    transition: opacity .34s ease;
}

.samta-tool-card.is-left::after {
    background: linear-gradient(to left, rgba(255,255,255,.08), rgba(255,255,255,.38) 52%, rgba(255,255,255,.94));
    opacity: 1;
}

.samta-tool-card.is-right::after {
    background: linear-gradient(to right, rgba(255,255,255,.08), rgba(255,255,255,.38) 52%, rgba(255,255,255,.94));
    opacity: 1;
}

.samta-tool-card.is-current {
    border-color: rgba(15, 118, 110, .58);
    background: linear-gradient(145deg, #ffffff, #f1fbf9);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, .08), 0 18px 38px rgba(20, 72, 67, .17);
}

.samta-tool-card.is-current::after { opacity: 0; }
.samta-tool-card.is-adjacent { filter: saturate(.70) contrast(.96); }
.samta-tool-card.is-far { filter: saturate(.45) brightness(1.05); pointer-events: none; }

.samta-tool-card:focus-visible {
    outline: 3px solid rgba(15, 118, 110, .22);
    outline-offset: 4px;
}

.samta-tool-card__icon,
.samta-tool-card__text,
.samta-tool-card__arrow {
    position: relative;
    z-index: 2;
}

.samta-tool-card__icon {
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    border: 1px solid #d6ebe8;
    border-radius: 18px;
    color: var(--samta-green);
    background: linear-gradient(145deg, #e8f7f4, #ffffff);
}

.samta-tool-card__icon svg { width: 29px; height: 29px; }
.samta-tool-card__text { min-width: 0; }
.samta-tool-card__text strong,
.samta-tool-card__text small { display: block; }
.samta-tool-card__text strong { margin-bottom: 5px; font-size: clamp(19px, 1.55vw, 25px); line-height: 1.35; }
.samta-tool-card__text small { color: var(--samta-muted); font-size: clamp(12px, 1vw, 15px); line-height: 1.65; }
.samta-tool-card__arrow { color: var(--samta-gold); font-size: 27px; }

/* الأزرار فوق جميع البطاقات وتعمل بالماوس واللمس. */
.samta-tools-carousel__arrow {
    position: absolute;
    top: 50%;
    z-index: 100;
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    padding: 0;
    border: 1px solid rgba(15, 118, 110, .24);
    border-radius: 50%;
    color: var(--samta-green-dark);
    background: #fff;
    box-shadow: 0 10px 28px rgba(20, 72, 67, .16);
    transform: translateY(-50%);
    cursor: pointer;
    pointer-events: auto;
    touch-action: manipulation;
    transition: background .2s ease, box-shadow .2s ease, transform .2s ease;
}

.samta-tools-carousel__arrow:hover,
.samta-tools-carousel__arrow:focus-visible {
    background: #f2fbf9;
    box-shadow: 0 12px 34px rgba(20, 72, 67, .22);
    transform: translateY(-50%) scale(1.06);
    outline: none;
}

.samta-tools-carousel__arrow:active { transform: translateY(-50%) scale(.96); }
.samta-tools-carousel__arrow--right { right: 8px; }
.samta-tools-carousel__arrow--left { left: 8px; }
.samta-tools-carousel__arrow svg { width: 22px; height: 22px; pointer-events: none; }
.samta-tools-carousel.is-dragging .samta-tool-card { transition-duration: .16s; }

/* مساحة الأداة التي تتبدل أسفل الرأس. */
.samta-tools-stage {
    position: relative;
    z-index: 1;
    margin-top: 12px;
    border: 1px solid rgba(15, 118, 110, .16);
    border-radius: 18px 18px 28px 28px;
    background: #fff;
    box-shadow: 0 20px 55px rgba(24, 60, 56, .10);
    overflow: hidden;
}

.samta-tools-stage__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    min-height: 62px;
    padding: 10px 18px;
    border-bottom: 1px solid #e8efee;
    background: linear-gradient(180deg, #fff, #f7fbfa);
}

.samta-tools-stage__bar > div { min-width: 0; }
.samta-tools-stage__bar span { display: block; margin-bottom: 2px; color: var(--samta-muted); font-size: 11px; }
.samta-tools-stage__bar strong { display: block; color: var(--samta-ink); font-size: 18px; }
.samta-tools-stage__bar a {
    flex: 0 0 auto;
    padding: 8px 13px;
    border: 1px solid rgba(15,118,110,.22);
    border-radius: 999px;
    color: var(--samta-green-dark);
    background: #fff;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
}
.samta-tools-stage__bar a:hover { background: #eef9f7; }

.samta-tools-stage__screen {
    position: relative;
    height: clamp(650px, 76vh, 980px);
    background: #fff;
}

.samta-tools-stage__frame {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    background: #fff;
}

.samta-tools-stage__loader {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--samta-muted);
    background: rgba(255,255,255,.94);
    opacity: 0;
    visibility: hidden;
    transition: opacity .2s ease, visibility .2s ease;
}

.samta-tools-stage.is-loading .samta-tools-stage__loader { opacity: 1; visibility: visible; }
.samta-tools-stage__loader span {
    width: 24px;
    height: 24px;
    border: 3px solid #d7ebe8;
    border-top-color: var(--samta-green);
    border-radius: 50%;
    animation: samta-spin .75s linear infinite;
}
.samta-tools-stage__loader b { font-size: 14px; }
@keyframes samta-spin { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
    :root { --samta-card-width: min(72vw, 470px); }
    .samta-tools-carousel__viewport { height: 170px; }
    .samta-tool-card { min-height: 116px; padding: 17px 20px; }
    .samta-tools-stage__screen { height: 74vh; min-height: 620px; }
}

@media (max-width: 782px) {
    body.admin-bar { --samta-sticky-top: 46px; }
}

@media (max-width: 640px) {
    :root { --samta-card-width: calc(100vw - 76px); }

    .samta-tools-hub { margin-top: 7px !important; margin-bottom: 24px !important; }
    .samta-tools-hub__head { padding: 12px 5px 8px; border-radius: 20px 20px 14px 14px; }
    .samta-tools-hub__intro { margin-bottom: 4px; padding-inline: 8px; }
    .samta-tools-hub h1 { font-size: clamp(25px, 7.4vw, 34px); }
    .samta-tools-hub__intro p { font-size: 12px; line-height: 1.55; }
    .samta-tools-carousel__viewport { height: 154px; }
    .samta-tool-card { min-height: 105px; gap: 10px; padding: 14px 16px; border-radius: 19px; }
    .samta-tool-card__icon { width: 46px; height: 46px; border-radius: 15px; }
    .samta-tool-card__icon svg { width: 25px; height: 25px; }
    .samta-tool-card__text strong { margin-bottom: 3px; font-size: 17px; }
    .samta-tool-card__text small { font-size: 11px; line-height: 1.45; }
    .samta-tool-card__arrow { font-size: 22px; }
    .samta-tools-carousel__arrow { width: 40px; height: 40px; }
    .samta-tools-carousel__arrow--right { right: 2px; }
    .samta-tools-carousel__arrow--left { left: 2px; }

    .samta-tools-stage { margin-top: 7px; border-radius: 14px 14px 20px 20px; }
    .samta-tools-stage__bar { min-height: 56px; padding: 8px 11px; }
    .samta-tools-stage__bar strong { font-size: 15px; }
    .samta-tools-stage__bar a { padding: 7px 9px; font-size: 10px; }
    .samta-tools-stage__screen { height: 72vh; min-height: 590px; }
}

@media (prefers-reduced-motion: reduce) {
    .samta-tool-card,
    .samta-tools-carousel__arrow,
    .samta-tools-stage__loader { transition: none; }
    .samta-tools-stage__loader span { animation: none; }
}
