/* Analytics.css - Стили для страницы AI аналитики */

/* Панель объектов для аналитики */
.objects-panel {
    width: 320px;
    background: white;
    border-right: 1px solid #e2e8f0;
    padding: 20px;
    overflow-y: auto;
}

.panel-header {
    margin-bottom: 20px;
}

.panel-title {
    font-size: 16px;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 4px;
}

.panel-subtitle {
    font-size: 13px;
    color: #7f8c8d;
}

.search-box {
    margin-bottom: 16px;
}

.search-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #bdc3c7;
    border-radius: 6px;
    font-size: 13px;
    transition: all 0.2s;
    background: white;
}

.search-input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.1);
}

.period-selector {
    margin-bottom: 20px;
}

.filter-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 6px;
}

.form-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #bdc3c7;
    border-radius: 6px;
    font-size: 13px;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
}

.form-select:focus {
    outline: none;
    border-color: #3498db;
}

.analysis-filters {
    margin-bottom: 20px;
}

.filters-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.filter-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 6px;
    border: 1px solid #bdc3c7;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 11px;
    color: #2c3e50;
}

.filter-btn:hover {
    border-color: #3498db;
    background: #f8f9fa;
}

.filter-btn.active {
    border-color: #3498db;
    background: #3498db;
    color: white;
}

.filter-icon {
    font-size: 16px;
}

.objects-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.object-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    background: white;
}

.object-item:hover {
    border-color: #3498db;
    background: #f8f9fa;
}

.object-item.active {
    border-color: #3498db;
    background: #ebf5fb;
}

.object-info {
    flex: 1;
}

.object-name {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 2px;
    font-size: 13px;
}

.object-details {
    font-size: 11px;
    color: #7f8c8d;
}

.object-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.object-status.online {
    background: #27ae60;
}

.object-status.offline {
    background: #e74c3c;
}

/* Основная панель аналитики */
.analytics-main-panel {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8f9fa;
}

.analytics-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
}

.header-content h1 {
    font-size: 24px;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 6px;
}

.header-subtitle {
    font-size: 14px;
    color: #7f8c8d;
}

.analytics-controls {
    display: flex;
    gap: 10px;
}

.control-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: 1px solid #bdc3c7;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
    font-weight: 500;
    color: #2c3e50;
}

.control-btn.primary {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

.control-btn.primary:hover {
    background: #2980b9;
}

.control-btn.secondary:hover {
    background: #f8f9fa;
    border-color: #3498db;
}

/* Состояние приветствия */
.welcome-state {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
}

.welcome-card {
    text-align: center;
    max-width: 500px;
    padding: 30px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.welcome-icon {
    font-size: 48px;
    margin-bottom: 20px;
}

.welcome-card h2 {
    font-size: 20px;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 10px;
}

.welcome-card p {
    font-size: 14px;
    color: #7f8c8d;
    margin-bottom: 24px;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 16px;
    margin-top: 24px;
}

.feature-item {
    padding: 16px;
    background: #f8f9fa;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    text-align: center;
    transition: all 0.2s;
}

.feature-item:hover {
    border-color: #3498db;
    transform: translateY(-2px);
}

.feature-icon {
    font-size: 24px;
    margin-bottom: 10px;
}

.feature-item h4 {
    font-size: 13px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 6px;
}

.feature-item p {
    font-size: 11px;
    color: #7f8c8d;
    line-height: 1.4;
    margin: 0;
}

/* Контейнер аналитики */
.analytics-container {
    background: white;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.ai-analysis-header {
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
}

.ai-status {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ai-badge {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.analysis-type {
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
}

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

.btn {
    padding: 6px 12px;
    border: 1px solid #bdc3c7;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    color: #2c3e50;
}

.btn-primary {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-secondary:hover {
    background: #f8f9fa;
    border-color: #3498db;
}

.ai-analysis-content {
    padding: 20px;
}

.original-data-preview,
.ai-insights,
.ai-action-plan {
    margin-bottom: 20px;
}

.original-data-preview h4,
.ai-insights h4,
.ai-action-plan h4 {
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.data-summary {
    background: #f8f9fa;
    padding: 16px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.data-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.data-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: white;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
}

.data-label {
    font-size: 13px;
    color: #7f8c8d;
}

.data-value {
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
}

.ai-response-formatted {
    line-height: 1.6;
    color: #2c3e50;
    font-size: 14px;
}

.ai-response-formatted h4 {
    color: #2c3e50;
    margin: 16px 0 10px 0;
    font-size: 14px;
}

.ai-response-formatted p {
    margin-bottom: 12px;
}

.ai-response-formatted ul {
    margin: 12px 0;
    padding-left: 20px;
}

.ai-response-formatted li {
    margin-bottom: 6px;
    position: relative;
}

.ai-response-formatted strong {
    color: #2c3e50;
    font-weight: 600;
}

.ai-response-formatted em {
    color: #7f8c8d;
    font-style: italic;
}

.action-items {
    background: #e8f6f3;
    padding: 16px;
    border-radius: 6px;
    border-left: 3px solid #27ae60;
}

/* Загрузка */
.ai-loading {
    text-align: center;
    padding: 40px 30px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 2px solid #e2e8f0;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

.ai-loading h3 {
    font-size: 16px;
    color: #2c3e50;
    margin-bottom: 6px;
}

.ai-loading p {
    color: #7f8c8d;
    margin-bottom: 20px;
    font-size: 14px;
}

.loading-progress {
    max-width: 250px;
    margin: 0 auto;
}

.progress-bar {
    height: 3px;
    background: #e2e8f0;
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #3498db;
    border-radius: 2px;
    animation: progress 2s ease-in-out infinite;
}

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

@keyframes progress {
    0% { width: 0%; }
    50% { width: 70%; }
    100% { width: 100%; }
}

/* Уведомления */
.notification {
    position: fixed;
    top: 70px;
    right: 16px;
    background: white;
    padding: 12px 16px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 10000;
    max-width: 350px;
    animation: slideIn 0.3s ease-out;
}

.notification-success {
    border-left: 3px solid #27ae60;
}

.notification-error {
    border-left: 3px solid #e74c3c;
}

.notification-info {
    border-left: 3px solid #3498db;
}

.notification-icon {
    font-size: 16px;
}

.notification-message {
    flex: 1;
    color: #2c3e50;
    font-weight: 500;
    font-size: 13px;
}

.notification-close {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    color: #7f8c8d;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Модальное окно */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 8px;
    width: 90%;
    max-width: 450px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
}

.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #7f8c8d;
    padding: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.settings-group {
    margin-bottom: 20px;
}

.settings-group h4 {
    font-size: 13px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 10px;
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 13px;
    color: #2c3e50;
    padding: 6px 0;
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 16px;
    height: 16px;
    border: 2px solid #bdc3c7;
    border-radius: 3px;
    position: relative;
    transition: all 0.2s;
    flex-shrink: 0;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark {
    background: #3498db;
    border-color: #3498db;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark::after {
    content: '✓';
    position: absolute;
    color: white;
    font-size: 10px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.sensitivity-slider {
    width: 100%;
    margin: 6px 0;
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #7f8c8d;
}

/* Адаптивность */
@media (max-width: 1024px) {
    .main-content {
        flex-direction: column;
    }

    .objects-panel {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #e2e8f0;
    }

    .filters-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 768px) {
    .analytics-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .analytics-controls {
        width: 100%;
        justify-content: flex-start;
    }

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

    .data-grid {
        grid-template-columns: 1fr;
    }

    .ai-analysis-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .ai-actions {
        width: 100%;
        justify-content: flex-start;
    }
}
