/* --- Import Fonts and Basic Reset --- */
@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;700&display=swap');
/* Font Awesome loaded via HTML */

:root {
    --font-family: 'Vazirmatn', sans-serif;
    /* --- Base Transition Speed --- */
    --animation-speed: 0.3s;
    /* --- Light Theme Variables (Default) --- */
    --bg-color: #f8f9fa;
    --text-color: #212529;
    --container-bg: #ffffff;
    --primary-color: #0d6efd;
    --primary-hover: #0b5ed7;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --success-hover: #157347;
    --error-color: #dc3545;
    --warning-color: #ffc107;
    --warning-text: #664d03;
    --border-color: #dee2e6;
    --input-bg: #ffffff;
    --input-border: #ced4da;
    --input-focus-border: #86b7fe;
    --input-focus-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
    --disabled-bg: #e9ecef;
    --disabled-text: #6c757d;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --link-color: #0d6efd;
    --code-bg: #eef1f4;
    --section-border: #e9ecef;
    --line-number-bg: #f1f3f5;
    --line-number-text: #adb5bd;
    --toolbar-bg: #f1f3f5;
    --modal-backdrop: rgba(0, 0, 0, 0.6);
}

/* --- Dark Theme Variables --- */
body[data-theme="dark"] {
    --bg-color: #212529;
    --text-color: #dee2e6;
    --container-bg: #343a40;
    --primary-color: #6ea8fe;
    --primary-hover: #3d8bfd;
    --secondary-color: #adb5bd;
    --success-color: #48cfae;
    --success-hover: #3cc1a0;
    --error-color: #f57a7a;
    --warning-color: #ffca2c;
    --warning-text: #4d3c00; /* Darker text for yellow bg */
    --border-color: #495057;
    --input-bg: #495057;
    --input-border: #6c757d;
    --input-focus-border: #a1c9ff;
    --input-focus-shadow: 0 0 0 0.25rem rgba(110, 168, 254, 0.25);
    --disabled-bg: #495057;
    --disabled-text: #adb5bd;
    --shadow-color: rgba(255, 255, 255, 0.05);
    --link-color: #6ea8fe;
    --code-bg: #3e444a;
    --section-border: #495057;
    --line-number-bg: #41484e;
    --line-number-text: #868e96;
    --toolbar-bg: #41484e;
    --modal-backdrop: rgba(0, 0, 0, 0.7);
}

/* --- General Styles --- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { font-family: var(--font-family); background-color: var(--bg-color); color: var(--text-color); margin: 0; padding: 15px; line-height: 1.7; direction: rtl; transition: background-color var(--animation-speed) ease, color var(--animation-speed) ease; font-size: 16px; }
.container { max-width: 950px; margin: 20px auto; background-color: var(--container-bg); padding: 25px 35px; border-radius: 12px; box-shadow: 0 8px 30px var(--shadow-color); transition: background-color var(--animation-speed) ease; overflow: hidden; }

/* --- Header --- */
header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 35px; padding-bottom: 20px; border-bottom: 1px solid var(--section-border); }
header h1 { color: var(--primary-color); margin: 0; font-size: 1.9rem; font-weight: 700; }
header h1 i { margin-left: 12px; vertical-align: middle; animation: spin 6s linear infinite; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.theme-toggle-btn { background: none; border: 1px solid var(--border-color); color: var(--text-color); font-size: 1.3rem; padding: 8px 14px; border-radius: 50%; cursor: pointer; transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease; line-height: 1; }
.theme-toggle-btn:hover { background-color: var(--border-color); transform: scale(1.1) rotate(15deg); }
.theme-toggle-btn i { vertical-align: middle; transition: transform 0.3s ease-out; }
body[data-theme="dark"] .theme-toggle-btn i { transform: rotate(180deg); }

/* --- Sections --- */
section { margin-bottom: 40px; padding-bottom: 30px; border-bottom: 1px solid var(--section-border); animation: fadeIn 0.5s ease-out forwards; opacity: 0; }
section:last-of-type { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }
section h2 { font-size: 1.5rem; color: var(--primary-color); margin-top: 0; margin-bottom: 25px; font-weight: 700; padding-bottom: 10px; border-bottom: 2px solid var(--primary-color); display: inline-block; }
section h2 i { margin-left: 10px; font-size: 1.4rem; }
/* Stagger section animations */
section:nth-of-type(1) { animation-delay: 0.05s; }
section:nth-of-type(2) { animation-delay: 0.15s; }
section:nth-of-type(3) { animation-delay: 0.25s; }
section:nth-of-type(4) { animation-delay: 0.35s; }
section:nth-of-type(5) { animation-delay: 0.45s; }
section:nth-of-type(6) { animation-delay: 0.55s; }


/* --- Conversion Type Selection --- */
.conversion-types { gap: 15px; }
.radio-card { position: relative; }
.radio-card input[type="radio"] { position: absolute; opacity: 0; width: 0; height: 0; }
.radio-card label { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 15px 20px; border: 2px solid var(--border-color); border-radius: 8px; cursor: pointer; transition: all var(--animation-speed) ease; background-color: var(--input-bg); position: relative; overflow: hidden; }
.radio-card label::before { content: ''; position: absolute; top: 0; left: -100%; width: 100%; height: 100%; background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent); transition: left var(--animation-speed) ease-out; z-index: 0; }
.radio-card label > * { position: relative; z-index: 1; }
.radio-card label:hover { border-color: var(--primary-color); background-color: var(--bg-color); transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0,0,0,0.05); }
.radio-card label:hover::before { left: 100%; }
.radio-card input[type="radio"]:checked + label { border-color: var(--primary-color); background-color: var(--primary-color); color: white; box-shadow: 0 4px 15px rgba(13, 110, 253, 0.3); }
.radio-card input[type="radio"]:checked + label .format-tag { background-color: rgba(255, 255, 255, 0.2); color: white; }
.radio-card input[type="radio"]:checked + label i { color: white; transform: scale(1.1); }
.radio-card input[type="radio"]:focus-visible + label { box-shadow: var(--input-focus-shadow); border-color: var(--input-focus-border); }
.radio-card.disabled label { cursor: not-allowed; opacity: 0.5; background-color: var(--disabled-bg); border-color: var(--border-color); }
.radio-card.disabled label:hover { transform: none; box-shadow: none; background-color: var(--disabled-bg); border-color: var(--border-color); }
.radio-card.disabled label::before { display: none; }
.format-tag { font-weight: bold; padding: 3px 8px; border-radius: 4px; background-color: var(--code-bg); font-size: 0.9em; display: inline-block; }
.format-tag.format-ass { color: #e44d26; border: 1px solid #e44d26; }
.format-tag.format-srt { color: #264de4; border: 1px solid #264de4; }
.format-tag.format-sub { color: #6c757d; border: 1px solid #6c757d; }
.radio-card label i { color: var(--secondary-color); font-size: 1.2em; transition: color var(--animation-speed) ease, transform var(--animation-speed) ease; }

/* --- Upload Area & Pre-Preview --- */
.drop-zone { border: 3px dashed var(--border-color); border-radius: 8px; padding: 40px; text-align: center; background-color: var(--bg-color); transition: border-color 0.3s ease, background-color 0.3s ease, transform 0.2s ease; cursor: pointer; margin-bottom: 25px; }
.drop-zone.dragover { border-color: var(--primary-color); background-color: rgba(13, 110, 253, 0.05); transform: scale(1.02); }
.drop-zone p { margin: 0 0 20px 0; color: var(--secondary-color); font-size: 1.1rem; }
.drop-zone i { margin-left: 8px; }
.file-label { display: inline-block; background: linear-gradient(45deg, var(--primary-color), var(--primary-hover)); color: white; padding: 12px 25px; border-radius: 5px; cursor: pointer; transition: all 0.3s ease; font-size: 1.1rem; font-weight: 700; border: none; box-shadow: 0 4px 10px rgba(0,0,0,0.1); }
.file-label:hover { transform: translateY(-2px); box-shadow: 0 6px 15px rgba(0,0,0,0.15); }
.file-label i { margin-left: 8px; }
.file-list { list-style: none; padding: 0; margin-top: 0; text-align: right; max-height: 180px; overflow-y: auto; border: 1px solid var(--border-color); border-radius: 5px; padding: 10px; background-color: var(--input-bg); }
.file-list li { padding: 10px 15px; margin-bottom: 6px; border-radius: 4px; font-size: 0.95rem; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--section-border); transition: background-color 0.2s ease; }
.file-list li:last-child { margin-bottom: 0; border-bottom: none; }
.file-list li:hover { background-color: var(--bg-color); }
.file-list li span:first-child { font-weight: bold; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 75%; }
.file-list li .file-size { color: var(--secondary-color); font-size: 0.85rem; white-space: nowrap; }
.pre-preview-area { margin-top: 25px; padding: 20px; background-color: var(--code-bg); border: 1px solid var(--border-color); border-radius: 8px; box-shadow: inset 0 1px 3px rgba(0,0,0,0.05); animation: fadeIn 0.5s ease forwards; }
.pre-preview-area h4 { margin-top: 0; margin-bottom: 15px; font-size: 1.1rem; color: var(--secondary-color); font-weight: 700; border-bottom: 1px solid var(--section-border); padding-bottom: 10px; }
.pre-preview-area h4 i { margin-left: 8px; }
.pre-preview-area pre { background-color: var(--input-bg); border: 1px solid var(--border-color); border-radius: 6px; padding: 15px; font-family: monospace, 'Vazirmatn', sans-serif; white-space: pre-wrap; word-break: break-word; max-height: 180px; overflow-y: auto; font-size: 0.9rem; color: var(--text-color); margin: 0; line-height: 1.5; direction: ltr; text-align: left; }

/* --- Settings --- */
.settings-fieldset { border: 1px solid var(--border-color); border-radius: 8px; padding: 20px 25px; margin-top: 25px; background-color: rgba(128, 128, 128, 0.02); }
.settings-fieldset:first-of-type { margin-top: 10px; }
.settings-fieldset legend { font-weight: bold; color: var(--secondary-color); padding: 0 10px; font-size: 1.1rem; }
.options-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 25px 30px; }
.option-group { display: flex; flex-direction: column; gap: 10px; position: relative; }
.option-group label:first-child { font-weight: bold; font-size: 1rem; color: var(--text-color); margin-bottom: 0; }
.option-group label i { margin-left: 6px; color: var(--secondary-color); font-size: 0.9em; }
.select-input, .number-input, .textarea-input { width: 100%; padding: 10px 15px; border: 1px solid var(--input-border); border-radius: 5px; font-family: var(--font-family); font-size: 1rem; background-color: var(--input-bg); color: var(--text-color); transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.3s ease; }
.select-input:focus, .number-input:focus, .textarea-input:focus { border-color: var(--input-focus-border); outline: none; box-shadow: var(--input-focus-shadow); }
.textarea-input { font-family: monospace, 'Vazirmatn', sans-serif; font-size: 0.9rem; line-height: 1.6; resize: vertical; min-height: 65px; }
/* Tooltip */
.option-group[title]:hover::after { content: attr(title); position: absolute; bottom: 105%; right: 0; background-color: #333; color: #fff; padding: 6px 12px; border-radius: 4px; font-size: 0.85rem; white-space: nowrap; z-index: 10; opacity: 0; visibility: hidden; transition: opacity 0.2s ease, visibility 0.2s ease; pointer-events: none; animation: tooltipFadeIn 0.3s ease forwards; }
@keyframes tooltipFadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
/* Regex Help Tooltip */
.tooltip-text { visibility: hidden; width: 280px; background-color: #555; color: #fff; text-align: right; direction: rtl; border-radius: 6px; padding: 10px 12px; position: absolute; z-index: 10; bottom: 130%; left: 50%; margin-left: -140px; opacity: 0; transition: opacity 0.3s ease; font-size: 0.85rem; line-height: 1.5; box-shadow: 0 3px 8px rgba(0,0,0,0.3); pointer-events: none; }
.tooltip-text::after { content: ""; position: absolute; top: 100%; left: 50%; margin-left: -6px; border-width: 6px; border-style: solid; border-color: #555 transparent transparent transparent; }
.help-icon { color: var(--secondary-color); margin-right: 6px; cursor: help; position: relative; transition: color 0.2s ease; }
.help-icon:hover { color: var(--primary-color); }
.help-icon:hover + .tooltip-text, .help-icon:focus + .tooltip-text { visibility: visible; opacity: 1; }

/* --- Tag Selection --- */
.tag-selection { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px 15px; align-items: center; margin-top: 15px; padding-top: 15px; border-top: 1px dashed var(--border-color); animation: fadeIn 0.5s ease forwards; }
.tag-selection-label { grid-column: 1 / -1; font-weight: bold; margin-bottom: 5px; color: var(--secondary-color); }

/* --- Custom Checkbox --- */
.checkbox-wrapper { display: inline-flex; align-items: center; position: relative; min-height: 24px; cursor: pointer; margin-top: 5px; }
.checkbox-wrapper input[type="checkbox"] { opacity: 0; width: 0; height: 0; position: absolute; }
.checkbox-label { position: relative; padding-right: 35px; font-size: 1rem; user-select: none; line-height: 24px; color: var(--text-color); }
.checkbox-label::before { content: ''; position: absolute; right: 0; top: 2px; width: 20px; height: 20px; border: 2px solid var(--input-border); background-color: var(--input-bg); border-radius: 4px; transition: background-color 0.2s ease, border-color 0.2s ease; }
.checkbox-label::after { content: '\f00c'; font-family: 'Font Awesome 6 Free'; font-weight: 900; position: absolute; right: 4px; top: 4px; font-size: 14px; color: white; opacity: 0; transition: opacity 0.2s ease, transform 0.2s ease; transform: scale(0.5); }
.checkbox-wrapper input[type="checkbox"]:checked + .checkbox-label::before { background-color: var(--primary-color); border-color: var(--primary-color); }
.checkbox-wrapper input[type="checkbox"]:checked + .checkbox-label::after { opacity: 1; transform: scale(1); }
.checkbox-wrapper input[type="checkbox"]:focus-visible + .checkbox-label::before { box-shadow: var(--input-focus-shadow); } /* Focus visible style */
.checkbox-wrapper.inline { margin-left: 15px; margin-bottom: 10px; }
.checkbox-wrapper.inline:last-child { margin-left: 0; }

/* --- Translation Notice --- */
.translation-notice { font-size: 0.9rem; color: var(--secondary-color); margin: 5px 0 0 0; padding: 8px 12px; background-color: var(--bg-color); border: 1px dashed var(--warning-color); border-radius: 4px; }

/* --- Action Buttons --- */
.action-button { background-color: var(--primary-color); color: white; border: none; padding: 12px 30px; border-radius: 5px; cursor: pointer; font-size: 1.1rem; font-family: var(--font-family); font-weight: 700; transition: all 0.2s ease-out; margin: 5px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; text-decoration: none; line-height: 1.5; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }
.action-button:hover:not(:disabled) { background-color: var(--primary-hover); transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0,0,0,0.15); }
.action-button:active:not(:disabled) { transform: translateY(0px); box-shadow: 0 2px 5px rgba(0,0,0,0.1); }
.action-button:disabled { background-color: var(--disabled-bg); color: var(--disabled-text); cursor: not-allowed; opacity: 0.6; box-shadow: none; transform: none; }
.convert-button { width: 100%; font-size: 1.2rem; padding: 15px 30px; background: linear-gradient(45deg, var(--primary-color), #0056b3); }
.convert-button:hover:not(:disabled) { background: linear-gradient(45deg, var(--primary-hover), var(--primary-color)); }
.download-all-button { background-color: var(--success-color); }
.download-all-button:hover:not(:disabled) { background-color: var(--success-hover); }
.secondary-button { background-color: var(--secondary-color); }
.secondary-button:hover:not(:disabled) { background-color: #545b62; }
.success-button { background-color: var(--success-color); }
.success-button:hover:not(:disabled) { background-color: var(--success-hover); }

/* --- Results Area --- */
.results-area { margin-top: 30px; animation: fadeIn 0.5s ease forwards; }
#resultsList { list-style: none; padding: 0; margin: 20px 0; }
#resultsList li { background-color: var(--bg-color); border: 1px solid var(--border-color); padding: 15px 20px; margin-bottom: 12px; border-radius: 6px; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 15px; transition: background-color 0.3s ease, transform 0.2s ease; animation: slideInUp 0.4s ease-out forwards; opacity: 0; }
/* Stagger result item animation */
#resultsList li:nth-child(1) { animation-delay: 0.1s; }
#resultsList li:nth-child(2) { animation-delay: 0.15s; }
#resultsList li:nth-child(3) { animation-delay: 0.2s; }
/* Add more if expecting many results */

#resultsList li:hover { transform: scale(1.01); background-color: var(--container-bg); }
#resultsList .result-info { flex-grow: 1; display: flex; flex-direction: column; gap: 5px; min-width: 200px; overflow: hidden; }
#resultsList .result-filename { font-weight: bold; font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#resultsList .result-status { font-size: 0.9rem; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 5px; }
#resultsList .status-processing { color: var(--secondary-color); }
#resultsList .status-success { color: var(--success-color); }
#resultsList .status-error { color: var(--error-color); }
#resultsList .status-warning { color: var(--warning-text); }
#resultsList .status-warning i { color: var(--warning-color); }
/* Progress Bar */
.progress-bar-container { width: 120px; height: 10px; background-color: var(--border-color); border-radius: 5px; overflow: hidden; margin-top: 3px; flex-shrink: 0; }
.progress-bar { height: 100%; width: 0%; background-color: var(--primary-color); transition: width 0.4s ease-out; border-radius: 5px; }
#resultsList .status-success .progress-bar { background-color: var(--success-color); }
#resultsList .status-warning .progress-bar { background-color: var(--warning-color); }
#resultsList .status-error .progress-bar { background-color: var(--error-color); }
/* Validation Status */
.validation-status { display: inline-flex; align-items: center; margin-right: 12px; font-size: 1rem; cursor: help; vertical-align: middle; }
.validation-status i { font-size: 1.2em; transition: transform 0.2s ease; }
.validation-status:hover i { transform: scale(1.1); }
.validation-status .fa-check-circle { color: var(--success-color); }
.validation-status .fa-exclamation-triangle { color: var(--warning-color); }
.validation-status .fa-times-circle { color: var(--error-color); }
/* Result Actions */
#resultsList .result-actions { display: flex; gap: 10px; flex-shrink: 0; }
#resultsList .result-actions button { padding: 6px 12px; font-size: 0.9rem; gap: 5px; border-radius: 4px; }
.preview-button { background-color: var(--secondary-color); }
.preview-button:hover:not(:disabled) { background-color: #545b62; }
.edit-button { background-color: var(--primary-color); }
.edit-button:hover:not(:disabled) { background-color: var(--primary-hover); }
.download-button { background-color: var(--success-color); }
.download-button:hover:not(:disabled) { background-color: var(--success-hover); }

/* --- Preview Area --- */
#previewAreaWrapper { animation: fadeIn 0.5s ease forwards; }
#previewAreaWrapper h2 { font-size: 1.4rem; color: var(--primary-color); margin-top: 0; margin-bottom: 20px; font-weight: 700; }
#previewAreaWrapper h2 i { margin-left: 10px; font-size: 1.3rem; }
.preview-area { background-color: var(--code-bg); border: 1px solid var(--border-color); border-radius: 6px; padding: 15px; margin-top: 15px; }
#previewContent { font-family: monospace, 'Vazirmatn', sans-serif; white-space: pre-wrap; word-break: break-word; max-height: 250px; overflow-y: auto; font-size: 0.9rem; direction: ltr; text-align: left; color: var(--text-color); margin: 0; line-height: 1.5; }

/* --- Global Messages --- */
.error-message, .warning-message { margin-top: 25px; padding: 15px 20px; border-radius: 6px; font-size: 1rem; border: 1px solid; display: flex; align-items: center; gap: 12px; animation: fadeIn 0.3s ease forwards; }
.error-message { color: #842029; background-color: #f8d7da; border-color: #f5c2c7; }
.warning-message { color: var(--warning-text); background-color: #fff3cd; border-color: #ffecb5; }
.error-message i, .warning-message i { font-size: 1.3rem; flex-shrink: 0; }

/* --- Editor Modal Styles --- */
.modal { position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; overflow: hidden; background-color: var(--modal-backdrop); display: flex; align-items: center; justify-content: center; opacity: 0; visibility: hidden; transition: opacity var(--animation-speed) ease, visibility var(--animation-speed) ease; }
.modal.show { opacity: 1; visibility: visible; }
.modal.show .modal-content { animation: modalSlideIn var(--animation-speed) ease-out forwards; }
@keyframes modalSlideIn { from { transform: translateY(-30px) scale(0.98); opacity: 0; } to { transform: translateY(0) scale(1); opacity: 1; } }
.modal-content { background-color: var(--container-bg); margin: auto; padding: 25px 30px; border: 1px solid var(--border-color); width: 95%; max-width: 850px; border-radius: 8px; box-shadow: 0 5px 20px rgba(0, 0, 0, 0.25); display: flex; flex-direction: column; max-height: 90vh; }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding-bottom: 15px; border-bottom: 1px solid var(--section-border); margin-bottom: 20px; flex-shrink: 0; }
.modal-header h3 { margin: 0; font-size: 1.5rem; color: var(--primary-color); }
.modal-header h3 i { margin-left: 10px; }
.modal-close-btn { color: var(--secondary-color); float: left; font-size: 2rem; font-weight: bold; background: none; border: none; cursor: pointer; padding: 0 5px; line-height: 1; transition: color 0.2s ease, transform 0.2s ease; }
.modal-close-btn:hover, .modal-close-btn:focus { color: var(--error-color); transform: scale(1.1); }
.modal-body { flex-grow: 1; display: flex; flex-direction: column; overflow: hidden; }
/* Editor Toolbar */
.editor-toolbar { display: flex; flex-wrap: wrap; gap: 10px 15px; margin-bottom: 15px; align-items: center; padding: 12px 15px; border-radius: 6px; background-color: var(--toolbar-bg); border: 1px solid var(--border-color); flex-shrink: 0; }
.toolbar-group { display: flex; align-items: center; gap: 8px; }
.toolbar-group.format-group button { min-width: 38px; padding: 6px 8px; font-size: 1rem; }
.toolbar-group.find-replace-group { flex-grow: 1; gap: 10px; }
.toolbar-group label { font-size: 0.9rem; white-space: nowrap; font-weight: bold; color: var(--secondary-color); }
.editor-input { padding: 6px 10px; border: 1px solid var(--input-border); border-radius: 4px; font-size: 0.9rem; background-color: var(--input-bg); color: var(--text-color); transition: border-color 0.2s, box-shadow 0.2s; }
.editor-input:focus { border-color: var(--input-focus-border); outline: none; box-shadow: var(--input-focus-shadow); }
.editor-input.small-input { max-width: 160px; }
.editor-button { padding: 6px 10px; font-size: 0.9rem; background-color: var(--secondary-color); color: white; border: none; border-radius: 4px; cursor: pointer; transition: background-color 0.2s, transform 0.1s; }
.editor-button:hover:not(:disabled) { background-color: #545b62; transform: translateY(-1px); }
.editor-button:active:not(:disabled) { transform: translateY(0); }
.editor-button i { margin: 0 3px; }
.format-button i { font-size: 1em; }
/* Color Picker */
.color-picker-label { cursor: pointer; padding: 5px; display: inline-block; line-height: 1; border: 1px solid transparent; border-radius: 4px; transition: background-color 0.2s; }
.color-picker-label:hover { background-color: rgba(128,128,128, 0.1); }
.color-picker-label i { font-size: 1.2em; color: var(--secondary-color); vertical-align: middle; }
#fontColorPicker { width: 25px; height: 25px; border: none; padding: 0; background: none; cursor: pointer; vertical-align: middle; border-radius: 3px; overflow: hidden; }
#fontColorPicker::-webkit-color-swatch-wrapper { padding: 0; }
#fontColorPicker::-webkit-color-swatch { border: 1px solid var(--border-color); border-radius: 3px; }
#fontColorPicker::-moz-color-swatch { border: 1px solid var(--border-color); border-radius: 3px; }
/* Editor Area */
.editor-area { display: flex; flex-grow: 1; overflow: hidden; border: 1px solid var(--input-border); border-radius: 5px; background-color: var(--input-bg); }
.line-numbers { width: 45px; padding: 10px 5px 10px 0; font-family: monospace, 'Vazirmatn', sans-serif; font-size: 0.9rem; line-height: 1.7; color: var(--line-number-text); background-color: var(--line-number-bg); text-align: right; user-select: none; overflow: hidden; border-left: 1px solid var(--border-color); flex-shrink: 0; direction: ltr; }
.line-numbers div { padding-right: 5px; min-height: calc(0.9rem * 1.7); /* Match line height */ }
.editor-textarea { width: 100%; flex-grow: 1; border: none; border-radius: 0; padding: 10px; font-family: monospace, 'Vazirmatn', sans-serif; font-size: 0.9rem; line-height: 1.7; background-color: transparent; color: var(--text-color); resize: none; direction: ltr; text-align: left; min-height: 300px; overflow-y: scroll; white-space: pre; word-wrap: normal; overflow-x: auto; }
.editor-textarea:focus { outline: none; box-shadow: none; }
/* Modal Footer */
.modal-footer { margin-top: 20px; padding-top: 15px; border-top: 1px solid var(--section-border); display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-shrink: 0; }
.editor-status { font-size: 0.85rem; color: var(--secondary-color); flex-grow: 1; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.modal-footer .action-button { font-size: 1rem; }
.modal-footer div { display: flex; gap: 10px; }

/* --- Responsive Design --- */
@media (max-width: 768px) {
    .container { padding: 15px 20px; }
    header h1 { font-size: 1.6rem; }
    .options-grid { grid-template-columns: 1fr; gap: 20px; }
    #resultsList li { flex-direction: column; align-items: flex-start; gap: 12px; }
    #resultsList .result-actions { margin-top: 10px; width: 100%; justify-content: flex-start; }
    .drop-zone { padding: 25px; }
    .drop-zone p { font-size: 1rem; }
    .file-label { font-size: 1rem; padding: 10px 20px; }
    .modal-content { width: 95%; padding: 20px; max-height: 95vh; }
    .editor-toolbar { flex-direction: column; align-items: stretch; gap: 12px; }
    .toolbar-group { width: 100%; justify-content: space-between; }
    .toolbar-group.find-replace-group { flex-direction: column; align-items: stretch; gap: 8px; }
    .editor-input.small-input { max-width: none; }
    .editor-textarea { min-height: 250px; }
}
@media (max-width: 480px) {
    body { font-size: 15px; }
    header { flex-direction: column; gap: 15px; text-align: center; }
    header h1 { font-size: 1.4rem; }
    .theme-toggle-btn { position: absolute; top: 15px; left: 15px; }
    .file-list li span:first-child { max-width: 65%; }
    .action-button { font-size: 1rem; padding: 10px 20px; }
    .convert-button { font-size: 1.1rem; padding: 12px 25px; }
    section h2, #previewAreaWrapper h2 { font-size: 1.3rem; }
    .modal-footer { flex-direction: column-reverse; align-items: stretch; gap: 15px; }
    .modal-footer div { display: flex; justify-content: space-around; flex-wrap: wrap; gap: 8px; }
    .modal-footer .action-button { flex-grow: 1; min-width: 100px; }
    .editor-status { margin-bottom: 10px; text-align: center; }
    .editor-textarea { min-height: 200px; font-size: 0.9rem;}
    .line-numbers { width: 35px; font-size: 0.85rem; }
    .toolbar-group.format-group { justify-content: space-around; }
    .toolbar-group.find-replace-group { gap: 10px; }
}

/* --- Animation Keyframes --- */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

