body {
    font-family: 'Vazir', sans-serif;
    text-align: center;
    padding: 50px;
    margin: 0;
    min-height: 100vh;
    transition: background 0.3s, color 0.3s;
}

h1 {
    font-size: 2.5em;
    margin-bottom: 30px;
}

.container {
    background: var(--bg-container);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    max-width: 600px;
    margin: 0 auto;
}

.hidden { display: none; }

input, select, button {
    margin: 10px 0;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    font-family: 'Vazir', sans-serif;
    width: 80%;
    max-width: 400px;
    background: var(--input-bg);
    color: var(--text-color);
    box-sizing: border-box;
}

button {
    background-color: var(--button-bg);
    color: white;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s;
}

button:hover { background-color: var(--button-hover); }

#apiStatus, #processingMessage {
    color: var(--secondary-text);
    font-size: 1.1em;
}

#apiKeyDisplay {
    color: #e74c3c;
    font-weight: bold;
    word-break: break-all;
}

#themeToggle {
    position: fixed;
    top: 20px;
    left: 20px;
    width: auto;
    padding: 8px 15px;
}

#guideButton {
    background-color: #2ecc71;
    width: auto;
    padding: 8px 15px;
}

#guideButton:hover { background-color: #27ae60; }

#timer {
    font-size: 1.2em;
    color: var(--secondary-text);
    margin-top: 10px;
}

/* استایل مودال */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-container);
    padding: 20px;
    border-radius: 10px;
    max-width: 500px;
    width: 90%;
    position: relative;
    color: var(--text-color);
    line-height: 1.6;
    text-align: right;
}

.modal-content h2 {
    color: var(--text-color);
    font-size: 1.8em;
    margin-top: 0;
}

.modal-content a {
    color: #3498db;
    text-decoration: none;
}

.modal-content a:hover {
    text-decoration: underline;
}

.close-button {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    background: #e74c3c;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    color: white;
    font-size: 0.9em;
    margin-top: 5px;
}

.close-button:hover {
    background: #c0392b;
}

/* تم روز (پیش‌فرض مرورگر) */
@media (prefers-color-scheme: light) {
    body {
        background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
        color: #2c3e50;
    }
    :root {
        --bg-container: white;
        --text-color: #333;
        --secondary-text: #7f8c8d;
        --border-color: #ddd;
        --button-bg: #3498db;
        --button-hover: #2980b9;
        --input-bg: #fff;
    }
    .modal-content ol li {
        color: #333;
    }
}

/* تم شب (پیش‌فرض مرورگر) */
@media (prefers-color-scheme: dark) {
    body {
        background: linear-gradient(135deg, #2c3e50 0%, #1a252f 100%);
        color: #ecf0f1;
    }
    :root {
        --bg-container: #34495e;
        --text-color: #ecf0f1;
        --secondary-text: #bdc3c7;
        --border-color: #576574;
        --button-bg: #e74c3c;
        --button-hover: #c0392b;
        --input-bg: #2c3e50;
    }
}

/* کلاس‌های تم دستی */
.light-theme {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: #2c3e50;
}

.light-theme .container, .light-theme .modal-content { background: white; }
.light-theme input, .light-theme select { background: #fff; color: #2c3e50; border-color: #ddd; }
.light-theme button { background-color: #3498db; }
.light-theme button:hover { background-color: #2980b9; }
.light-theme #apiStatus, .light-theme #processingMessage { color: #7f8c8d; }
.light-theme #guideButton { background-color: #2ecc71; }
.light-theme #guideButton:hover { background-color: #27ae60; }
.light-theme .modal-content { color: #333; }
.light-theme .modal-content h2 { color: #333; }

.dark-theme {
    background: linear-gradient(135deg, #2c3e50 0%, #1a252f 100%);
    color: #ecf0f1;
}

.dark-theme .container, .dark-theme .modal-content { background: #34495e; }
.dark-theme input, .dark-theme select { background: #2c3e50; color: #ecf0f1; border-color: #576574; }
.dark-theme button { background-color: #e74c3c; }
.dark-theme button:hover { background-color: #c0392b; }
.dark-theme #apiStatus, .dark-theme #processingMessage { color: #bdc3c7; }
.dark-theme #guideButton { background-color: #27ae60; }
.dark-theme #guideButton:hover { background-color: #219653; }

/* Media Query برای موبایل */
@media (max-width: 768px) {
    body {
        padding: 15px;
    }
    h1 {
        font-size: 1.5em;
    }
    .container {
        padding: 15px;
        max-width: 100%;
        margin-top: 50px;
    }
    input, select, button {
        margin: 8px 0;
        padding: 6px;
        width: 100%;
        max-width: 100%;
        font-size: 0.9em;
    }
    #themeToggle {
        top: 5px;
        left: 5px;
        padding: 5px 10px;
        font-size: 0.8em;
    }
    #guideButton {
        padding: 5px 10px;
        font-size: 0.8em;
    }
    #apiStatus, #processingMessage, #timer {
        font-size: 0.9em;
    }
    .modal-content {
        padding: 10px;
        max-width: 95%;
    }
    .modal-content h2 {
        font-size: 1.2em;
    }
    .modal-content ol {
        padding-right: 20px;
    }
    .modal-content ol li {
        font-size: 0.9em;
    }
    .close-button {
        padding: 3px 6px;
        font-size: 0.7em;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.2em;
    }
    input, select, button {
        padding: 5px;
        font-size: 0.8em;
    }
    .modal-content h2 {
        font-size: 1em;
    }
    .modal-content ol li {
        font-size: 0.8em;
    }
}