@font-face {
    font-family: 'iransans';
    src: url('../fonts/IRANSansX-Regular.ttf') format('truetype');
}

:root {
    /* تم روشن (پیش‌فرض) */
    --bg-color: #f4f6f9;
    --surface-color: #ffffff;
    --text-color: #333333;
    --text-muted: #6c757d;
    --primary-color: #6c69ff;
    --primary-hover: #5653eb;
    --accent-color: #FFD369;
    --accent-hover: #e5bd5e;
    --nav-bg: #ffffff;
    --footer-bg: #e9ecef;
    --border-color: #e2e8f0;
    --danger: #dc3545;
    --success: #28a745;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] {
    /* تم تاریک */
    --bg-color: #1a1e24;
    --surface-color: #222831;
    --text-color: #eeeeee;
    --text-muted: #b5b5b5;
    --primary-color: #6c69ff;
    --primary-hover: #8381ff;
    --accent-color: #FFD369;
    --accent-hover: #ffd87a;
    --nav-bg: #222831;
    --footer-bg: #15181d;
    --border-color: #393E46;
    --danger: #ff4d4d;
    --success: #00d26a;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    direction: rtl;
    font-family: 'iransans', Tahoma, sans-serif;
    transition: background-color 0.3s ease, color 0.3s ease;
    min-height: 100vh;
    display: flex;
    flex-direction: column; /* چیدمان عمودی عناصر اصلی */
}

main {
    flex: 1; /* این خط باعث می‌شود تمام فضای خالی باقی‌مانده صفحه توسط محتوا پر شود */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
}

/* Typography & Utilities */
.text-danger { color: var(--danger); }
.text-warning { color: var(--accent-color); }
.text-success { color: var(--success); }
.flex { display: flex !important; }

/* Navbar */
nav {
    background: var(--nav-bg);
    width: 100%;
    height: 70px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 5%;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    border-bottom: 1px solid var(--border-color);
    transition: background 0.3s ease;
}

#top-menu {
    list-style: none;
    display: flex;
    gap: 15px;
}

nav a {
    color: var(--text-color);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
}

nav a:hover {
    background-color: var(--border-color);
}

nav a.nav-vip {
    color: var(--accent-color);
    font-weight: bold;
}
nav a.nav-vip:hover {
    background-color: rgba(255, 211, 105, 0.1);
}

#theme-toggle {
    background: transparent;
    border: none;
    color: var(--text-color);
    font-size: 20px;
    cursor: pointer;
    padding: 10px;
    border-radius: 50%;
    transition: background 0.3s;
}

#theme-toggle:hover {
    background: var(--border-color);
}

/* Main Container */
.container {
    width: 100%;
    padding: 2rem 5%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.hero-section {
    text-align: center;
    margin-bottom: 40px;
}

h1 {
    font-size: 3.5rem;
    font-weight: 900;
    margin-bottom: 15px;
    background: linear-gradient(45deg, var(--primary-color), #b05cff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

h2 {
    font-size: 1.1rem;
    color: var(--text-muted);
    font-weight: normal;
    line-height: 1.8;
}

.ai {
    color: var(--primary-color);
    font-weight: bold;
    padding: 2px 8px;
    background: rgba(108, 105, 255, 0.1);
    border-radius: 6px;
    display: inline-block;
}

/* Form Wrapper & Card */
.form-wrapper {
    background: var(--surface-color);
    padding: 30px;
    border-radius: 20px;
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 650px;
    border: 1px solid var(--border-color);
    transition: background 0.3s, box-shadow 0.3s, border 0.3s;
}

form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.file-input-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#file {
    display: none;
}

.file-label {
    background: var(--accent-color);
    color: #222;
    padding: 15px 25px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    font-weight: bold;
    font-size: 16px;
    transition: transform 0.2s, background 0.2s;
    border: 2px dashed rgba(0,0,0,0.1);
}

.file-label:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
}

#filename {
    background: var(--bg-color);
    color: var(--text-muted);
    padding: 12px;
    border-radius: 10px;
    text-align: center;
    font-size: 14px;
    border: 1px solid var(--border-color);
    word-break: break-word;
}

.options-group {
    display: flex;
    gap: 15px;
    align-items: stretch;
}

.select-wrapper {
    position: relative;
    flex: 1;
}

.select-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

select {
    width: 100%;
    background: var(--bg-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    padding: 0 15px 0 40px;
    height: 50px;
    border-radius: 12px;
    outline: none;
    font-family: inherit;
    font-size: 14px;
    appearance: none;
    cursor: pointer;
}

.submit-btn {
    background: var(--primary-color);
    color: #fff;
    border: none;
    padding: 0 30px;
    border-radius: 12px;
    cursor: pointer;
    font-family: inherit;
    font-size: 16px;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    height: 50px;
}

.submit-btn:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(108, 105, 255, 0.4);
}

.submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Alert Box */
.custom-alert-card {
    background-color: rgba(220, 53, 69, 0.1);
    border: 1px solid var(--danger);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    display: none; /* Changed via JS */
    align-items: center;
    text-align: center;
    flex-direction: column;
    gap: 15px;
    max-width: 650px;
    width: 100%;
}

.custom-alert-card i {
    font-size: 2rem;
    color: var(--danger);
}

.custom-alert-card p {
    color: var(--text-color);
    font-size: 15px;
    line-height: 1.6;
}

.subscribe-button {
    background-color: var(--danger);
    color: white;
    padding: 10px 25px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: bold;
    transition: 0.3s;
}

.subscribe-button:hover {
    background-color: #c82333;
}

/* Download Box */
.download-box {
    display: none; /* Changed via JS */
    background: rgba(0, 210, 106, 0.1);
    border: 1px solid rgba(0, 210, 106, 0.3);
    border-radius: 12px;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    margin-top: 20px;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.download-info {
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
}

.download-info i {
    color: var(--success);
    font-size: 20px;
}

.download-box p {
    color: var(--text-color);
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#output-link {
    background: var(--success);
    color: #fff;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: 0.3s;
    white-space: nowrap;
}

#output-link:hover {
    background: #00b35a;
    transform: scale(1.05);
}

/* Footer */
footer {
    background: var(--footer-bg);
    padding: 20px;
    text-align: center;
    border-top: 1px solid var(--border-color);
    transition: background 0.3s;
    width: 100%; /* اطمینان از تمام‌عرض بودن فوتر */
}

footer p {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 5px;
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: bold;
}

/* Responsive Styles */
@media screen and (max-width: 768px) {
    h1 {
        font-size: 2.2rem;
    }
    
    h2 {
        font-size: 1rem;
    }

    .form-wrapper {
        padding: 20px;
    }

    .options-group {
        flex-direction: column;
    }

    select {
        padding-right: 40px;
    }

    .submit-btn {
        width: 100%;
        justify-content: center;
    }

    .download-box {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .download-info {
        flex-direction: column;
    }

    #output-link {
        width: 100%;
        justify-content: center;
    }
    
    nav {
        padding: 0 15px;
    }
    
    nav a {
        padding: 8px;
        font-size: 13px;
    }
    
    nav a span {
        display: none; /* پنهان کردن متن منو در موبایل و فقط نمایش آیکون ها اگر بخواهید */
    }
}