:root {
    --primary-color: #1a73e8;
    --secondary-color: #0d62c9;
    --background-color: #f5f8ff;
    --text-color: #2c3e50;
    --border-color: #ddd;
    --success-color: #27ae60;
    --error-color: #e74c3c;
    --warning-color: #f39c12;
    --light-color: #ecf0f1;
    --dark-color: #34495e;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Vazir', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.8;
    color: var(--text-color);
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    background: linear-gradient(135deg, var(--background-color) 0%, #e8f4ff 100%);
    direction: rtl;
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
}

h1 {
    color: var(--primary-color);
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

h2 {
    color: var(--dark-color);
    font-size: 1.5rem;
    margin-bottom: 20px;
    border-right: 4px solid var(--primary-color);
    padding-right: 15px;
}

h3 {
    color: var(--dark-color);
    font-size: 1.3rem;
    margin: 25px 0 15px;
}

.container {
    background-color: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    margin-bottom: 25px;
}

.description {
    color: var(--dark-color);
    font-size: 1.1rem;
    margin-bottom: 25px;
    text-align: justify;
    line-height: 1.9;
}

textarea {
    width: 100%;
    min-height: 180px;
    padding: 18px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 18px;
    margin-bottom: 20px;
    resize: vertical;
    box-sizing: border-box;
    direction: ltr;
    text-align: left;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    transition: border-color 0.3s, box-shadow 0.3s;
}

textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.2);
}

.buttons {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 14px 22px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    flex: 1;
    min-width: 140px;
    transition: all 0.3s;
    font-family: inherit;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

button:hover {
    background-color: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

button:active {
    transform: translateY(0);
}

#clearBtn {
    background-color: var(--light-color);
    color: var(--dark-color);
}

#clearBtn:hover {
    background-color: #dde4e6;
}

.status {
    margin: 20px 0;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    font-weight: 500;
    display: none;
    animation: fadeIn 0.5s;
}

.loading {
    background-color: rgba(243, 156, 18, 0.15);
    color: var(--warning-color);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.success {
    background-color: rgba(39, 174, 96, 0.15);
    color: var(--success-color);
    display: block;
}

.error {
    background-color: rgba(231, 76, 60, 0.15);
    color: var(--error-color);
    display: block;
}

.result {
    background-color: #f8fafd;
    padding: 25px;
    border-radius: 8px;
    border-right: 4px solid var(--primary-color);
    min-height: 80px;
    direction: ltr;
    text-align: left;
    word-break: break-word;
    font-size: 18px;
    line-height: 1.7;
    margin-top: 20px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.info {
    margin-top: 30px;
    background: linear-gradient(to right, #e8f4fd, #f0f7ff);
    padding: 25px;
    border-radius: 8px;
    font-size: 16px;
    border: 1px solid #cce5ff;
}

.info h4 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.info p {
    margin-bottom: 15px;
    line-height: 1.8;
}

.word-check {
    margin-top: 12px;
    padding: 12px;
    border-radius: 6px;
    background-color: white;
    font-size: 15px;
    border: 1px solid #eee;
    display: flex;
    align-items: center;
    gap: 10px;
}

.english-word {
    color: var(--success-color);
    font-weight: bold;
}

.converted-word {
    color: var(--primary-color);
    font-weight: bold;
    font-family: 'Dastnevis', 'Vazir', sans-serif;
    font-size: 22px;
}

.stats {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.stat-box {
    background-color: white;
    padding: 15px;
    border-radius: 8px;
    flex: 1;
    min-width: 180px;
    text-align: center;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--dark-color);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

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

.footer {
    text-align: center;
    margin-top: 40px;
    color: var(--dark-color);
    font-size: 0.9rem;
    opacity: 0.8;
}

@media (max-width: 768px) {
    body {
        padding: 15px;
    }

    h1 {
        font-size: 2rem;
    }

    .container {
        padding: 20px;
    }

    .buttons {
        flex-direction: column;
    }

    button {
        width: 100%;
    }

    .stat-box {
        min-width: 100%;
    }
}

/* استایل مخصوص فونت داست نویس برای نمایش فارسی */
.persian-text {
    font-family: 'Dastnevis', 'Vazir', sans-serif;
    font-size: 22px;
    line-height: 2;
}