/* Основные стили */
:root {
    --primary-color: #3498db;
    --secondary-color: #2ecc71;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --info-color: #9b59b6;
    --dark-color: #2c3e50;
    --light-color: #ecf0f1;
    --gray-color: #95a5a6;
    --border-radius: 8px;
    --box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
    padding: 20px;
}

/* Header */
header {
    background: linear-gradient(90deg, var(--dark-color), var(--primary-color));
    color: white;
    padding: 30px;
    border-radius: var(--border-radius);
    margin-bottom: 30px;
    box-shadow: var(--box-shadow);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
}

h1 {
    font-size: 2.2rem;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.description {
    font-size: 1.1rem;
    opacity: 0.9;
    max-width: 800px;
    margin: 0 auto;
}

/* Статистика */
.stats-container {
    max-width: 1200px;
    margin: 0 auto 30px;
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.stat-item {
    background: white;
    border-radius: var(--border-radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--box-shadow);
    transition: var(--transition);
}

.stat-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.stat-icon {
    background: var(--primary-color);
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-info {
    flex: 1;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--dark-color);
    line-height: 1;
}

.stat-label {
    color: var(--gray-color);
    font-size: 0.9rem;
    margin-top: 5px;
}

/* Основной контейнер */
.main-container {
    max-width: 1200px;
    margin: 0 auto 30px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 30px;
}

@media (max-width: 1100px) {
    .main-container {
        grid-template-columns: 1fr;
    }
}

/* Панели */
.panel {
    background: white;
    border-radius: var(--border-radius);
    padding: 30px;
    box-shadow: var(--box-shadow);
}

.panel-header {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--light-color);
}

.panel-header h2 {
    color: var(--dark-color);
    font-size: 1.5rem;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.panel-header p {
    color: var(--gray-color);
}

/* Формы */
.input-group {
    margin-bottom: 25px;
}

label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--dark-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

textarea {
    width: 100%;
    min-height: 150px;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: var(--border-radius);
    font-size: 16px;
    font-family: inherit;
    resize: vertical;
    transition: var(--transition);
    white-space: pre;
    overflow-wrap: normal;
    overflow-x: auto;
    line-height: 1.5;
}

textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

.char-count {
    text-align: right;
    margin-top: 8px;
    color: var(--gray-color);
    font-size: 0.9rem;
}

/* Кнопки */
.button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin: 25px 0;
}

.btn {
    padding: 14px 28px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex: 1;
    min-width: 200px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-secondary {
    background: var(--gray-color);
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

.btn-success {
    background: var(--secondary-color);
    color: white;
}

.btn-success:hover {
    background: #27ae60;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-warning {
    background: var(--warning-color);
    color: white;
}

.btn-warning:hover {
    background: #d35400;
}

.btn-info {
    background: var(--info-color);
    color: white;
}

.btn-info:hover {
    background: #8e44ad;
}

.btn-outline {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-outline:hover {
    background: var(--primary-color);
    color: white;
}

.btn-small {
    padding: 8px 16px;
    font-size: 14px;
    min-width: auto;
}

/* Результаты */
.result-container {
    background: var(--light-color);
    border-radius: var(--border-radius);
    padding: 25px;
    margin-top: 25px;
    border-left: 5px solid var(--primary-color);
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #ddd;
}

.result-header h3 {
    color: var(--dark-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.result-content {
    font-size: 16px;
    line-height: 1.8;
    padding: 15px;
    background: white;
    border-radius: var(--border-radius);
    max-height: 400px;
    overflow-y: auto;
}

.removed-info {
    margin-top: 15px;
    padding: 12px;
    background: #ffeaa7;
    border-radius: var(--border-radius);
    color: #d35400;
    font-weight: 600;
}

/* Облако слов */
.words-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 15px;
}

.word-item {
    background: var(--danger-color);
    color: white;
    padding: 8px 16px;
    border-radius: 50px;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
}

.word-item:hover {
    background: #c0392b;
    transform: scale(1.05);
}

.word-item .delete-word {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.server-info {
    margin-top: 15px;
    padding: 10px;
    background: #dfe6e9;
    border-radius: var(--border-radius);
    color: var(--dark-color);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* История */
.history-container {
    max-width: 1200px;
    margin: 0 auto;
}

.history-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: var(--light-color);
    border-radius: var(--border-radius);
}

.history-stats {
    font-weight: 600;
    color: var(--dark-color);
}

.history-list {
    max-height: 400px;
    overflow-y: auto;
}

.empty-history {
    text-align: center;
    padding: 50px 20px;
    color: var(--gray-color);
}

.empty-history i {
    margin-bottom: 20px;
    opacity: 0.5;
}

.history-item {
    background: white;
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 15px;
    border-left: 4px solid var(--secondary-color);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.history-date {
    font-weight: 600;
    color: var(--dark-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.history-removed {
    background: var(--danger-color);
    color: white;
    padding: 4px 12px;
    border-radius: 50px;
    font-size: 0.8rem;
}

.history-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 768px) {
    .history-content {
        grid-template-columns: 1fr;
    }
}

.history-original, .history-cleaned {
    padding: 15px;
    border-radius: var(--border-radius);
}

.history-original {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
}

.history-cleaned {
    background: #d4edda;
    border: 1px solid #c3e6cb;
}

.history-label {
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.history-text {
    font-size: 14px;
    line-height: 1.5;
}

/* Модальное окно */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: white;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 500px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    padding: 20px;
    background: var(--dark-color);
    color: white;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    display: flex;
    align-items: center;
    gap: 10px;
}

.close-modal {
    font-size: 24px;
    cursor: pointer;
    transition: var(--transition);
}

.close-modal:hover {
    color: var(--danger-color);
}

.modal-body {
    padding: 30px 20px;
}

.modal-footer {
    padding: 20px;
    background: #f8f9fa;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    display: flex;
    justify-content: flex-end;
    gap: 15px;
}

/* Уведомления */
.notification {
    position: fixed;
    top: 30px;
    right: 30px;
    background: var(--secondary-color);
    color: white;
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    display: none;
    z-index: 1001;
    animation: slideInRight 0.3s ease;
    max-width: 400px;
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.notification-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Футер */
footer {
    margin-top: 50px;
    background: var(--dark-color);
    color: white;
    border-radius: var(--border-radius);
    overflow: hidden;
}

.footer-content {
    padding: 40px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 40px;
}

.footer-info h3, .footer-tech h3 {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.footer-bottom {
    background: rgba(0, 0, 0, 0.2);
    padding: 20px;
    text-align: center;
    font-size: 0.9rem;
    color: #bdc3c7;
}

.tech-icons {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
}

.tech-item {
    background: rgba(255, 255, 255, 0.1);
    padding: 10px 20px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    gap: 10px;
}

.footer-version {
    font-size: 0.9rem;
    color: #bdc3c7;
    margin-top: 10px;
}

/* Серверные контролы */
.server-controls {
    margin-top: 30px;
    padding-top: 25px;
    border-top: 2px solid var(--light-color);
}

.server-controls h3 {
    margin-bottom: 20px;
    color: var(--dark-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Адаптивность */
@media (max-width: 768px) {
    h1 {
        font-size: 1.8rem;
        flex-direction: column;
        gap: 10px;
    }
    
    .stats {
        grid-template-columns: 1fr;
    }
    
    .main-container {
        grid-template-columns: 1fr;
    }
    
    .btn {
        min-width: 100%;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    .panel {
        padding: 20px;
    }
    
    .button-group {
        flex-direction: column;
    }
}

/***********************************************
 * СТИЛИ ДЛЯ ОТОБРАЖЕНИЯ ФРАЗ
 ***********************************************/

/* Каждая фраза в результате */
.phrase-item {
    padding: 10px 0;
    margin: 5px 0;
    border-bottom: 1px dashed #e0e0e0;
    font-size: 16px;
    line-height: 1.5;
    word-break: break-word;
}

.phrase-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.phrase-item:first-child {
    margin-top: 0;
}

/* Список удаленных фраз */
.removed-phrases-list {
    margin-top: 15px;
    padding: 15px;
    background: linear-gradient(135deg, #fff5f5 0%, #ffeaea 100%);
    border-radius: var(--border-radius);
    border-left: 4px solid var(--danger-color);
}

.removed-phrase {
    padding: 10px 12px;
    margin: 8px 0;
    background: white;
    border-radius: 4px;
    color: var(--danger-color);
    font-weight: 500;
    border: 1px solid #ffcccc;
    position: relative;
    padding-left: 30px;
}

.removed-phrase:before {
    content: "✕";
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--danger-color);
    font-weight: bold;
}

/* Сообщение при пустом результате */
.empty-message {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray-color);
    font-style: italic;
    background: #f8f9fa;
    border-radius: var(--border-radius);
    border: 2px dashed #dee2e6;
}

.empty-message i {
    font-size: 3rem;
    margin-bottom: 20px;
    opacity: 0.3;
    display: block;
}

/* Стили для скроллбара */
.result-content::-webkit-scrollbar {
    width: 8px;
}

.result-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.result-content::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.result-content::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Стили для импорта файлов */
.file-input {
    display: none;
}

/* Скрытый input для файла */
#fileImportInput {
    display: none;
}

/* Кнопка импорта в списке */
#importMinusBtn {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}