/* ============================================================
 * gallery-style.css — تنسيق صفحة المعرض ولوحة التخصيص.
 * تصميم 2026: ظلال ناعمة، حركة انسيابية، زجاجية خفيفة، استجابة كاملة.
 * ============================================================ */

:root {
    --g-primary: #2563eb;
    --g-primary-dark: #1d4ed8;
    --g-ink: #0f172a;
    --g-ink-soft: #334155;
    --g-muted: #64748b;
    --g-line: #e2e8f0;
    --g-bg: #f8fafc;
    --g-surface: #ffffff;

    --g-radius-sm: 12px;
    --g-radius: 20px;
    --g-radius-lg: 30px;
    --g-shadow-sm: 0 8px 24px -14px rgba(15, 23, 42, .35);
    --g-shadow: 0 24px 60px -28px rgba(15, 23, 42, .35);
    --g-shadow-glow: 0 30px 80px -30px rgba(37, 99, 235, .55);
    --g-ease: cubic-bezier(.22, 1, .36, 1);
    --g-maxw: 1200px;

    /* خريطة ألوان واجهة العميل (تطابق template_palettes في PHP) */
    --c-blue: #2563eb;
    --c-green: #059669;
    --c-red: #dc2626;
    --c-gold: #bf9b30;
    --c-purple: #7c3aed;
    --c-teal: #0d9488;
    --c-orange: #ea580c;
    --c-pink: #db2777;
    --c-slate: #334155;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: "Tajawal", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    color: var(--g-ink);
    line-height: 1.8;
    background:
        radial-gradient(1100px 520px at 100% -10%, rgba(37, 99, 235, .10), transparent 60%),
        radial-gradient(900px 500px at -10% 10%, rgba(191, 155, 48, .08), transparent 55%),
        var(--g-bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

img {
    max-width: 100%;
    display: block;
}

a {
    color: inherit;
    text-decoration: none;
}

.container {
    width: min(100% - 40px, var(--g-maxw));
    margin-inline: auto;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .3px;
    color: var(--g-primary-dark);
    background: rgba(37, 99, 235, .10);
    border: 1px solid rgba(37, 99, 235, .18);
    padding: 7px 16px;
    border-radius: 999px;
}

/* ============================================================
 * شريط التعريف العلوي
 * ============================================================ */
.site-head {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(255, 255, 255, .78);
    backdrop-filter: saturate(160%) blur(14px);
    -webkit-backdrop-filter: saturate(160%) blur(14px);
    border-bottom: 1px solid var(--g-line);
}

.site-head__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-block: 14px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-weight: 800;
    font-size: 19px;
}

.brand__badge {
    width: 42px;
    height: 42px;
    border-radius: 13px;
    display: grid;
    place-items: center;
    color: #fff;
    background: linear-gradient(135deg, var(--g-primary), var(--g-primary-dark));
    box-shadow: var(--g-shadow-glow);
}

.brand__badge svg {
    width: 22px;
    height: 22px;
}

.site-head__cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 14px;
    padding: 10px 20px;
    border-radius: 999px;
    color: #fff;
    background: linear-gradient(135deg, var(--g-primary), var(--g-primary-dark));
    box-shadow: var(--g-shadow-sm);
    transition: transform .25s var(--g-ease), box-shadow .25s var(--g-ease);
}

.site-head__cta:hover {
    transform: translateY(-2px);
    box-shadow: var(--g-shadow-glow);
}

/* ============================================================
 * قسم الهيرو
 * ============================================================ */
.hero {
    padding-block: clamp(48px, 8vw, 96px);
    text-align: center;
}

.hero__title {
    margin: 22px auto 18px;
    max-width: 18ch;
    font-size: clamp(30px, 5.4vw, 56px);
    line-height: 1.18;
    font-weight: 800;
    letter-spacing: -.5px;
    background: linear-gradient(120deg, var(--g-ink), #1e3a8a 55%, var(--g-primary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.hero__desc {
    margin: 0 auto;
    max-width: 62ch;
    font-size: clamp(16px, 2.2vw, 19px);
    color: var(--g-ink-soft);
}

.hero__actions {
    margin-top: 34px;
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    justify-content: center;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-weight: 700;
    font-size: 16px;
    padding: 14px 28px;
    border-radius: 999px;
    border: 0;
    cursor: pointer;
    transition: transform .25s var(--g-ease), box-shadow .25s var(--g-ease), background-color .25s var(--g-ease);
}

.btn--primary {
    color: #fff;
    background: linear-gradient(135deg, var(--g-primary), var(--g-primary-dark));
    box-shadow: var(--g-shadow-glow);
}

.btn--primary:hover {
    transform: translateY(-3px);
}

.btn--ghost {
    color: var(--g-ink);
    background: var(--g-surface);
    border: 1px solid var(--g-line);
    box-shadow: var(--g-shadow-sm);
}

.btn--ghost:hover {
    transform: translateY(-3px);
    border-color: rgba(37, 99, 235, .4);
}

/* ============================================================
 * قسم أهمية التحول الرقمي (Bento Grid)
 * ============================================================ */
.section {
    padding-block: clamp(40px, 7vw, 84px);
}

.section__head {
    text-align: center;
    max-width: 60ch;
    margin: 0 auto 44px;
}

.section__title {
    font-size: clamp(24px, 3.6vw, 36px);
    font-weight: 800;
    margin: 16px 0 10px;
    letter-spacing: -.4px;
}

.section__lead {
    color: var(--g-muted);
    margin: 0;
    font-size: 17px;
}

.bento {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 22px;
}

.bento__card {
    position: relative;
    background: var(--g-surface);
    border: 1px solid var(--g-line);
    border-radius: var(--g-radius-lg);
    padding: 34px;
    box-shadow: var(--g-shadow);
    overflow: hidden;
    transition: transform .3s var(--g-ease), box-shadow .3s var(--g-ease);
}

.bento__card::before {
    content: "";
    position: absolute;
    inset-inline-start: 0;
    inset-block-start: 0;
    width: 100%;
    height: 5px;
    background: linear-gradient(90deg, var(--g-primary), var(--c-gold));
    opacity: .9;
}

.bento__card:hover {
    transform: translateY(-6px);
    box-shadow: var(--g-shadow-glow);
}

.bento__icon {
    width: 58px;
    height: 58px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    color: var(--g-primary-dark);
    background: rgba(37, 99, 235, .10);
    margin-bottom: 20px;
}

.bento__icon svg {
    width: 28px;
    height: 28px;
}

.bento__card:nth-child(2) .bento__icon {
    color: #92710f;
    background: rgba(191, 155, 48, .14);
}

.bento__title {
    font-size: 21px;
    font-weight: 800;
    margin: 0 0 12px;
}

.bento__text {
    margin: 0;
    color: var(--g-ink-soft);
    font-size: 16px;
}

/* ============================================================
 * لوحة التخصيص التفاعلية
 * ============================================================ */
.studio {
    display: grid;
    grid-template-columns: 1.05fr .95fr;
    gap: 28px;
    align-items: start;
    background: var(--g-surface);
    border: 1px solid var(--g-line);
    border-radius: var(--g-radius-lg);
    padding: clamp(24px, 4vw, 44px);
    box-shadow: var(--g-shadow);
}

.studio__field {
    margin-bottom: 24px;
}

.studio__label {
    display: block;
    font-weight: 700;
    font-size: 15px;
    margin-bottom: 10px;
    color: var(--g-ink);
}

.studio__hint {
    font-weight: 500;
    font-size: 13px;
    color: var(--g-muted);
}

.input {
    width: 100%;
    font: inherit;
    font-size: 16px;
    padding: 14px 16px;
    border-radius: var(--g-radius-sm);
    border: 1.5px solid var(--g-line);
    background: #fff;
    color: var(--g-ink);
    transition: border-color .2s var(--g-ease), box-shadow .2s var(--g-ease);
}

.input:focus {
    outline: none;
    border-color: var(--g-primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, .14);
}

.input.shake {
    animation: g-shake .4s ease;
    border-color: var(--c-red);
}

@keyframes g-shake {
    10%, 90% { transform: translateX(-1px); }
    20%, 80% { transform: translateX(2px); }
    30%, 50%, 70% { transform: translateX(-4px); }
    40%, 60% { transform: translateX(4px); }
}

/* رافع الشعار */
.uploader {
    position: relative;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px;
    border: 1.5px dashed var(--g-line);
    border-radius: var(--g-radius-sm);
    background: var(--g-bg);
    transition: border-color .2s var(--g-ease), background-color .2s var(--g-ease);
}

.uploader:hover {
    border-color: var(--g-primary);
    background: #fff;
}

.uploader__icon {
    flex: 0 0 auto;
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    color: var(--g-primary-dark);
    background: rgba(37, 99, 235, .12);
}

.uploader__icon svg {
    width: 24px;
    height: 24px;
}

.uploader__body {
    flex: 1;
    min-width: 0;
}

.uploader__title {
    font-weight: 700;
    font-size: 15px;
}

.uploader__sub {
    font-size: 13px;
    color: var(--g-muted);
}

.uploader__input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.uploader__remove {
    position: relative;
    z-index: 2;
    flex: 0 0 auto;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    color: var(--c-red);
    background: rgba(220, 38, 38, .08);
    border: 1px solid rgba(220, 38, 38, .18);
    border-radius: 999px;
    padding: 8px 14px;
    cursor: pointer;
}

.status {
    margin-top: 12px;
    font-size: 13.5px;
    font-weight: 600;
    padding: 10px 14px;
    border-radius: 10px;
}

.status[data-state="loading"] { color: #1e3a8a; background: rgba(37, 99, 235, .08); }
.status[data-state="ok"]      { color: #065f46; background: rgba(5, 150, 105, .10); }
.status[data-state="warn"]    { color: #92400e; background: rgba(217, 119, 6, .12); }

/* دوائر الألوان */
.swatches {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

.swatch {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 3px solid #fff;
    cursor: pointer;
    position: relative;
    box-shadow: 0 0 0 1.5px var(--g-line), var(--g-shadow-sm);
    transition: transform .2s var(--g-ease), box-shadow .2s var(--g-ease);
}

.swatch:hover {
    transform: translateY(-3px) scale(1.05);
}

.swatch.is-active {
    box-shadow: 0 0 0 3px #fff, 0 0 0 6px currentColor;
}

.swatch.is-active::after {
    content: "";
    position: absolute;
    inset: 0;
    margin: auto;
    width: 16px;
    height: 16px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23111' d='M9 16.2l-3.5-3.5L4 14.2 9 19.2 20 8.2l-1.5-1.5z'/%3E%3C/svg%3E") center/12px no-repeat;
    border-radius: 50%;
}

.swatch[data-color="blue"]   { background: var(--c-blue); color: var(--c-blue); }
.swatch[data-color="green"]  { background: var(--c-green); color: var(--c-green); }
.swatch[data-color="red"]    { background: var(--c-red); color: var(--c-red); }
.swatch[data-color="gold"]   { background: var(--c-gold); color: var(--c-gold); }
.swatch[data-color="purple"] { background: var(--c-purple); color: var(--c-purple); }
.swatch[data-color="teal"]   { background: var(--c-teal); color: var(--c-teal); }
.swatch[data-color="orange"] { background: var(--c-orange); color: var(--c-orange); }
.swatch[data-color="pink"]   { background: var(--c-pink); color: var(--c-pink); }
.swatch[data-color="slate"]  { background: var(--c-slate); color: var(--c-slate); }

/* المعاينة الحيّة داخل اللوحة */
.studio__preview {
    position: sticky;
    top: 90px;
    background: linear-gradient(160deg, #0f172a, #1e293b);
    border-radius: var(--g-radius);
    padding: 26px;
    color: #e2e8f0;
    box-shadow: var(--g-shadow);
    overflow: hidden;
}

.studio__preview-title {
    font-size: 14px;
    color: #94a3b8;
    font-weight: 600;
    margin: 0 0 18px;
}

.preview-chip {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    min-height: 120px;
    border-radius: var(--g-radius-sm);
    background: rgba(255, 255, 255, .04);
    border: 1px solid rgba(255, 255, 255, .08);
    padding: 22px;
    overflow: hidden; /* يمنع تجاوز الشعار العريض لحدود الإطار على الموبايل */
}

.preview-chip__img {
    max-width: 100%; /* لا يتعدّى عرض الإطار مهما ضاقت الشاشة */
    max-height: 84px;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 10px;
}

.preview-chip__text {
    font-weight: 800;
    font-size: clamp(20px, 4vw, 28px);
    padding: 12px 22px;
    border-radius: 14px;
    color: #fff;
    text-align: center;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    background: linear-gradient(135deg, var(--c-blue), #1d4ed8);
    box-shadow: 0 14px 30px -12px rgba(0, 0, 0, .5);
}

.preview-chip[data-color="green"]  .preview-chip__text { background: linear-gradient(135deg, var(--c-green), #047857); }
.preview-chip[data-color="red"]    .preview-chip__text { background: linear-gradient(135deg, var(--c-red), #b91c1c); }
.preview-chip[data-color="gold"]   .preview-chip__text { background: linear-gradient(135deg, var(--c-gold), #9c7d18); }
.preview-chip[data-color="purple"] .preview-chip__text { background: linear-gradient(135deg, var(--c-purple), #6d28d9); }
.preview-chip[data-color="teal"]   .preview-chip__text { background: linear-gradient(135deg, var(--c-teal), #0f766e); }
.preview-chip[data-color="orange"] .preview-chip__text { background: linear-gradient(135deg, var(--c-orange), #c2410c); }
.preview-chip[data-color="pink"]   .preview-chip__text { background: linear-gradient(135deg, var(--c-pink), #be185d); }
.preview-chip[data-color="slate"]  .preview-chip__text { background: linear-gradient(135deg, var(--c-slate), #1e293b); }

.studio__preview-note {
    margin: 18px 0 0;
    font-size: 13px;
    color: #94a3b8;
    text-align: center;
}

/* ============================================================
 * شبكة القوالب
 * ============================================================ */
.templates {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
}

.tpl-card {
    display: flex;
    flex-direction: column;
    background: var(--g-surface);
    border: 1px solid var(--g-line);
    border-radius: var(--g-radius);
    overflow: hidden;
    box-shadow: var(--g-shadow-sm);
    transition: transform .3s var(--g-ease), box-shadow .3s var(--g-ease);
}

.tpl-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--g-shadow-glow);
}

.tpl-card__cover {
    height: 150px;
    display: grid;
    place-items: center;
    color: #fff;
    position: relative;
    overflow: hidden;
}

.tpl-card__cover svg {
    width: 64px;
    height: 64px;
    filter: drop-shadow(0 10px 18px rgba(0, 0, 0, .25));
    position: relative;
    z-index: 1;
}

.tpl-card__cover::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(120px 80px at 80% 20%, rgba(255, 255, 255, .25), transparent 60%);
}

.tpl-card[data-domain="clinic"]   .tpl-card__cover { background: linear-gradient(135deg, #0ea5e9, #1d4ed8); }
.tpl-card[data-domain="cars"]     .tpl-card__cover { background: linear-gradient(135deg, #ef4444, #991b1b); }
.tpl-card[data-domain="mobiles"]  .tpl-card__cover { background: linear-gradient(135deg, #10b981, #047857); }
.tpl-card[data-domain="clothing"] .tpl-card__cover { background: linear-gradient(135deg, #d4af37, #9c7d18); }

.tpl-card__body {
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
}

.tpl-card__title {
    font-size: 19px;
    font-weight: 800;
    margin: 0;
}

.tpl-card__desc {
    margin: 0;
    font-size: 14.5px;
    color: var(--g-muted);
    flex: 1;
}

.tpl-card__btn {
    margin-top: 6px;
    width: 100%;
    font: inherit;
    font-weight: 700;
    font-size: 15px;
    padding: 12px 18px;
    border-radius: 999px;
    border: 0;
    cursor: pointer;
    color: #fff;
    background: linear-gradient(135deg, var(--g-primary), var(--g-primary-dark));
    box-shadow: var(--g-shadow-sm);
    transition: transform .2s var(--g-ease), box-shadow .2s var(--g-ease);
}

.tpl-card__btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--g-shadow-glow);
}

/* ============================================================
 * التذييل
 * ============================================================ */
.site-foot {
    margin-top: 40px;
    padding-block: 36px;
    border-top: 1px solid var(--g-line);
    text-align: center;
    color: var(--g-muted);
    font-size: 14px;
}

/* ============================================================
 * الاستجابة وإمكانية الوصول
 * ============================================================ */
@media (max-width: 900px) {
    .studio {
        grid-template-columns: 1fr;
    }

    .studio__preview {
        position: static;
        order: -1;
    }
}

@media (max-width: 640px) {
    .bento {
        grid-template-columns: 1fr;
    }

    .site-head__cta span {
        display: none;
    }

    /* قسم المعاينة الحيّة على الموبايل: نضغط المساحات ونصغّر شريحة الاسم
       حتى لا تبان كبيرة فارغة أو يتجاوز الشعار حدود الإطار. */
    .studio__preview {
        padding: 18px;
    }

    .preview-chip {
        min-height: 92px;
        padding: 16px;
    }

    .preview-chip__img {
        max-height: 64px;
    }

    .preview-chip__text {
        font-size: 19px;
        padding: 9px 16px;
        max-width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
    }
}
