/* ========================================== */
/* فرماتیله - استایل‌های فرانت‌اند              */
/* ========================================== */

/* ========== WRAPPER ========== */
.ft-front-wrapper {
    max-width: 720px;
    margin: 40px auto;
    direction: rtl;
    font-family: 'Vazirmatn', 'Tahoma', sans-serif;
    padding: 0 16px;
    box-sizing: border-box;
}

/* ========== FORM CONTAINER ========== */
.ft-front-form {
    background: #fff;
    border-radius: 20px;
    padding: 40px 36px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03), 0 12px 50px rgba(0, 0, 0, 0.05);
    border: 1px solid #f0e0d0;
    position: relative;
    overflow: hidden;
}

.ft-front-form::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, var(--ft-c), var(--ft-cd), var(--ft-c));
    border-radius: 20px 20px 0 0;
}

/* ========== HEADER ========== */
.ft-front-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 2px solid #fefaf6;
}

.ft-front-icon {
    width: 52px;
    height: 52px;
    background: var(--ft-cl);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ft-c);
    flex-shrink: 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04);
}

.ft-front-title {
    font-size: 20px;
    font-weight: 800;
    color: #2c1810;
    margin: 0;
    letter-spacing: -0.3px;
}

.ft-front-subtitle {
    font-size: 13px;
    color: #8b6b5e;
    margin: 4px 0 0;
    font-weight: 400;
}

/* ========== ROW & FIELD ========== */
.ft-front-row {
    display: grid;
    gap: 18px;
    margin-bottom: 18px;
}

.ft-front-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.ft-front-full {
    grid-column: 1 / -1 !important;
}

/* ========== LABEL ========== */
.ft-front-label {
    font-size: 13px;
    font-weight: 700;
    color: #2c1810;
    display: flex;
    align-items: center;
    gap: 5px;
}

.ft-front-req {
    color: var(--ft-c);
    font-size: 16px;
    font-weight: 700;
}

/* ========== INPUTS ========== */
.ft-front-input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #f0e0d0;
    border-radius: 14px;
    font-size: 14px;
    font-family: inherit;
    background: #fefaf6;
    color: #2c1810;
    transition: all 0.3s ease;
    box-sizing: border-box;
    outline: none;
}

.ft-front-input:hover {
    border-color: #e0d0c0;
    background: #fffdfa;
}

.ft-front-input:focus {
    border-color: var(--ft-c);
    background: #fff;
    box-shadow: 0 0 0 5px rgba(192, 57, 43, 0.06), 0 4px 15px rgba(0, 0, 0, 0.03);
    transform: translateY(-1px);
}

.ft-front-input::placeholder {
    color: #c4a88c;
    font-size: 13px;
    opacity: 0.8;
}

/* ========== TEXTAREA ========== */
.ft-front-ta {
    min-height: 120px;
    resize: vertical;
    line-height: 1.9;
    padding-top: 14px;
}

/* ========== SELECT ========== */
.ft-front-select {
    appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23c4a88c' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 16px center;
    padding-left: 48px;
}

/* ========== OPTIONS (CHECKBOX / RADIO) ========== */
.ft-front-opts {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ft-front-opt {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-size: 14px;
    color: #2c1810;
    padding: 13px 16px;
    border: 2px solid #f0e0d0;
    border-radius: 14px;
    transition: all 0.3s ease;
    background: #fefaf6;
}

.ft-front-opt:hover {
    border-color: var(--ft-c);
    transform: translateX(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.ft-front-opt input {
    display: none;
}

.ft-front-check {
    width: 22px;
    height: 22px;
    border: 2px solid #d4c4b0;
    border-radius: 8px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    background: #fff;
}

.ft-front-opt input[type="radio"] ~ .ft-front-check {
    border-radius: 50%;
}

.ft-front-opt input:checked ~ .ft-front-check {
    background: var(--ft-c);
    border-color: var(--ft-c);
    box-shadow: 0 0 0 4px rgba(192, 57, 43, 0.15);
}

.ft-front-opt input:checked ~ .ft-front-check::after {
    content: '';
    width: 10px;
    height: 10px;
    background: #fff;
    border-radius: 3px;
    animation: ftCheckPop 0.3s ease;
}

.ft-front-opt input[type="radio"]:checked ~ .ft-front-check::after {
    border-radius: 50%;
}

@keyframes ftCheckPop {
    0%   { transform: scale(0); }
    50%  { transform: scale(1.3); }
    100% { transform: scale(1); }
}

/* ========== RATE (STARS) ========== */
.ft-front-rate {
    direction: rtl;
    display: flex;
    gap: 6px;
}

.ft-front-rate input {
    display: none;
}

.ft-front-rate label {
    font-size: 32px;
    color: #ddd;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ft-front-rate label:hover {
    transform: scale(1.2);
}

.ft-front-rate input:checked ~ label,
.ft-front-rate label:hover,
.ft-front-rate label:hover ~ label {
    color: #ffc107;
}

/* ========== CAPTCHA ========== */
.ft-front-captcha {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    background: linear-gradient(135deg, #fefaf6, #fdf6f0);
    border-radius: 14px;
    border: 1px solid #f0e0d0;
}

.ft-front-captcha-q {
    font-size: 20px;
    font-weight: 800;
    color: #2c1810;
    background: #fff;
    padding: 6px 14px;
    border-radius: 10px;
    border: 2px solid #f0e0d0;
    letter-spacing: 2px;
}

/* ========== INLINE FORM ========== */
.ft-front-inline {
    display: flex;
    gap: 12px;
    align-items: stretch;
}

/* ========== BUTTONS ========== */
.ft-front-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 28px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--ft-c), var(--ft-cd));
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    flex-shrink: 0;
    box-shadow: 0 6px 20px rgba(192, 57, 43, 0.25);
}

.ft-front-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 35px rgba(192, 57, 43, 0.35);
}

.ft-front-btn:active {
    transform: translateY(-1px);
}

.ft-front-submit {
    width: 100%;
    margin-top: 28px;
    padding: 16px;
    border-radius: 16px;
    font-size: 16px;
    letter-spacing: 0.3px;
}

/* ========== MESSAGE ========== */
.ft-front-msg {
    margin-top: 20px;
    padding: 16px 20px;
    border-radius: 14px;
    display: none;
    font-size: 14px;
    text-align: center;
    font-weight: 600;
}

.ft-front-msg.s {
    display: block;
    background: linear-gradient(135deg, #eafaf1, #e4f7ec);
    color: #1e7e34;
    border: 1px solid #b7e4c7;
}

.ft-front-msg.e {
    display: block;
    background: linear-gradient(135deg, #fdedec, #fdf0ef);
    color: var(--ft-c);
    border: 1px solid #f5c6cb;
}

/* ========================================== */
/* CONDITIONAL LOGIC                          */
/* ========================================== */

/* 
 * نکته مهم: فیلدهای شرطی با inline style="display:none" 
 * در HTML مخفی میشن. این کلاس فقط برای انیمیشن استفاده میشه.
 */
.ft-conditional.ft-visible {
    display: flex !important;
    flex-direction: column;
    gap: 8px;
    animation: ftCondReveal 0.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes ftCondReveal {
    from {
        opacity: 0;
        transform: translateY(-12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================== */
/* RESPONSIVE                                 */
/* ========================================== */

@media (max-width: 768px) {
    .ft-front-wrapper {
        max-width: 100%;
        margin: 12px;
        padding: 0;
    }

    .ft-front-form {
        border-radius: 18px;
        padding: 24px 16px;
    }

    .ft-front-row {
        grid-template-columns: 1fr !important;
        gap: 14px;
    }

    .ft-front-header {
        gap: 12px;
        margin-bottom: 24px;
        padding-bottom: 16px;
    }

    .ft-front-icon {
        width: 44px;
        height: 44px;
        border-radius: 14px;
    }

    .ft-front-title {
        font-size: 18px;
    }

    .ft-front-input {
        padding: 14px 16px;
        font-size: 16px;
        border-radius: 12px;
    }

    .ft-front-input::placeholder {
        font-size: 14px;
    }

    .ft-front-inline {
        flex-direction: column;
    }

    .ft-front-btn {
        width: 100%;
        justify-content: center;
    }

    .ft-front-submit {
        font-size: 16px;
        padding: 15px;
    }

    .ft-front-opt {
        padding: 14px 16px;
    }

    .ft-front-check {
        width: 24px;
        height: 24px;
    }
}

@media (max-width: 480px) {
    .ft-front-form {
        padding: 20px 12px;
        border-radius: 16px;
    }

    .ft-front-rate label {
        font-size: 28px;
    }

    .ft-front-captcha {
        flex-direction: column;
        align-items: flex-start;
    }

    .ft-front-captcha-q {
        font-size: 18px;
    }
}