:root {
    --primary-color: #FF6900;
    --secondary-color: #E7E7E7;
    --text-color-dark: #333;
    --text-color-medium: #555;
    --text-color-light: #777;
    --border-color: #ddd;
    --input-bg: #fdfdfd;
    --card-bg: #fff;
    --error-color: #e74c3c;
}

.ic-form.container {
    background-color: var(--card-bg);
    padding: 40px 50px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    width: 500px;
    max-width: 100%;
    text-align: center;
    border: 1px solid rgba(0, 0, 0, 0.05);
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    justify-content: space-between;
}

.ic-form h2 {
    color: var(--text-color-dark);
    margin-bottom: 5px;
    font-size: 18px;
    font-weight: 600;
    position: relative;
    padding-right: 11px;
    text-align: right;
    width: 100%;
}

.ic-form h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    transform: translateX(-50%);
    width: 2px;
    height: 40px;
    background-color: var(--primary-color);
    border-radius: 2px;
}

.ic-form .description {
    color: var(--text-color-medium);
    font-size: 14px;
    line-height: 1.7;
    margin-bottom: 10px;
    text-align: justify;
    width: 100%;
}

.ic-form .ic-form-group {
    margin-bottom: 5px;
    width: 48%;
}

.ic-form .ic-form-group.full-width {
    width: 100%;
}

.ic-form .ic-form-group label {
    display: block;
    margin-bottom: 7px;
    color: var(--text-color-dark);
    font-size: 14px;
    text-align: right;
}

.ic-form .ic-form-group input[type="text"],
.ic-form .ic-form-group select,.ic-form .result-value,
.ic-form .ic-form-group input[type="number"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-color-dark);
    background-color: var(--input-bg);
    text-align: left;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    outline: none;
    direction: ltr;
}

.ic-form .ic-form-group input::placeholder {
    color: #b0b0b0;
    font-weight: 300;
    direction: rtl;
    text-align: right;
}

.ic-form .ic-form-group input[type="number"]::placeholder {
    direction: rtl;
    text-align: right;
}

.ic-form .ic-form-group input[type="text"]:focus,
.ic-form .ic-form-group input[type="number"]:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(255, 105, 0, 0.25);
}

.ic-form .ic-form-group .required-message {
    color: var(--error-color);
    font-size: 13px;
    margin-top: 8px;
    display: block;
    text-align: right;
    font-weight: 500;
}

.ic-form .ic-form-group input[type="text"].error {
    border-color: var(--error-color);
}

.ic-form .ic-form-group .help-text {
    color: var(--text-color-light);
    font-size: 12px;
    margin-top: 8px;
    text-align: right;
    font-weight: 400;
    line-height: 8px;
}

.ic-form .ic-submit-btn, .ic-button, .ic-form .ic-form-button {
    background-color: var(--primary-color);
    color: white;
    padding: 10px 40px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    line-height: 25px;
    font-weight: 600;
    margin-top: 10px;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    letter-spacing: 0.5px;
    width: 100%;
    text-decoration: none;
    text-align: center;
}

.ic-button {
    max-width: 213px;
}

.ic-button:focus-visible {
    border: none;
}

.ic-form .ic-submit-btn:hover, .ic-button:hover, .ic-form .ic-form-button:hover {
    background-color: #e65c00;
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(255, 105, 0, 0.4);
}

.ic-form .ic-submit-btn:active, .ic-button:active, .ic-form .ic-form-button:active {
    transform: translateY(0);
    box-shadow: 0 3px 10px rgba(255, 105, 0, 0.2);
}

.ic-form .result-group {
    margin-top: 15px;
    border-top: 1px solid #eee;
    padding-top: 15px;
    text-align: right;
    width: 100%;
}

.ic-form .result-group label {
    display: block;
    margin-bottom: 10px;
    color: var(--text-color-dark);
    font-weight: 600;
    font-size: 14px;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .ic-form.container {
        padding: 15px 20px;
        width: 100%;
        border-radius: 0;
        box-shadow: none;
        text-align: right;
    }

    .ic-form h2 {
        font-size: 20px;
    }

    .ic-form .description {
        font-size: 15px;
    }

    .ic-form .ic-submit-btn, .ic-button, .ic-form .ic-form-button {
        font-size: 18px;
        padding: 14px 25px;
    }
}

/* انیمیشن برای مدال */
@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(-50px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes overlayFadeIn {
    from {
        opacity: 0;
        backdrop-filter: blur(0px);
    }
    to {
        opacity: 1;
        backdrop-filter: blur(5px);
    }
}

.ic-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    backdrop-filter: blur(0px);
}

.ic-modal-overlay.active {
    opacity: 1;
    visibility: visible;
    animation: overlayFadeIn 0.3s ease forwards;
    backdrop-filter: blur(5px);
}

.ic-modal-overlay .ic-form.ic-modal-content {
    position: relative;
    background: #fff;
    padding: 24px;
    border-radius: 12px;
    max-width: 800px;
    width: 90%;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    text-align: right;
    margin: auto;
    display: flex;
    justify-content: space-between;
    align-items: stretch;

    opacity: 0;
    transform: scale(0.8) translateY(-50px);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.ic-modal-overlay.active .ic-form.ic-modal-content {
    opacity: 1;
    transform: scale(1) translateY(0);
    animation: modalFadeIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.ic-modal-overlay .ic-modal-form {
    width: 38%;
}

.ic-modal-overlay .ic-modal-desc {
    width: 58%;
    padding: 25px 25px 25px 0;
    margin: auto 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: relative;
}

.ic-modal-desc:before {
    content: '';
    position: absolute;
    bottom: 0;
    right: -10px;
    transform: translateX(-50%);
    width: 1px;
    height: 100%;
    background-color: #eee;
    border-radius: 2px;
}

.ic-modal-overlay .ic-form.ic-modal-content h2 {
    margin-bottom: 20px;
    margin-top: 7px;
    font-size: 25px;
}

.ic-modal-overlay .ic-form.ic-modal-content .ic-form-group select,
.ic-modal-overlay .ic-form.ic-modal-content input[type="text"],
.ic-modal-overlay .ic-form.ic-modal-content input[type="number"] {
    direction: rtl;
    text-align: right;
    width: 100%;
}

.ic-modal-overlay .ic-form.ic-modal-content .ic-form-group {
    margin-bottom: 15px;
    display: flex;
    flex-wrap: wrap;
    width: 100%;
}

.ic-modal-overlay .ic-form.ic-modal-content .ic-submit-btn {
    margin-top: 15px;
    width: 100%;
    color: white;
}

.ic-modal-overlay .ic-form.ic-modal-content .ic-close-btn {
    margin-top: 0;
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    position: absolute;
    top: 5px;
    left: 5px;
}

.ic-modal-overlay .ic-form.ic-modal-content .result-group {
    margin-top: 15px;
    border-top: 1px solid #eee;
    padding-top: 15px;
    text-align: right;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ic-modal-overlay .ic-form.ic-modal-content .result-group .result-value {
    width: 50%;
    font-size: 18px;
}

.ic-modal-overlay .ic-modal-desc .ic-description {
    font-size: 14px;
    line-height: 38px;
}

.ic-modal-overlay .ic-modal-desc .ic-description li {
    list-style: disc;
}

.ic-modal-overlay .ic-modal-desc .ic-description li::marker {
    color: var(--primary-color);
}

.ic-modal-overlay .ic-modal-desc .ic-button-link {
    padding: 10px 20px;
    border: 1px solid #a1a3a8;
    border-radius: 11px;
    text-decoration: none;
    text-align: center;
    width: fit-content;
    margin-right: auto;
    font-size: 16px;
    margin-top: 20px;
    /* اضافه کن: */
    transition: all 0.3s ease;
    background-color: transparent;
}

.ic-modal-overlay .ic-modal-desc .ic-button-link:hover {
    background-color: #eee;
    border-color: #888;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* انیمیشن‌های مدال */
@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(-50px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes modalFadeOut {
    from {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
    to {
        opacity: 0;
        transform: scale(0.8) translateY(-50px);
    }
}

@keyframes overlayFadeIn {
    from {
        opacity: 0;
        backdrop-filter: blur(0px);
    }
    to {
        opacity: 1;
        backdrop-filter: blur(5px);
    }
}

@keyframes overlayFadeOut {
    from {
        opacity: 1;
        backdrop-filter: blur(5px);
    }
    to {
        opacity: 0;
        backdrop-filter: blur(0px);
    }
}

/* مدال بسته (حالت پیش‌فرض) */
.ic-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none; /* جایگزین display: none */
    transition: opacity 0.3s ease, visibility 0.3s ease;
    backdrop-filter: blur(0px);
}

/* مدال باز */
.ic-modal-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto; /* فعال کردن تعامل */
    animation: overlayFadeIn 0.3s ease forwards;
    backdrop-filter: blur(5px);
}

/* مدال در حال بسته شدن */
.ic-modal-overlay.closing {
    animation: overlayFadeOut 0.3s ease forwards;
}