/**
 * ============================================================
 * CONTACT.CSS
 * ============================================================
 *
 * استایل اختصاصی بخش Contact و فرم تماس
 *
 * امکانات:
 * - طراحی Glassmorphism
 * - ورودی‌های حرفه‌ای
 * - Focus Effect
 * - دکمه ارسال متحرک
 * - حالت Loading
 * - Toast موفقیت
 * - Toast خطا
 * - Responsive
 * - پشتیبانی کامل از RTL
 *
 * ============================================================
 */


/* ============================================================
   1. CONTACT LAYOUT
   ============================================================ */

.contact-section {
    position: relative;
    overflow: hidden;
}


/*
 * کانتینر اصلی Contact
 */

.contact-grid {
    display: grid;
    grid-template-columns: minmax(280px, 0.85fr) minmax(420px, 1.15fr);
    gap: 70px;
    align-items: start;
}


/* ============================================================
   2. CONTACT INFORMATION
   ============================================================ */

.contact-information {
    position: relative;
    z-index: 2;
}


.contact-information .section-description {
    max-width: 560px;
}


/*
 * لیست اطلاعات تماس
 */

.contact-info-list {
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin-top: 35px;
}


/*
 * هر آیتم اطلاعات تماس
 */

.contact-info-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 15px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    transition:
        transform var(--transition-normal),
        border-color var(--transition-normal),
        box-shadow var(--transition-normal),
        background-color var(--transition-normal);
}


.contact-info-item:hover {
    transform: translateX(6px);
    border-color: var(--color-primary);
    box-shadow: var(--shadow-md);
}


/*
 * آیکون اطلاعات تماس
 */

.contact-info-icon {
    width: 48px;
    height: 48px;
    min-width: 48px;

    display: flex;
    align-items: center;
    justify-content: center;

    border: 1px solid rgba(37, 99, 235, 0.35);
    border-radius: 14px;

    background: var(--color-primary-soft);
    color: var(--color-primary);

    font-size: 20px;

    transition:
        transform var(--transition-normal),
        background-color var(--transition-normal);
}


.contact-info-item:hover .contact-info-icon {
    transform: scale(1.08) rotate(-4deg);
}


/*
 * متن اطلاعات تماس
 */

.contact-info-content {
    min-width: 0;
}


.contact-info-label {
    display: block;
    margin-bottom: 4px;

    color: var(--color-text);
    font-size: 14px;
    font-weight: 700;
}


.contact-info-value {
    display: block;

    color: var(--color-text-muted);
    font-size: 14px;
    line-height: 1.6;

    overflow-wrap: anywhere;
}


/* ============================================================
   3. CONTACT FORM CARD
   ============================================================ */

.contact-form-wrapper {
    position: relative;
    z-index: 2;

    padding: 34px;

    border: 1px solid var(--color-border);
    border-radius: 28px;

    background:
        linear-gradient(
            145deg,
            rgba(255, 255, 255, 0.72),
            rgba(248, 250, 252, 0.52)
        );

    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);

    box-shadow: var(--shadow-lg);

    overflow: hidden;
}


/*
 * نور ظریف داخل کارت
 */

.contact-form-wrapper::before {
    content: "";

    position: absolute;

    width: 220px;
    height: 220px;

    top: -120px;
    right: -100px;

    border-radius: 50%;

    background: var(--color-primary-soft);

    filter: blur(25px);

    pointer-events: none;
}


/* ============================================================
   4. FORM HEADER
   ============================================================ */

.contact-form-header {
    position: relative;
    z-index: 1;

    margin-bottom: 28px;
}


.contact-form-title {
    margin: 0 0 8px;

    color: var(--color-text);
    font-size: 25px;
    font-weight: 800;
    letter-spacing: -0.02em;
}


.contact-form-description {
    margin: 0;

    color: var(--color-text-muted);
    font-size: 14px;
    line-height: 1.7;
}


/* ============================================================
   5. FORM GRID
   ============================================================ */

.contact-form {
    position: relative;
    z-index: 1;
}


.contact-form-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}


/* ============================================================
   6. FORM GROUP
   ============================================================ */

.contact-form-group {
    position: relative;
    margin-bottom: 18px;
}


.contact-form-label {
    display: block;

    margin-bottom: 8px;

    color: var(--color-text);

    font-size: 13px;
    font-weight: 700;
}


/* ============================================================
   7. INPUTS
   ============================================================ */

.contact-form input,
.contact-form textarea {
    width: 100%;

    border: 1px solid var(--color-border);
    border-radius: 14px;

    background: rgba(255, 255, 255, 0.68);

    color: var(--color-text);

    font-family: inherit;
    font-size: 14px;

    outline: none;

    transition:
        border-color var(--transition-fast),
        box-shadow var(--transition-fast),
        background-color var(--transition-fast),
        transform var(--transition-fast);
}


/*
 * Input
 */

.contact-form input {
    min-height: 52px;
    padding: 0 15px;
}


/*
 * Textarea
 */

.contact-form textarea {
    min-height: 170px;

    padding: 15px;

    resize: vertical;

    line-height: 1.7;
}


/*
 * Placeholder
 */

.contact-form input::placeholder,
.contact-form textarea::placeholder {
    color: var(--color-text-muted);
    opacity: 0.75;
}


/*
 * Focus
 */

.contact-form input:focus,
.contact-form textarea:focus {
    border-color: var(--color-primary);

    background: var(--color-surface);

    box-shadow:
        0 0 0 4px var(--color-primary-soft);

    transform: translateY(-1px);
}


/*
 * Invalid
 */

.contact-form input:invalid:not(:placeholder-shown),
.contact-form textarea:invalid:not(:placeholder-shown) {
    border-color: var(--color-danger);
}


/* ============================================================
   8. TEXTAREA COUNTER
   ============================================================ */

.contact-message-wrapper {
    position: relative;
}


.contact-character-count {
    position: absolute;

    right: 14px;
    bottom: 10px;

    color: var(--color-text-muted);

    font-size: 11px;

    pointer-events: none;
}


html[dir="rtl"] .contact-character-count {
    right: auto;
    left: 14px;
}


/* ============================================================
   9. SUBMIT BUTTON
   ============================================================ */

.contact-submit-button {
    position: relative;

    width: 100%;
    min-height: 54px;

    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;

    margin-top: 4px;

    border: 0;
    border-radius: 15px;

    background:
        linear-gradient(
            135deg,
            var(--color-primary),
            var(--color-accent)
        );

    color: #ffffff;

    font-family: inherit;
    font-size: 14px;
    font-weight: 800;

    cursor: pointer;

    overflow: hidden;

    box-shadow:
        0 12px 28px rgba(37, 99, 235, 0.22);

    transition:
        transform var(--transition-fast),
        box-shadow var(--transition-fast),
        opacity var(--transition-fast);
}


.contact-submit-button::before {
    content: "";

    position: absolute;

    inset: 0;

    background:
        linear-gradient(
            100deg,
            transparent 20%,
            rgba(255, 255, 255, 0.22) 50%,
            transparent 80%
        );

    transform: translateX(-120%);

    transition: transform 0.7s ease;

    pointer-events: none;
}


.contact-submit-button:hover::before {
    transform: translateX(120%);
}


.contact-submit-button:hover {
    transform: translateY(-2px);

    box-shadow:
        0 16px 34px rgba(37, 99, 235, 0.28);
}


.contact-submit-button:active {
    transform: translateY(0);
}


.contact-submit-button:disabled {
    cursor: not-allowed;
    opacity: 0.72;
    transform: none;
}


/* ============================================================
   10. LOADING STATE
   ============================================================ */

.contact-submit-button.is-loading {
    cursor: wait;
}


.contact-submit-button.is-loading .contact-submit-icon {
    animation: contactButtonSpin 0.9s linear infinite;
}


@keyframes contactButtonSpin {

    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }

}


/* ============================================================
   11. CONTACT TOAST
   ============================================================ */

.contact-toast-container {
    position: fixed;

    right: 24px;
    bottom: 24px;

    z-index: 9999;

    display: flex;
    flex-direction: column;
    gap: 12px;

    width: min(390px, calc(100vw - 32px));

    pointer-events: none;
}


html[dir="rtl"] .contact-toast-container {
    right: auto;
    left: 24px;
}


/*
 * Toast اصلی
 */

.contact-toast {
    position: relative;

    display: flex;
    align-items: flex-start;
    gap: 13px;

    padding: 16px 17px;

    border: 1px solid var(--color-border);
    border-radius: 17px;

    background: rgba(255, 255, 255, 0.9);

    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);

    box-shadow: var(--shadow-lg);

    pointer-events: auto;

    animation:
        contactToastIn 0.35s
        cubic-bezier(0.2, 0.8, 0.2, 1)
        both;
}


/*
 * ورود Toast
 */

@keyframes contactToastIn {

    from {
        opacity: 0;
        transform: translateY(18px) scale(0.96);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

}


/*
 * خروج Toast
 */

.contact-toast.is-removing {
    animation:
        contactToastOut 0.25s
        ease
        forwards;
}


@keyframes contactToastOut {

    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

    to {
        opacity: 0;
        transform: translateY(10px) scale(0.97);
    }

}


/* ============================================================
   12. TOAST ICON
   ============================================================ */

.contact-toast-icon {
    width: 38px;
    height: 38px;
    min-width: 38px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 50%;

    font-size: 17px;
    font-weight: 800;
}


.contact-toast.success {
    border-color: rgba(16, 185, 129, 0.45);
}


.contact-toast.success .contact-toast-icon {
    background: rgba(16, 185, 129, 0.13);
    color: var(--color-success);
}


.contact-toast.error {
    border-color: rgba(239, 68, 68, 0.45);
}


.contact-toast.error .contact-toast-icon {
    background: rgba(239, 68, 68, 0.12);
    color: var(--color-danger);
}


.contact-toast.loading {
    border-color: rgba(37, 99, 235, 0.4);
}


.contact-toast.loading .contact-toast-icon {
    background: var(--color-primary-soft);
    color: var(--color-primary);
}


/* ============================================================
   13. TOAST CONTENT
   ============================================================ */

.contact-toast-content {
    flex: 1;
    min-width: 0;
}


.contact-toast-title {
    margin: 0 0 4px;

    color: var(--color-text);

    font-size: 14px;
    font-weight: 800;
}


.contact-toast-message {
    margin: 0;

    color: var(--color-text-muted);

    font-size: 12px;
    line-height: 1.6;
}


/* ============================================================
   14. TOAST CLOSE BUTTON
   ============================================================ */

.contact-toast-close {
    width: 24px;
    height: 24px;

    display: flex;
    align-items: center;
    justify-content: center;

    flex-shrink: 0;

    border: 0;
    background: transparent;

    color: var(--color-text-muted);

    font-size: 17px;

    cursor: pointer;

    border-radius: 6px;

    transition:
        background-color var(--transition-fast),
        color var(--transition-fast);
}


.contact-toast-close:hover {
    background: var(--color-background-alt);
    color: var(--color-text);
}


/* ============================================================
   15. DARK MODE
   ============================================================ */

html[data-theme="dark"] .contact-info-item {
    background: rgba(15, 23, 42, 0.48);
}


html[data-theme="dark"] .contact-form-wrapper {
    background:
        linear-gradient(
            145deg,
            rgba(15, 23, 42, 0.72),
            rgba(15, 23, 42, 0.48)
        );
}


html[data-theme="dark"] .contact-form input,
html[data-theme="dark"] .contact-form textarea {
    background: rgba(15, 23, 42, 0.58);
}


html[data-theme="dark"] .contact-form input:focus,
html[data-theme="dark"] .contact-form textarea:focus {
    background: rgba(15, 23, 42, 0.82);
}


html[data-theme="dark"] .contact-toast {
    background: rgba(15, 23, 42, 0.9);
}


/* ============================================================
   16. RTL
   ============================================================ */

html[dir="rtl"] .contact-info-item:hover {
    transform: translateX(-6px);
}


html[dir="rtl"] .contact-form input,
html[dir="rtl"] .contact-form textarea {
    text-align: right;
}


html[dir="rtl"] .contact-toast {
    direction: rtl;
}


/* ============================================================
   17. RESPONSIVE
   ============================================================ */

@media (max-width: 900px) {

    .contact-grid {
        grid-template-columns: 1fr;
        gap: 40px;
    }

}


@media (max-width: 768px) {

    .contact-form-wrapper {
        padding: 25px;
        border-radius: 22px;
    }


    .contact-form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }


    .contact-info-list {
        margin-top: 25px;
    }

}


@media (max-width: 480px) {

    .contact-form-wrapper {
        padding: 20px;
    }


    .contact-form-title {
        font-size: 21px;
    }


    .contact-toast-container {
        right: 16px;
        bottom: 16px;
        width: calc(100vw - 32px);
    }


    html[dir="rtl"] .contact-toast-container {
        right: auto;
        left: 16px;
    }

}


/* ============================================================
   18. REDUCED MOTION
   ============================================================ */

@media (prefers-reduced-motion: reduce) {

    .contact-info-item,
    .contact-info-icon,
    .contact-form input,
    .contact-form textarea,
    .contact-submit-button {
        transition: none;
    }


    .contact-toast,
    .contact-toast.is-removing {
        animation: none;
    }

}