/* Semantic Analyzer Styles - 2026 Minimal Design */

:root {
    --sa-primary: #4f46e5;
    --sa-primary-light: #6366f1;
    --sa-primary-dark: #4338ca;
    --sa-secondary: #10b981;
    --sa-bg: #f9fafb;
    --sa-card-bg: #ffffff;
    --sa-text: #111827;
    --sa-text-light: #6b7280;
    --sa-border: #e5e7eb;
    --sa-hover: #f3f4f6;
    --sa-success: #10b981;
    --sa-warning: #f59e0b;
    --sa-error: #ef4444;
}

/* Основной контейнер */
.semantic-analyzer {
    padding: 2rem 0 4rem;
    background: linear-gradient(180deg, #ffffff 0%, var(--sa-bg) 100%);
    min-height: calc(100vh - 400px);
}

/* Сетка анализатора */
.analyzer-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

/* Форма анализатора */
.analyzer-form {
    background: var(--sa-card-bg);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.05);
    height: fit-content;
}

/* Табы */
.form-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    background: var(--sa-bg);
    padding: 0.5rem;
    border-radius: 12px;
}

.tab-btn {
    flex: 1;
    padding: 0.75rem 1rem;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--sa-text-light);
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn:hover {
    background: rgba(79, 70, 229, 0.08);
    color: var(--sa-primary);
}

.tab-btn.active {
    background: var(--sa-card-bg);
    color: var(--sa-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Группы форм */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--sa-text);
    margin-bottom: 0.5rem;
}

.url-input-group {
    display: flex;
    gap: 0.5rem;
}

.url-input-group input {
    flex: 1;
    padding: 0.875rem 1rem;
    border: 1px solid var(--sa-border);
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.2s;
    background: var(--sa-bg);
}

.url-input-group input:focus {
    outline: none;
    border-color: var(--sa-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.btn-secondary {
    padding: 0.875rem 1.5rem;
    background: var(--sa-bg);
    border: 1px solid var(--sa-border);
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--sa-text);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: var(--sa-hover);
    border-color: var(--sa-text-light);
}

.btn-secondary ion-icon {
    font-size: 1.2rem;
}

.form-hint {
    display: block;
    font-size: 0.85rem;
    color: var(--sa-text-light);
    margin-top: 0.5rem;
}

textarea {
    width: 100%;
    padding: 1rem;
    border: 1px solid var(--sa-border);
    border-radius: 12px;
    font-size: 1rem;
    line-height: 1.6;
    resize: vertical;
    background: var(--sa-bg);
    font-family: inherit;
}

textarea:focus {
    outline: none;
    border-color: var(--sa-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Опции формы */
.form-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.form-options select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--sa-border);
    border-radius: 10px;
    font-size: 0.95rem;
    background: var(--sa-bg);
    cursor: pointer;
}

/* Чекбоксы */
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    color: var(--sa-text);
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 1.2rem;
    height: 1.2rem;
    accent-color: var(--sa-primary);
    cursor: pointer;
}

/* Кнопки действий */
.form-actions {
    margin-top: 2rem;
}

.btn-primary {
    width: 100%;
    padding: 1rem;
    background: var(--sa-primary);
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    color: white;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    transition: all 0.2s;
}

.btn-primary:hover {
    background: var(--sa-primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 12px 24px -8px rgba(79, 70, 229, 0.3);
}

.btn-primary ion-icon {
    font-size: 1.3rem;
}

.btn-large {
    padding: 1.25rem;
    font-size: 1.125rem;
}

/* Блок предпросмотра */
.analyzer-preview {
    position: sticky;
    top: 100px;
    height: fit-content;
}

.preview-card {
    background: var(--sa-card-bg);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--sa-border);
}

.preview-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--sa-text);
}

.analysis-status {
    font-size: 0.9rem;
    color: var(--sa-text-light);
}

/* Placeholder результатов */
.results-placeholder {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--sa-bg);
    border-radius: 16px;
}

.placeholder-icon {
    font-size: 4rem;
    color: var(--sa-text-light);
    margin-bottom: 1rem;
    opacity: 0.5;
}

.results-placeholder h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--sa-text);
    margin-bottom: 0.5rem;
}

.results-placeholder p {
    color: var(--sa-text-light);
}

/* Статистика */
.results-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 1rem;
    background: var(--sa-bg);
    border-radius: 16px;
}

.stat-item {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.85rem;
    color: var(--sa-text-light);
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--sa-primary);
}

/* Таблица результатов */
.results-table-container {
    max-height: 500px;
    overflow-y: auto;
    border-radius: 12px;
    border: 1px solid var(--sa-border);
    margin-bottom: 1.5rem;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.results-table th {
    position: sticky;
    top: 0;
    background: var(--sa-bg);
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--sa-text);
    border-bottom: 1px solid var(--sa-border);
    z-index: 10;
}

.results-table td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--sa-border);
    color: var(--sa-text);
}

.results-table tbody tr:hover {
    background: var(--sa-hover);
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--sa-border);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--sa-primary), var(--sa-secondary));
    border-radius: 4px;
    transition: width 0.3s;
}

/* Кнопки результатов */
.results-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

.btn-outline {
    padding: 0.625rem 1.25rem;
    background: transparent;
    border: 1px solid var(--sa-border);
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--sa-text);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.btn-outline:hover {
    background: var(--sa-hover);
    border-color: var(--sa-text-light);
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Модальное окно */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
}

.modal.active {
    display: block;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 24px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--sa-border);
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--sa-text);
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--sa-text-light);
    padding: 0.5rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--sa-hover);
    color: var(--sa-text);
}

.modal-body {
    padding: 2rem;
    overflow-y: auto;
    max-height: calc(80vh - 80px);
}

.wordcloud {
    min-height: 400px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 1rem;
}

.cloud-word {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    color: var(--sa-primary);
    cursor: pointer;
    transition: all 0.2s;
}

.cloud-word:hover {
    transform: scale(1.1);
    color: var(--sa-primary-dark);
}

/* Адаптивность */
@media (max-width: 1024px) {
    .analyzer-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .analyzer-preview {
        position: static;
    }
    
    .page-title {
        font-size: 2rem;
    }
}

@media (max-width: 768px) {
    .semantic-analyzer {
        padding: 1.5rem 0 3rem;
    }
    
    .page-title {
        font-size: 1.75rem;
    }
    
    .page-description {
        font-size: 1rem;
    }
    
    .analyzer-form,
    .preview-card {
        padding: 1.5rem;
    }
    
    .url-input-group {
        flex-direction: column;
    }
    
    .form-options {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .checkbox-group {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .results-stats {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .stat-item {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .stat-label {
        margin-bottom: 0;
    }
    
    .results-table {
        font-size: 0.875rem;
    }
    
    .results-table th,
    .results-table td {
        padding: 0.75rem 0.5rem;
    }
    
    .seo-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .seo-content h2 {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .page-title {
        font-size: 1.5rem;
    }
    
    .analyzer-form,
    .preview-card {
        padding: 1rem;
    }
    
    .results-actions {
        flex-wrap: wrap;
    }
    
    .btn-outline {
        flex: 1;
        justify-content: center;
    }
    
    .modal-container {
        width: 95%;
    }
}

/* Анимации */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.results-table tbody tr {
    animation: fadeIn 0.3s ease forwards;
}

.results-table tbody tr:nth-child(n) {
    animation-delay: calc(n * 0.02s);
}

/* Стили для загрузки */
.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border: 3px solid var(--sa-border);
    border-top-color: var(--sa-primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* Скроллбар */
.results-table-container::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.results-table-container::-webkit-scrollbar-track {
    background: var(--sa-bg);
    border-radius: 4px;
}

.results-table-container::-webkit-scrollbar-thumb {
    background: var(--sa-border);
    border-radius: 4px;
}

.results-table-container::-webkit-scrollbar-thumb:hover {
    background: var(--sa-text-light);
}

/* Дополнительные стили */
.examples-section {
    margin: 1rem 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.examples-label {
    font-size: 0.9rem;
    color: #6b7280;
}

.example-btn {
    padding: 0.4rem 0.75rem;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    font-size: 0.85rem;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s;
}

.example-btn:hover {
    background: #4f46e5;
    color: white;
    border-color: #4f46e5;
}

.url-loading {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1rem;
    padding: 0.75rem;
    background: #f3f4f6;
    border-radius: 8px;
    color: #4b5563;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid #e5e7eb;
    border-top-color: #4f46e5;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.url-error {
    margin-top: 1rem;
    padding: 0.75rem;
    background: #fee2e2;
    border-radius: 8px;
    color: #dc2626;
    font-size: 0.9rem;
}

.modal-large {
    max-width: 900px !important;
    width: 90%;
}

.html-code-pre {
    max-height: 500px;
    overflow: auto;
    background: #1e1e1e;
    border-radius: 8px;
    padding: 1rem;
    font-size: 0.9rem;
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    justify-content: flex-end;
}

.status-success { color: #10b981 !important; }
.status-error { color: #ef4444 !important; }
.status-warning { color: #f59e0b !important; }

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