/* Основные стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* Карточки */
.card {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    overflow: hidden;
    margin-bottom: 20px;
}

/* Шапка */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

.header h1 {
    font-size: 28px;
    margin-bottom: 10px;
}

.header p {
    opacity: 0.9;
    font-size: 14px;
}

/* Контент */
.content {
    padding: 30px;
}

/* Формы */
.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

input[type="url"] {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s;
}

input[type="url"]:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.1);
}

/* Кнопки */
button, .export-btn, .copy-report-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

button:hover, .export-btn:hover, .copy-report-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102,126,234,0.4);
}

/* Загрузка */
.loading {
    display: none;
    text-align: center;
    padding: 20px;
}

.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Результаты */
.result {
    background: white;
    border-radius: 20px;
    padding: 30px;
    margin-top: 30px;
    animation: fadeIn 0.5s;
}

.result.has-violations {
    border-left: 4px solid #e53e3e;
}

.result.no-violations {
    border-left: 4px solid #4caf50;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    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 #e0e0e0;
}

.url-display {
    background: #f7f7f7;
    padding: 10px;
    border-radius: 8px;
    font-family: monospace;
    word-break: break-all;
}

.url-display a {
    color: #667eea;
    text-decoration: none;
}

.url-display a:hover {
    text-decoration: underline;
}

.status-badge {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
}

.status-badge.danger {
    background: #fee;
    color: #e53e3e;
}

.status-badge.success {
    background: #e8f5e9;
    color: #4caf50;
}

/* Элементы нарушений */
.violations-list h3,
.statistics-section h3 {
    margin: 20px 0 15px 0;
    color: #333;
}

.violation-item {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    margin-bottom: 20px;
    overflow: hidden;
    transition: box-shadow 0.3s;
}

.violation-item:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.violation-header {
    background: #f8f9fa;
    padding: 15px 20px;
    border-bottom: 1px solid #e0e0e0;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.violation-header h4 {
    color: #e53e3e;
    margin: 0;
    font-size: 16px;
}

.violation-badge {
    display: inline-block;
    padding: 2px 8px;
    background: #e0e0e0;
    border-radius: 12px;
    font-size: 11px;
    margin-left: 10px;
}

.violation-count {
    background: #e53e3e;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    margin-right: 10px;
}

.toggle-icon {
    font-size: 20px;
    transition: transform 0.3s;
}

.violation-body {
    padding: 20px;
    display: none;
}

.violation-body.expanded {
    display: block;
}

.violation-details {
    margin-bottom: 20px;
}

.violation-details h5,
.code-snippets h5,
.fix-suggestion h5 {
    margin-bottom: 10px;
    color: #555;
    font-size: 14px;
}

.violation-details ul {
    padding-left: 20px;
}

.violation-details li {
    margin: 5px 0;
    color: #666;
    font-size: 13px;
    word-break: break-all;
}

/* Фрагменты кода */
.code-snippet {
    background: #1e1e1e;
    color: #d4d4d4;
    border-radius: 8px;
    margin: 10px 0;
    overflow: hidden;
}

.snippet-header {
    background: #2d2d2d;
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #3e3e3e;
}

.snippet-type {
    font-family: monospace;
    font-size: 12px;
    color: #4ec9b0;
}

.snippet-line {
    font-size: 11px;
    color: #858585;
}

.copy-btn {
    background: #0e639c;
    color: white;
    border: none;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
}

.copy-btn:hover {
    background: #1177bb;
}

.snippet-content {
    padding: 12px;
    margin: 0;
    overflow-x: auto;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.snippet-reason {
    background: #2d2d2d;
    padding: 8px 12px;
    font-size: 12px;
    border-top: 1px solid #3e3e3e;
}

.snippet-reason strong {
    color: #f48771;
}

.more-snippets {
    margin-top: 10px;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 8px;
}

.more-snippets summary {
    cursor: pointer;
    color: #667eea;
    font-size: 13px;
}

.fix-suggestion {
    margin-top: 20px;
    padding: 15px;
    background: #e8f5e9;
    border-radius: 8px;
    border-left: 3px solid #4caf50;
}

.fix-suggestion p {
    color: #2e7d32;
    font-size: 14px;
}

/* Статистика */
.summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.summary-item {
    text-align: center;
    padding: 15px;
    background: #f7f7f7;
    border-radius: 8px;
    transition: transform 0.2s;
}

.summary-item:hover {
    transform: translateY(-2px);
}

.summary-item .label {
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
}

.summary-item .value {
    font-size: 24px;
    font-weight: bold;
    color: #667eea;
}

/* Экспорт */
.export-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 10px;
    justify-content: center;
}

.export-btn, .copy-report-btn {
    background: #4caf50;
    padding: 10px 20px;
    font-size: 14px;
}

.copy-report-btn {
    background: #2196f3;
}

/* Ошибки */
.error-message {
    background: #fee;
    color: #e53e3e;
    padding: 15px;
    border-radius: 8px;
    margin-top: 20px;
    border-left: 3px solid #e53e3e;
}

/* Подвал */
.footer {
    background: white;
    border-radius: 20px;
    padding: 20px;
    text-align: center;
    margin-top: 20px;
}

.footer-content p {
    color: #666;
    font-size: 12px;
    margin: 5px 0;
}

.footer-note {
    font-size: 11px;
    color: #999;
}

/* Адаптивность */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .content {
        padding: 20px;
    }
    
    .summary {
        grid-template-columns: 1fr;
    }
    
    .result-header {
        flex-direction: column;
        gap: 10px;
    }
    
    .export-section {
        flex-direction: column;
    }
    
    .violation-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .snippet-header {
        flex-wrap: wrap;
        gap: 5px;
    }
}

/* Добавьте в конец файла style.css */

/* Карточка результатов */
.result-card {
    background: white;
    border-radius: 20px;
    padding: 30px;
    margin-top: 20px;
    animation: fadeIn 0.5s;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

/* Статистика в новой карточке */
.summary-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 20px;
    margin-bottom: 10px;
}

.summary-stats .stat {
    text-align: center;
    padding: 15px;
    background: #f7f7f7;
    border-radius: 10px;
    transition: transform 0.2s;
}

.summary-stats .stat:hover {
    transform: translateY(-2px);
}

.summary-stats .stat-value {
    display: block;
    font-size: 28px;
    font-weight: bold;
    color: #667eea;
}

.summary-stats .stat-label {
    display: block;
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

.summary-stats .stat-warning .stat-value {
    color: #e53e3e;
}

.summary-stats .stat-success .stat-value {
    color: #4caf50;
}

/* URL в результатах */
.analyzed-url {
    background: #f7f7f7;
    padding: 10px 15px;
    border-radius: 8px;
    margin-top: 15px;
    font-family: monospace;
    word-break: break-all;
}

/* Секция нарушений (новая версия) */
.violation-section {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    margin-bottom: 20px;
    overflow: hidden;
}

.violation-section .violation-header {
    background: #f8f9fa;
    padding: 15px 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.2s;
}

.violation-section .violation-header:hover {
    background: #f0f1f3;
}

.violation-icon {
    font-size: 20px;
}

.violation-title {
    flex: 1;
    font-weight: 600;
    color: #333;
}

.violation-count {
    background: #e53e3e;
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.toggle-icon {
    font-size: 16px;
    color: #999;
}

.violation-body {
    padding: 20px;
    display: none;
    border-top: 1px solid #e0e0e0;
}

.violation-body.expanded {
    display: block;
}

/* Детали нарушения */
.violation-details {
    margin-bottom: 20px;
}

.violation-details h4 {
    color: #555;
    font-size: 14px;
    margin-bottom: 10px;
}

.violation-details ul {
    padding-left: 20px;
}

.violation-details li {
    margin: 8px 0;
    color: #666;
    font-size: 13px;
}

/* Блоки с кодом (улучшенная версия) */
.code-snippets {
    margin-top: 20px;
}

.code-snippets h4 {
    color: #555;
    font-size: 14px;
    margin-bottom: 10px;
}

.code-snippet {
    background: #1e1e1e;
    border-radius: 8px;
    margin-bottom: 15px;
    overflow: hidden;
}

.snippet-header {
    background: #2d2d2d;
    padding: 10px 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    border-bottom: 1px solid #3e3e3e;
}

.snippet-type {
    font-family: monospace;
    font-size: 11px;
    color: #4ec9b0;
    background: rgba(78, 201, 176, 0.2);
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
}

.snippet-service {
    font-family: monospace;
    font-size: 11px;
    color: #ce9178;
    background: rgba(206, 145, 120, 0.2);
    padding: 2px 8px;
    border-radius: 4px;
}

.copy-btn {
    margin-left: auto;
    background: #0e639c;
    color: white;
    border: none;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    transition: background 0.2s;
}

.copy-btn:hover {
    background: #1177bb;
    transform: none;
    box-shadow: none;
}

.snippet-content {
    padding: 12px 15px;
    overflow-x: auto;
}

.snippet-content code {
    font-family: 'Courier New', 'Consolas', monospace;
    font-size: 12px;
    line-height: 1.5;
    color: #d4d4d4;
    white-space: pre-wrap;
    word-break: break-all;
}

.snippet-reason {
    background: #2d2d2d;
    padding: 10px 15px;
    font-size: 12px;
    color: #cccccc;
    border-top: 1px solid #3e3e3e;
}

.snippet-reason strong {
    color: #f48771;
}

/* Успешное сообщение */
.success-message {
    background: #e8f5e9;
    color: #2e7d32;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    font-weight: 500;
    margin: 20px 0;
    border-left: 4px solid #4caf50;
}

/* Кнопки действий */
.action-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #4caf50;
    color: white;
}

.btn-secondary:hover {
    background: #45a049;
    transform: translateY(-2px);
}

/* Адаптация для мобильных */
@media (max-width: 768px) {
    .result-card {
        padding: 20px;
    }

    .summary-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .action-buttons {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .violation-section .violation-header {
        flex-wrap: wrap;
    }

    .violation-title {
        width: 100%;
        order: 1;
    }

    .violation-count {
        order: 2;
    }

    .toggle-icon {
        order: 3;
        margin-left: auto;
    }

    .violation-icon {
        order: 0;
    }

    .snippet-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .copy-btn {
        margin-left: 0;
        width: 100%;
    }
}