/**
 * Основные стили для Аналитического Дашборда
 * Современный дизайн с использованием CSS Grid и Flexbox
 */

/* CSS Reset и базовые стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #2d3748;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Основной контейнер приложения */
.app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Заголовок */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding: 2rem 1rem;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.header__title {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.header__subtitle {
    font-size: 1.1rem;
    color: #718096;
    font-weight: 400;
}

/* Панель управления */
.controls {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding: 1.5rem 1rem;
    margin-bottom: 2rem;
    border-radius: 0 0 20px 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.controls__section h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #2d3748;
    margin: 0 0 1rem 0;
}

.controls__buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
}

/* Кнопки */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    min-width: 140px;
    gap: 0.5rem;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn:active {
    transform: translateY(1px);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn--primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn--primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.6);
}

.btn--secondary {
    background: linear-gradient(135deg, #4fd1c7, #06b6d4);
    color: white;
    box-shadow: 0 4px 15px rgba(79, 209, 199, 0.4);
}

.btn--secondary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(79, 209, 199, 0.6);
}

.btn--info {
    background: linear-gradient(135deg, #4299e1, #3182ce);
    color: white;
    box-shadow: 0 4px 15px rgba(66, 153, 225, 0.4);
}

.btn--info:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(66, 153, 225, 0.6);
}

.btn--warning {
    background: linear-gradient(135deg, #ed8936, #dd6b20);
    color: white;
    box-shadow: 0 4px 15px rgba(237, 137, 54, 0.4);
}

.btn--warning:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(237, 137, 54, 0.6);
}

/* Дашборд */
.dashboard {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    padding: 0 1rem 2rem;
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
    justify-content: center;
    align-items: flex-start;
}

.dashboard__empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 2rem;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    border: 2px dashed rgba(102, 126, 234, 0.3);
    color: #718096;
    font-size: 1.1rem;
    font-weight: 500;
}

/* Уведомления */
.app-notification {
    position: fixed;
    top: 2rem;
    right: 2rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    border-left: 4px solid #4299e1;
    z-index: 1000;
    transform: translateX(400px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 400px;
}

.app-notification--show {
    transform: translateX(0);
    opacity: 1;
}

.app-notification--success {
    border-left-color: #48bb78;
}

.app-notification--error {
    border-left-color: #f56565;
}

.app-notification--info {
    border-left-color: #4299e1;
}

.app-notification__content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
}

.app-notification__message {
    font-weight: 500;
    color: #2d3748;
}

.app-notification__close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #a0aec0;
    cursor: pointer;
    padding: 0;
    margin-left: 1rem;
    transition: color 0.2s;
}

.app-notification__close:hover {
    color: #718096;
}

/* Индикатор загрузки */
.app-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.app-loader__content {
    background: white;
    padding: 2rem;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.app-loader__spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e2e8f0;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

.app-loader__message {
    font-weight: 500;
    color: #2d3748;
}

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

/* Адаптивность */
@media (min-width: 2000px) {
    .dashboard {
        max-width: 2200px;
        gap: 2.5rem;
    }
}

@media (max-width: 1600px) {
    .dashboard {
        gap: 2rem;
    }
}

@media (max-width: 1200px) {
    .dashboard {
        gap: 1.5rem;
    }
}

@media (max-width: 800px) {
    .dashboard {
        gap: 1.25rem;
    }
}

@media (max-width: 768px) {
    .header__title {
        font-size: 2rem;
    }
    
    .controls__header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .controls__buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .btn {
        width: 100%;
        max-width: 300px;
    }
    
    .dashboard {
        gap: 1.5rem;
        padding: 0 1rem 1rem;
        justify-content: center;
    }
    
    .widget {
        width: 100%;
        max-width: 400px;
        height: 400px;
        margin: 0 auto;
    }
    
    .app-notification {
        top: 1rem;
        right: 1rem;
        left: 1rem;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 1.5rem 1rem;
    }
    
    .header__title {
        font-size: 1.75rem;
    }
    
    .controls {
        padding: 1rem;
    }
    
    .dashboard {
        padding: 0 0.5rem 1rem;
    }
    
    .widget {
        width: 100%;
        max-width: 350px;
        height: 350px;
        margin: 0 auto;
    }
}

/* Анимации появления */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dashboard > * {
    animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Улучшения для темной темы (если поддерживается) */
@media (prefers-color-scheme: dark) {
    body {
        background: linear-gradient(135deg, #1a202c 0%, #2d3748 100%);
    }
    
    .header {
        background: rgba(26, 32, 44, 0.95);
        color: #e2e8f0;
    }
    
    .controls {
        background: rgba(26, 32, 44, 0.9);
    }
    
    .controls__section h3 {
        color: #e2e8f0;
    }
    
    .dashboard__empty {
        background: rgba(26, 32, 44, 0.9);
        color: #a0aec0;
        border-color: rgba(102, 126, 234, 0.5);
    }
}
