/* =====================================================================
   فرم «تماس با ما» (انتهای صفحه‌ی اصلی + صفحه‌ی /contact-us) و مودال موفقیت
   رنگ‌ها از متغیرهای تم سایت می‌آیند تا با تغییر رنگ در «تنظیمات سایت» هماهنگ بمانند.
   ===================================================================== */

.cu-section {
    --cu-a: var(--color-primary-dark, #4338ca);
    --cu-b: var(--color-primary, #6366f1);
    --cu-c: var(--color-accent, #8b5cf6);
    position: relative;
    isolation: isolate;
    max-width: 1020px;
    margin: 3.5rem auto;
    padding: 0 1rem;
}

.cu-standalone {
    margin-top: 1.25rem;
    margin-bottom: 3rem;
}

/* ---------- حباب‌های رنگی پس‌زمینه ---------- */
.cu-blob {
    position: absolute;
    z-index: -1;
    border-radius: 50%;
    filter: blur(60px);
    opacity: .5;
    pointer-events: none;
    animation: cu-float 14s ease-in-out infinite;
}

.cu-blob-1 {
    width: 260px;
    height: 260px;
    top: -50px;
    inset-inline-start: -40px;
    background: var(--cu-c);
}

.cu-blob-2 {
    width: 300px;
    height: 300px;
    bottom: -70px;
    inset-inline-end: -50px;
    background: var(--cu-b);
    animation-delay: -5s;
}

.cu-blob-3 {
    width: 180px;
    height: 180px;
    top: 40%;
    inset-inline-start: 45%;
    background: #38bdf8;
    opacity: .28;
    animation-delay: -9s;
}

@keyframes cu-float {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }

    33% {
        transform: translate(24px, -20px) scale(1.08);
    }

    66% {
        transform: translate(-18px, 18px) scale(.95);
    }
}

/* ---------- کارت اصلی ---------- */
.cu-card {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    overflow: hidden;
    background: rgba(255, 255, 255, .9);
    border: 1px solid rgba(255, 255, 255, .8);
    border-radius: 28px;
    box-shadow: 0 25px 60px -15px rgba(67, 56, 202, .35), 0 6px 18px rgba(67, 56, 202, .08);
    animation: cu-rise .8s cubic-bezier(.2, .8, .2, 1) both;
}

@keyframes cu-rise {
    from {
        opacity: 0;
        transform: translateY(34px) scale(.98);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

/* ---------- ستون گرادیانتی ---------- */
.cu-aside {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1rem;
    padding: 2.6rem 2.2rem;
    color: #fff;
    overflow: hidden;
    background: linear-gradient(145deg, var(--cu-a) 0%, var(--cu-b) 55%, var(--cu-c) 100%);
    background-size: 160% 160%;
    animation: cu-gradient 12s ease-in-out infinite;
}

@keyframes cu-gradient {
    0%, 100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

.cu-ring {
    position: absolute;
    border: 2px solid rgba(255, 255, 255, .22);
    border-radius: 50%;
    pointer-events: none;
}

.cu-ring-1 {
    width: 260px;
    height: 260px;
    bottom: -90px;
    inset-inline-end: -80px;
    animation: cu-pulse 6s ease-in-out infinite;
}

.cu-ring-2 {
    width: 160px;
    height: 160px;
    top: -50px;
    inset-inline-start: -40px;
    animation: cu-pulse 7s ease-in-out infinite -2s;
}

@keyframes cu-pulse {
    0%, 100% {
        transform: scale(1);
        opacity: .9;
    }

    50% {
        transform: scale(1.12);
        opacity: .4;
    }
}

.cu-envelope {
    width: 82px;
    height: 82px;
    padding: 18px;
    margin-bottom: .4rem;
    color: #fff;
    background: rgba(255, 255, 255, .18);
    border: 1px solid rgba(255, 255, 255, .35);
    border-radius: 24px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, .18);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    animation: cu-bob 4.5s ease-in-out infinite;
}

    .cu-envelope svg {
        display: block;
        width: 100%;
        height: 100%;
    }

@keyframes cu-bob {
    0%, 100% {
        transform: translateY(0) rotate(-3deg);
    }

    50% {
        transform: translateY(-10px) rotate(3deg);
    }
}

.cu-title {
    margin: 0;
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.3;
    color: #fff;
}

.cu-sub {
    margin: 0;
    font-size: 1rem;
    line-height: 2;
    color: rgba(255, 255, 255, .88);
}

.cu-points {
    display: flex;
    flex-direction: column;
    gap: .85rem;
    margin: .9rem 0 0;
    padding: 0;
    list-style: none;
}

    .cu-points li {
        display: flex;
        align-items: center;
        gap: .75rem;
        font-size: .95rem;
        opacity: 0;
        animation: cu-slide .6s ease-out forwards;
    }

        .cu-points li:nth-child(1) {
            animation-delay: .45s;
        }

        .cu-points li:nth-child(2) {
            animation-delay: .6s;
        }

        .cu-points li:nth-child(3) {
            animation-delay: .75s;
        }

@keyframes cu-slide {
    from {
        opacity: 0;
        transform: translateX(18px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

[dir="ltr"] .cu-points li {
    animation-name: cu-slide-ltr;
}

@keyframes cu-slide-ltr {
    from {
        opacity: 0;
        transform: translateX(-18px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

.cu-point-ico {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    font-size: 1rem;
    background: rgba(255, 255, 255, .2);
    border-radius: 12px;
}

/* ---------- ستون فرم ---------- */
.cu-main {
    padding: 2.6rem 2.4rem;
}

.cu-form {
    display: flex;
    flex-direction: column;
    gap: 1.35rem;
}

.cu-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.2rem;
}

.cu-field {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    min-width: 0;
    opacity: 0;
    animation: cu-up .55s ease-out forwards;
}

.cu-form > .cu-row:nth-of-type(1) .cu-field:nth-child(1) {
    animation-delay: .25s;
}

.cu-form > .cu-row:nth-of-type(1) .cu-field:nth-child(2) {
    animation-delay: .33s;
}

.cu-form > .cu-row:nth-of-type(2) .cu-field:nth-child(1) {
    animation-delay: .41s;
}

.cu-form > .cu-row:nth-of-type(2) .cu-field:nth-child(2) {
    animation-delay: .49s;
}

.cu-form > .cu-field {
    animation-delay: .57s;
}

@keyframes cu-up {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

.cu-field label {
    font-size: .9rem;
    font-weight: 700;
    color: #3b3668;
}

/* ---------- ورودی‌ها ---------- */
.cu-control {
    position: relative;
    display: flex;
    align-items: center;
}

.cu-ico {
    position: absolute;
    top: 50%;
    z-index: 1;
    width: 20px;
    height: 20px;
    color: #a29cc9;
    transform: translateY(-50%);
    pointer-events: none;
    transition: color .2s, transform .2s;
}

/* آیکون در حالت RTL (پیش‌فرض): سمت راست با فاصله‌ی 1.1rem از لبه */
.cu-control:not([dir="ltr"]) .cu-ico {
    right: 1.1rem;
    left: auto;
}

/* آیکون در حالت LTR (فیلدهای تلفن و ایمیل): سمت چپ با فاصله‌ی 1.1rem از لبه */
.cu-control[dir="ltr"] .cu-ico {
    left: 1.1rem;
    right: auto;
}

.cu-ico svg {
    display: block;
    width: 100%;
    height: 100%;
}

.cu-control-area {
    align-items: flex-start;
}

    .cu-control-area .cu-ico {
        top: 1.15rem;
        transform: none;
    }

.cu-input {
    width: 100%;
    padding: .85rem 1rem;
    font: inherit;
    font-size: .98rem;
    color: #1f1b3a;
    background: #f7f6fd;
    border: 1.5px solid #e4e0f7;
    border-radius: 16px;
    transition: border-color .2s, box-shadow .2s, background-color .2s, transform .2s;
}

/* در حالت RTL (پیش‌فرض): متن از راست 3.4rem فاصله می‌گیرد */
.cu-control:not([dir="ltr"]) .cu-input {
    padding-right: 3.4rem;
    padding-left: 1rem;
}

/* در حالت LTR (تلفن و ایمیل): متن از چپ 3.4rem فاصله می‌گیرد */
.cu-control[dir="ltr"] .cu-input {
    padding-left: 3.4rem;
    padding-right: 1rem;
}

/* textarea داخل control-area */
.cu-control-area:not([dir="ltr"]) .cu-input {
    padding-right: 3.4rem;
    padding-left: 1rem;
}

.cu-control-area[dir="ltr"] .cu-input {
    padding-left: 3.4rem;
    padding-right: 1rem;
}

.cu-input::placeholder {
    color: #b3aed3;
}

.cu-input:hover {
    border-color: #cfc9f0;
}

.cu-input:focus {
    outline: none;
    background: #fff;
    border-color: var(--cu-b);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--cu-b) 18%, transparent), 0 8px 20px -8px color-mix(in srgb, var(--cu-b) 45%, transparent);
    transform: translateY(-1px);
}

.cu-control:focus-within .cu-ico {
    color: var(--cu-b);
    transform: translateY(-50%) scale(1.12);
}

.cu-control-area:focus-within .cu-ico {
    transform: scale(1.12);
}

.cu-input.invalid {
    border-color: #ef4444;
    background: #fff7f7;
}

    .cu-input.invalid:focus {
        box-shadow: 0 0 0 4px rgba(239, 68, 68, .15);
    }

.cu-textarea {
    min-height: 140px;
    line-height: 1.9;
    resize: vertical;
}

.cu-meta {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .75rem;
}

.cu-counter {
    margin-inline-start: auto;
    font-size: .78rem;
    color: #9b97bd;
    white-space: nowrap;
    transition: color .2s;
}

    .cu-counter.is-warn {
        color: #d97706;
        font-weight: 700;
    }

.cu-section .validation-message {
    margin-top: .1rem;
    font-size: .8rem;
    color: #dc2626;
    animation: cu-shake .35s ease-in-out;
}

@keyframes cu-shake {
    0%, 100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-4px);
    }

    75% {
        transform: translateX(4px);
    }
}

/* تله‌ی ربات‌ها: بیرون از صفحه، نه display:none */
.cu-trap {
    position: absolute;
    inset-inline-start: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* ---------- دکمه ---------- */
.cu-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .65rem;
    align-self: flex-start;
    min-width: 190px;
    padding: .9rem 2.2rem;
    overflow: hidden;
    font: inherit;
    font-size: 1rem;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(135deg, var(--cu-a), var(--cu-b) 55%, var(--cu-c));
    background-size: 160% 160%;
    border: 0;
    border-radius: 16px;
    box-shadow: 0 14px 28px -10px color-mix(in srgb, var(--cu-b) 70%, transparent);
    cursor: pointer;
    transition: transform .2s, box-shadow .2s, background-position .4s;
    animation: cu-up .55s ease-out .65s both;
}

    .cu-btn::after {
        content: "";
        position: absolute;
        inset: 0;
        background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .45) 50%, transparent 70%);
        transform: translateX(-120%);
    }

    .cu-btn:hover:not(:disabled) {
        transform: translateY(-3px);
        background-position: 100% 50%;
        box-shadow: 0 20px 34px -10px color-mix(in srgb, var(--cu-b) 80%, transparent);
    }

        .cu-btn:hover:not(:disabled)::after {
            transform: translateX(120%);
            transition: transform .8s ease;
        }

    .cu-btn:active:not(:disabled) {
        transform: translateY(0);
    }

    .cu-btn:disabled {
        opacity: .75;
        cursor: not-allowed;
    }

    .cu-btn:focus-visible {
        outline: 3px solid color-mix(in srgb, var(--cu-b) 45%, transparent);
        outline-offset: 3px;
    }

.cu-btn-arrow {
    width: 20px;
    height: 20px;
    transition: transform .3s;
}

[dir="rtl"] .cu-btn-arrow {
    transform: scaleX(-1);
}

.cu-btn:hover .cu-btn-arrow {
    transform: translate(-4px, -4px);
}

[dir="rtl"] .cu-btn:hover .cu-btn-arrow {
    transform: scaleX(-1) translate(-4px, -4px);
}

.cu-spinner {
    width: 1.1rem;
    height: 1.1rem;
    border: 2.5px solid rgba(255, 255, 255, .45);
    border-top-color: #fff;
    border-radius: 50%;
    animation: cu-spin .7s linear infinite;
}

@keyframes cu-spin {
    to {
        transform: rotate(360deg);
    }
}

.cu-alert {
    padding: .85rem 1.1rem;
    font-size: .92rem;
    border-radius: 14px;
}

.cu-alert-error {
    color: #991b1b;
    background: #fee2e2;
    border: 1px solid #fca5a5;
    animation: cu-shake .35s ease-in-out;
}

/* =====================================================================
   مودال موفقیت
   ===================================================================== */
.cu-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: grid;
    place-items: center;
    padding: 1rem;
    background: rgba(24, 20, 56, .55);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    animation: cu-fade .25s ease-out both;
}

@keyframes cu-fade {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.cu-modal {
    position: relative;
    width: min(440px, 100%);
    padding: 2.6rem 2rem 2rem;
    overflow: hidden;
    text-align: center;
    background: linear-gradient(180deg, #ffffff 0%, #f7f5ff 100%);
    border: 1px solid #fff;
    border-radius: 28px;
    box-shadow: 0 40px 80px -20px rgba(24, 20, 56, .6);
    animation: cu-pop .55s cubic-bezier(.34, 1.56, .64, 1) both;
}

@keyframes cu-pop {
    from {
        opacity: 0;
        transform: translateY(40px) scale(.85);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

/* ---------- تیک متحرک ---------- */
.cu-check {
    width: 96px;
    height: 96px;
    margin: 0 auto 1.2rem;
    padding: 10px;
    background: linear-gradient(135deg, #34d399, #10b981);
    border-radius: 50%;
    box-shadow: 0 16px 34px -8px rgba(16, 185, 129, .6);
    animation: cu-check-pop .6s cubic-bezier(.34, 1.56, .64, 1) .15s both;
}

    .cu-check svg {
        display: block;
        width: 100%;
        height: 100%;
    }

.cu-check-circle {
    stroke: rgba(255, 255, 255, .55);
    stroke-width: 2.5;
    stroke-dasharray: 145;
    stroke-dashoffset: 145;
    animation: cu-draw .6s ease-out .3s forwards;
}

.cu-check-mark {
    stroke: #fff;
    stroke-width: 4.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 40;
    stroke-dashoffset: 40;
    animation: cu-draw .45s ease-out .65s forwards;
}

@keyframes cu-draw {
    to {
        stroke-dashoffset: 0;
    }
}

@keyframes cu-check-pop {
    from {
        opacity: 0;
        transform: scale(.3);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.cu-modal-title {
    margin: 0 0 .6rem;
    font-size: 1.4rem;
    font-weight: 800;
    color: #1f1b3a;
    animation: cu-up .5s ease-out .5s both;
}

.cu-modal-text {
    margin: 0 0 1.6rem;
    font-size: .96rem;
    line-height: 2;
    color: #5f5a86;
    animation: cu-up .5s ease-out .6s both;
}

.cu-modal-btn {
    align-self: center;
    min-width: 150px;
    margin-inline: auto;
    animation-delay: .7s;
    color: black;
}

/* ---------- کاغذ رنگی ---------- */
.cu-confetti {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

    .cu-confetti span {
        position: absolute;
        top: 38px;
        inset-inline-start: 50%;
        width: 9px;
        height: 14px;
        border-radius: 3px;
        opacity: 0;
        background: hsl(calc(var(--i) * 26), 85%, 60%);
        animation: cu-confetti 1.3s ease-out .35s forwards;
    }

        .cu-confetti span:nth-child(odd) {
            width: 10px;
            height: 10px;
            border-radius: 50%;
        }

@keyframes cu-confetti {
    0% {
        opacity: 1;
        transform: translate(0, 0) rotate(0);
    }

    100% {
        opacity: 0;
        transform: translate(calc((var(--i) - 7) * 24px), calc(80px + (var(--i) mod 4) * 55px)) rotate(calc(var(--i) * 80deg));
    }
}

/* ---------- ستون «متن پیام» در جدول ادمین ---------- */
.cu-admin-msg {
    max-width: 340px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---------- جای‌نگهدار فرم تا قبل از اتصال مدار (پیش‌رندر) ---------- */
.cu-form-loading {
    display: grid;
    place-items: center;
    min-height: 320px;
    font-size: .95rem;
    color: #9b97bd;
}

/* ---------- واکنش‌گرا ---------- */
@media (max-width: 860px) {
    .cu-card {
        grid-template-columns: 1fr;
        border-radius: 24px;
    }

    .cu-aside {
        padding: 2rem 1.6rem;
        gap: .75rem;
    }

    .cu-envelope {
        width: 66px;
        height: 66px;
        padding: 14px;
        border-radius: 20px;
    }

    .cu-title {
        font-size: 1.6rem;
    }

    .cu-points {
        flex-direction: row;
        flex-wrap: wrap;
        gap: .6rem .9rem;
        margin-top: .4rem;
    }

    .cu-main {
        padding: 2rem 1.5rem 2.2rem;
    }
}

@media (max-width: 560px) {
    .cu-section {
        margin: 2rem auto;
        padding: 0 .65rem;
    }

    .cu-row {
        grid-template-columns: 1fr;
        gap: 1.35rem;
    }

    .cu-main {
        padding: 1.6rem 1.15rem 1.8rem;
    }

    .cu-btn {
        align-self: stretch;
    }

    .cu-points li {
        font-size: .88rem;
    }
}

/* کاربرانی که انیمیشن کم را انتخاب کرده‌اند */
@media (prefers-reduced-motion: reduce) {
    .cu-section *, .cu-modal-backdrop, .cu-modal, .cu-modal * {
        animation-duration: .01ms !important;
        animation-delay: 0s !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }

    .cu-field, .cu-points li, .cu-btn {
        opacity: 1;
    }
}
