/* Сброс стилей и базовые настройки */
* {
    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;
    color: #333;
}

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

/* Шапка */
header {
    background: white;
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.header-title {
    text-align: left;
}

header h1 {
    color: #667eea;
    font-size: 32px;
    margin-bottom: 10px;
}

.header-logo-link {
    color: #667eea;
    text-decoration: none;
    transition: color 0.3s ease;
}

.header-logo-link:hover {
    color: #764ba2;
}

header p {
    color: #666;
    font-size: 16px;
}

/* Алерты */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 15px;
}

.alert-error {
    background-color: #fee;
    border-left: 4px solid #ef4444;
    color: #991b1b;
}

.alert-success {
    background-color: #d1fae5;
    border-left: 4px solid #10b981;
    color: #065f46;
}

/* Карточки */
.card {
    background: white;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.card h2 {
    color: #333;
    font-size: 24px;
    margin-bottom: 20px;
}

/* Форма анализа */
.analysis-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 600;
    margin-bottom: 8px;
    color: #555;
    font-size: 14px;
}

.form-group select,
.form-group input[type="date"],
.form-group input[type="text"] {
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s ease;
}

.form-group select:focus,
.form-group input[type="date"]:focus,
.form-group input[type="text"]:focus {
    outline: none;
    border-color: #667eea;
}

.form-group input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
}

/* Кнопки */
.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-start;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    position: relative;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
    background-size: 200% 200%;
    transition: all 0.4s ease;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #764ba2 0%, #f093fb 50%, #667eea 100%);
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: -1;
    border-radius: 8px;
}

.btn-primary:hover:not(:disabled) {
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
    filter: brightness(1.1);
}

.btn-primary:hover:not(:disabled)::before {
    opacity: 1;
}

.btn-primary:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    opacity: 0.6;
    box-shadow: none;
}

.btn-secondary {
    background: #f3f4f6;
    color: #333;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.btn-secondary:hover {
    background: #e5e7eb;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.btn-danger {
    background: #ef4444;
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background: #dc2626;
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}

.btn-block {
    width: 100%;
}

.btn-small {
    padding: 8px 16px;
    font-size: 14px;
}

.btn-icon {
    font-size: 18px;
}

/* Прогресс-бар */
#progressContainer {
    margin-top: 30px;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.progress-wrapper {
    background: #f9fafb;
    padding: 25px;
    border-radius: 12px;
    border: 2px solid #e5e7eb;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

#progressTitle {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

#progressPercent {
    font-size: 18px;
    font-weight: 700;
    color: #667eea;
}

.progress-bar {
    width: 100%;
    height: 24px;
    background: #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    width: 0%;
    transition: width 0.5s ease-in-out;
    border-radius: 12px;
    position: relative;
    overflow: hidden;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255,255,255,0.3),
        transparent
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.progress-step {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    background: white;
    border-radius: 8px;
    border: 2px solid #e5e7eb;
    transition: all 0.3s ease;
}

.progress-step.active {
    border-color: #667eea;
    background: #eef2ff;
}

.progress-step.completed {
    border-color: #10b981;
    background: #d1fae5;
}

.progress-step .step-icon {
    font-size: 20px;
}

.progress-step.active .step-icon {
    animation: pulse 1s infinite;
}

.progress-step.completed .step-icon::before {
    content: '✅';
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

.progress-step .step-text {
    font-size: 13px;
    color: #666;
    font-weight: 500;
}

.progress-step.active .step-text {
    color: #667eea;
    font-weight: 600;
}

.progress-step.completed .step-text {
    color: #10b981;
}

/* Результаты */
.results-card {
    margin-top: 30px;
}

.results-header {
    margin-bottom: 25px;
}

.results-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 15px;
    padding: 15px;
    background: #f9fafb;
    border-radius: 8px;
}

.meta-item {
    font-size: 14px;
    color: #666;
}

.meta-item strong {
    color: #333;
}

/* Легенда корреляций */
.legend {
    background: #f9fafb;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 25px;
}

.legend h3 {
    font-size: 18px;
    margin-bottom: 15px;
    color: #333;
}

.legend-items {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.legend-color {
    width: 30px;
    height: 20px;
    border-radius: 4px;
    border: 1px solid #ddd;
}

/* Цвета корреляций */
.correlation-perfect { background: #667eea; }
.correlation-very-strong { background: #22c55e; }
.correlation-strong { background: #10b981; }
.correlation-medium { background: #f59e0b; }
.correlation-weak { background: #fbbf24; }
.correlation-very-weak { background: #e5e7eb; }

/* Контролы таблицы */
.table-controls {
    margin-bottom: 20px;
    padding: 15px;
    background: #f9fafb;
    border-radius: 8px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.table-controls label {
    font-weight: 600;
    color: #555;
}

/* Обертка таблицы */
.table-wrapper {
    overflow-x: auto;
    margin-bottom: 25px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

/* Таблица корреляций */
.correlation-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    font-size: 13px;
}

.correlation-table thead {
    background: #f9fafb;
    position: sticky;
    top: 0;
    z-index: 10;
}

.correlation-table th {
    padding: 12px 8px;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #e5e7eb;
}

.goal-name-header {
    min-width: 200px;
    max-width: 300px;
    position: sticky;
    left: 0;
    background: #f9fafb;
    z-index: 11;
}

.goal-header {
    min-width: 120px;
    max-width: 180px;
    vertical-align: top;
    position: relative;
}

.goal-header-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.goal-id {
    font-size: 11px;
    color: #667eea;
    font-weight: 600;
}

.goal-name {
    font-size: 12px;
    color: #666;
    line-height: 1.3;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Кнопка удаления колонки/строки */
.delete-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 4px;
    width: 20px;
    height: 20px;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.goal-header:hover .delete-btn,
.goal-name-cell:hover .delete-btn {
    display: flex;
}

.delete-btn:hover {
    background: #dc2626;
    transform: scale(1.1);
}

/* Ячейки таблицы */
.correlation-table tbody tr {
    border-bottom: 1px solid #e5e7eb;
    transition: background-color 0.3s ease;
}

.correlation-table tbody tr:hover {
    background-color: #f9fafb;
}

.correlation-table td {
    padding: 10px 8px;
    border-right: 1px solid #f3f4f6;
}

.goal-name-cell {
    position: sticky;
    left: 0;
    background: white;
    z-index: 5;
    border-right: 2px solid #e5e7eb;
    min-width: 200px;
    max-width: 300px;
    position: relative;
    transition: background-color 0.3s ease;
}

.correlation-table tbody tr:hover .goal-name-cell {
    background-color: #f9fafb;
}

.goal-cell-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.correlation-cell {
    text-align: center;
    cursor: help;
    position: relative;
}

.correlation-value {
    font-weight: 700;
    font-size: 15px;
    color: #333;
}

.correlation-description {
    font-size: 11px;
    color: #666;
    margin-top: 2px;
}

/* Строки/колонки скрыты */
.correlation-table tr.hidden,
.correlation-table td.hidden,
.correlation-table th.hidden {
    display: none;
}

/* Экспорт */
.export-section {
    margin-top: 30px;
    padding-top: 25px;
    border-top: 2px solid #e5e7eb;
}

.export-section h3 {
    font-size: 18px;
    margin-bottom: 10px;
}

.export-section p {
    color: #666;
    margin-bottom: 15px;
}

.export-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Информационная карточка */
.info-card {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.info-card h3 {
    color: #667eea;
    font-size: 20px;
    margin-top: 25px;
    margin-bottom: 15px;
}

.info-card h3:first-child {
    margin-top: 0;
}

.info-card ol, .info-card ul {
    margin-left: 20px;
    line-height: 1.8;
}

.info-card li {
    margin-bottom: 8px;
}

.info-card p {
    line-height: 1.6;
    margin-bottom: 15px;
    color: #555;
}

/* Адаптивность */
@media (max-width: 768px) {
    header h1 {
        font-size: 24px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .results-meta {
        flex-direction: column;
        gap: 10px;
    }
    
    .legend-items {
        grid-template-columns: 1fr;
    }
    
    .progress-steps {
        grid-template-columns: 1fr;
    }
    
    .export-buttons {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
}

/* Печать */
@media print {
    body {
        background: white;
        padding: 0;
    }
    
    .form-actions,
    .export-section,
    .delete-btn,
    #progressContainer {
        display: none !important;
    }
    
    .card {
        box-shadow: none;
        page-break-inside: avoid;
    }
}
/* ========================================
   СТИЛИ ДЛЯ АВТОРИЗАЦИИ И РЕГИСТРАЦИИ
   ======================================== */

/* Контейнер для форм авторизации */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.auth-box {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    max-width: 450px;
    width: 100%;
}

.auth-box h2 {
    color: #667eea;
    margin-bottom: 25px;
    text-align: center;
    font-size: 28px;
}

.form-description {
    color: #666;
    margin-bottom: 20px;
    text-align: center;
    font-size: 14px;
}

/* Формы */
.auth-form,
.account-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
    font-size: 14px;
}

.form-control {
    padding: 12px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-text {
    color: #718096;
    font-size: 13px;
    margin-top: 5px;
}

/* Ссылки под формой */
.auth-links {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
    gap: 10px;
}

.auth-links a {
    color: #667eea;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.3s ease;
}

.auth-links a:hover {
    color: #764ba2;
    text-decoration: underline;
}

/* ========================================
   БУРГЕР-МЕНЮ
   ======================================== */

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-title {
    flex: 1;
}

.header-menu {
    position: relative;
}

.burger-menu {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
}

.burger-menu span {
    display: block;
    width: 25px;
    height: 3px;
    background: #667eea;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.burger-menu:hover span {
    background: #764ba2;
}

/* Анимация превращения в крестик */
.burger-menu.active span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.burger-menu.active span:nth-child(2) {
    opacity: 0;
}

.burger-menu.active span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

.dropdown-menu {
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 10px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
}

.dropdown-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu ul {
    list-style: none;
    padding: 8px 0;
}

.dropdown-menu li {
    padding: 0;
}

.dropdown-menu a {
    display: block;
    padding: 12px 20px;
    color: #333;
    text-decoration: none;
    transition: all 0.3s ease;
    text-align: left;
}

.dropdown-menu a:hover {
    background: #f7fafc;
    color: #667eea;
}

/* ========================================
   УПРАВЛЕНИЕ АККАУНТАМИ
   ======================================== */

.accounts-container,
.account-form-container {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.accounts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.accounts-header h2 {
    color: #667eea;
    font-size: 24px;
    margin: 0;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #718096;
}

.empty-state p {
    margin: 10px 0;
}

.accounts-list {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table thead {
    background: #f7fafc;
}

.table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #4a5568;
    font-size: 14px;
}

.table td {
    padding: 12px;
    border-top: 1px solid #e2e8f0;
}

.table tr {
    transition: background 0.3s ease;
}

.table tr:hover {
    background: #f7fafc;
}

.actions {
    display: flex;
    gap: 10px;
}

.back-link {
    margin-top: 20px;
}

.back-link a {
    color: #667eea;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.3s ease;
}

.back-link a:hover {
    text-decoration: underline;
}

.account-form-container h2 {
    color: #667eea;
    margin-bottom: 25px;
}

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 10px;
}

.form-actions .btn {
    flex: 1;
}

/* ========================================
   АДАПТИВНОСТЬ
   ======================================== */

@media (max-width: 768px) {
    .auth-box {
        padding: 30px 20px;
    }

    .header-content {
        /* Убираем flex-direction: column, чтобы элементы оставались в одну строку */
        align-items: center;
        gap: 10px;
    }

    .header-title h1 {
        font-size: 18px;
        margin-bottom: 0;
    }

    .header-menu {
        flex-shrink: 0;
    }

    .accounts-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    .table {
        font-size: 14px;
    }

    .actions {
        flex-direction: column;
    }

    .form-actions {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .auth-links {
        flex-direction: column;
        text-align: center;
    }
}
