/* =====================================================================
 * Yaghut — باکس «انتقادات و پیشنهادات» + پنجره‌ی فرم
 *   .yfb--card : ستونی (کنار گاه‌شمار)   .yfb--wide : افقی (انتهای صفحه)
 * ===================================================================== */

.yfb,
.yfb-modal {
    --fb-primary: #bc2050;
    --fb-primary-dark: #880f35;
    --fb-navy: #344258;
    --fb-ink: #1f2633;
    --fb-muted: #6b7280;
    --fb-line: rgba(52, 66, 88, .12);
    --fb-soft: #fbf4f6;
    direction: rtl;
    text-align: right;
}
.yfb *, .yfb-modal * { box-sizing: border-box; }
.yfb a { text-decoration: none; }
.yfb-modal [hidden] { display: none !important; }

/* ---------------- باکس ---------------- */
.yfb {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    height: 100%;
    padding: 1.25rem;
    color: var(--fb-ink);
    background: rgba(255, 255, 255, .96);
    border: 1px solid var(--fb-line);
    border-radius: 20px;
    box-shadow: 0 18px 38px -30px rgba(52, 66, 88, .6);
}
.yfb__head { padding-bottom: .85rem; border-bottom: 1px solid var(--fb-line); }
.yfb__title {
    margin: 0;
    color: var(--fb-navy);
    font-size: 1.15rem;
    font-weight: 900;
    font-variation-settings: "wght" 900;
    line-height: 1.6;
}
.yfb__sub { margin: .15rem 0 0; color: var(--fb-muted); font-size: .82rem; font-weight: 700; line-height: 1.8; }

.yfb__options { display: flex; flex-direction: column; gap: .6rem; }
.yfb__opt {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .75rem .8rem;
    color: var(--fb-ink) !important;
    background: #fff;
    border: 1px solid var(--fb-line);
    border-radius: 14px;
    transition: border-color .15s ease, background-color .15s ease, transform .15s ease;
}
.yfb__opt:hover,
.yfb__opt:focus-visible { background: var(--fb-soft); border-color: rgba(188, 32, 80, .35); outline: 0; transform: translateX(-2px); }
.yfb__opt-icon {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    color: var(--fb-primary);
    font-size: 1.1rem;
    background: rgba(188, 32, 80, .08);
    border-radius: 12px;
    transition: background-color .15s ease, color .15s ease;
}
.yfb__opt:hover .yfb__opt-icon { color: #fff; background: var(--fb-primary); }
.yfb__opt-text { min-width: 0; display: flex; flex-direction: column; }
.yfb__opt-text b { font-size: .92rem; font-weight: 900; line-height: 1.7; }
.yfb__opt-text small { color: var(--fb-muted); font-size: .76rem; font-weight: 700; line-height: 1.7; }

.yfb__cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    margin-top: auto;
    padding: .75rem 1rem;
    color: #fff !important;
    font-weight: 900;
    background: var(--fb-primary);
    border-radius: 12px;
    box-shadow: 0 12px 24px -16px rgba(188, 32, 80, .9);
    transition: background-color .15s ease, transform .15s ease;
}
.yfb__cta:hover { background: var(--fb-primary-dark); transform: translateY(-1px); }

/* افقی: سربرگ و دکمه یک طرف، کارت‌ها در شبکه */
.yfb--wide {
    display: grid;
    grid-template-columns: 15rem minmax(0, 1fr);
    grid-template-areas: "head opts" "cta opts";
    gap: 1rem 1.5rem;
    padding: 1.5rem;
}
.yfb--wide .yfb__head { grid-area: head; padding-bottom: 0; border-bottom: 0; }
.yfb--wide .yfb__title { font-size: 1.3rem; }
.yfb--wide .yfb__options { grid-area: opts; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.yfb--wide .yfb__cta { grid-area: cta; align-self: end; }

/* ---------------- پنجره ---------------- */
html.yfb-open { overflow: hidden; }
.yfb-modal {
    width: min(560px, calc(100% - 2rem));
    max-width: none;
    max-height: calc(100dvh - 2rem);
    margin: auto;
    padding: 0;
    color: var(--fb-ink);
    background: #fff;
    border: 0;
    border-radius: 20px;
    box-shadow: 0 30px 70px -20px rgba(31, 38, 51, .55);
}
.yfb-modal::backdrop { background: rgba(31, 38, 51, .5); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.yfb-modal[open] { animation: yfb-in .18s ease-out; }
@keyframes yfb-in { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }

.yfb-modal__head {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: #fff;
    border-bottom: 1px solid var(--fb-line);
}
.yfb-modal__title { margin: 0; color: var(--fb-navy); font-size: 1.1rem; font-weight: 900; font-variation-settings: "wght" 900; }
.yfb-modal__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    color: var(--fb-muted);
    font-size: 1rem;
    background: #f3f4f6;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
}
.yfb-modal__close:hover { color: var(--fb-primary); }

.yfb-form, .yfb-done { padding: 1rem 1.25rem 1.25rem; }
.yfb-form__types { margin: 0 0 .9rem; padding: 0; border: 0; min-width: 0; }
.yfb-form__label { display: block; margin-bottom: .35rem; padding: 0; color: var(--fb-navy); font-size: .85rem; font-weight: 800; }
.yfb-req { color: var(--fb-primary); }
.yfb-form__type-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .45rem; }
.yfb-type { position: relative; cursor: pointer; }
.yfb-type input { position: absolute; opacity: 0; pointer-events: none; }
.yfb-type span {
    display: flex;
    align-items: center;
    gap: .45rem;
    padding: .6rem .75rem;
    color: var(--fb-navy);
    font-size: .88rem;
    font-weight: 800;
    background: #fff;
    border: 1.5px solid var(--fb-line);
    border-radius: 12px;
    transition: border-color .15s ease, background-color .15s ease, color .15s ease;
}
.yfb-type span .fa { color: var(--fb-primary); }
.yfb-type:hover span { border-color: rgba(188, 32, 80, .35); }
.yfb-type input:checked + span { color: var(--fb-primary-dark); background: var(--fb-soft); border-color: var(--fb-primary); }
.yfb-type input:focus-visible + span { outline: 2px solid var(--fb-primary); outline-offset: 2px; }

.yfb-form__source {
    display: flex;
    align-items: center;
    gap: .4rem;
    margin: 0 0 .9rem;
    padding: .45rem .75rem;
    color: var(--fb-muted);
    font-size: .8rem;
    font-weight: 700;
    background: #f6f7f9;
    border-radius: 10px;
}
.yfb-form__source b { min-width: 0; overflow: hidden; color: var(--fb-navy); white-space: nowrap; text-overflow: ellipsis; }

.yfb-form__row { margin-bottom: .85rem; min-width: 0; }
.yfb-form__cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 .75rem; }
.yfb-input {
    display: block;
    width: 100%;
    min-height: 2.75rem;
    padding: .55rem .8rem;
    color: var(--fb-ink);
    font: inherit;
    font-size: 1rem;                      /* ≥ 16px: iOS بزرگ‌نمایی نکند */
    font-weight: 600;
    background: #fff;
    border: 1.5px solid #dfe3ea;
    border-radius: 12px;
    box-shadow: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.yfb-input::placeholder { color: #a0a7b4; font-weight: 500; }
.yfb-input:focus { border-color: var(--fb-primary); outline: 0; box-shadow: 0 0 0 3px rgba(188, 32, 80, .12); }
.yfb-input.is-invalid { border-color: #d64545; }
.yfb-textarea { min-height: 7.5rem; resize: vertical; line-height: 1.9; }
.yfb-form__error { margin: .3rem 0 0; color: #c53030; font-size: .78rem; font-weight: 700; }
.yfb-form__error:empty { display: none; }

.yfb-captcha { display: flex; align-items: center; gap: .5rem; }
.yfb-captcha .yfb-input { flex: 1 1 auto; min-width: 0; }
.yfb-captcha__img {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 7.5rem;
    height: 2.75rem;
    overflow: hidden;
    color: var(--fb-muted);
    font-size: .75rem;
    background: #f6f7f9;
    border-radius: 10px;
}
.yfb-captcha__img.is-loading { opacity: .5; }
.yfb-captcha__img img { display: block; max-height: 100%; width: auto; }
.yfb-captcha__refresh {
    flex: 0 0 auto;
    width: 2.75rem;
    height: 2.75rem;
    color: var(--fb-primary);
    background: rgba(188, 32, 80, .08);
    border: 0;
    border-radius: 10px;
    cursor: pointer;
}
.yfb-captcha__refresh:hover { color: #fff; background: var(--fb-primary); }

.yfb-form__alert {
    margin: 0 0 .85rem;
    padding: .6rem .8rem;
    color: #9b2c2c;
    font-size: .85rem;
    font-weight: 700;
    background: #fdf0f0;
    border-radius: 10px;
}

.yfb-form__submit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    width: 100%;
    min-height: 3rem;
    padding: .65rem 1rem;
    color: #fff;
    font: inherit;
    font-weight: 900;
    background: var(--fb-primary);
    border: 0;
    border-radius: 12px;
    cursor: pointer;
    transition: background-color .15s ease;
}
.yfb-form__submit:hover { background: var(--fb-primary-dark); }
.yfb-form__submit:disabled { opacity: .7; cursor: wait; }
.yfb-spinner {
    display: none;
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(255, 255, 255, .4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: yfb-spin .7s linear infinite;
}
.yfb-form__submit.is-loading .yfb-spinner { display: inline-block; }
@keyframes yfb-spin { to { transform: rotate(360deg); } }

.yfb-done { padding: 2rem 1.25rem 1.5rem; text-align: center; }
.yfb-done__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 4rem;
    height: 4rem;
    color: #fff;
    font-size: 1.6rem;
    background: linear-gradient(145deg, #2f9e66, #1d7348);
    border-radius: 50%;
    box-shadow: 0 0 0 8px rgba(29, 115, 72, .12);
}
.yfb-done__title { margin: 1.1rem 0 .3rem; color: var(--fb-navy); font-size: 1.15rem; font-weight: 900; }
.yfb-done__text { margin: 0 0 1.25rem; color: var(--fb-muted); font-weight: 700; line-height: 1.9; }

/* ---------------- موبایل ---------------- */
@media (max-width: 1023px) {
    .yfb--wide { grid-template-columns: 1fr; grid-template-areas: "head" "opts" "cta"; }
}
@media (max-width: 768px) {
    .yfb { padding: 1rem; }
    .yfb--wide .yfb__options { grid-template-columns: 1fr; }
    .yfb__opt { padding: .65rem .7rem; }

    /* پنجره: از پایین صفحه (bottom sheet) */
    .yfb-modal {
        width: 100%;
        max-height: 92dvh;
        margin: auto 0 0;
        border-radius: 20px 20px 0 0;
    }
    .yfb-modal[open] { animation-name: yfb-up; }
    @keyframes yfb-up { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
    .yfb-form { padding-bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px)); }
    .yfb-form__cols { grid-template-columns: 1fr; }
    .yfb-type span { padding: .55rem .6rem; font-size: .82rem; }
}

@media (prefers-reduced-motion: reduce) {
    .yfb-modal[open] { animation: none; }
}
