* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: #333;
    line-height: 1.6;
    padding: 20px;
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background-color: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    padding: 30px;
    overflow: hidden;
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #eaeaea;
}

h1 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 28px;
}

p {
    color: #7f8c8d;
}

.controls {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 25px;
}

.db-selector {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #dee2e6;
}

.stock-controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
}

.hint {
    font-size: 12px;
    color: #6c757d;
    margin-top: 5px;
}

.stats {
    display: flex;
    gap: 20px;
    padding-top: 15px;
    border-top: 1px solid #dee2e6;
}

.stat-item {
    background: white;
    padding: 10px 15px;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    min-width: 150px;
}

.stat-item span:first-child {
    color: #6c757d;
    display: block;
    font-size: 12px;
    margin-bottom: 5px;
}

.stat-item span:last-child {
    font-size: 20px;
    font-weight: bold;
    color: #3498db;
}

label {
    font-weight: 600;
    color: #34495e;
}

select, input {
    padding: 8px 12px;
    border: 1px solid #bdc3c7;
    border-radius: 5px;
    font-size: 14px;
}

button {
    padding: 10px 18px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    font-size: 14px;
}

button:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

button#clearDb {
    background: #e74c3c;
}

button#clearDb:hover {
    background: #c0392b;
}

.main-content {
    display: flex;
    gap: 30px;
    margin-bottom: 30px;
}

.chart-section {
    flex: 2;
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
}

.side-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.chart-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Стили для графика */
.chart-container {
    position: relative;
    width: 100%;
    height: 400px;
    background: #1e1e2e;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border: 1px solid #2a2a3a;
    margin-bottom: 20px;
}

.chart-header h3 {
    color: #2c3e50;
    font-size: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chart-header h3::before {
    content: "📊";
    font-size: 24px;
}

.chart-controls label {
    color: #34495e;
    font-weight: 500;
}

.chart-controls input {
    background: white;
    border: 1px solid #bdc3c7;
    color: #333;
    width: 60px;
    text-align: center;
}

/* Легенда графика */
.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #2c3e50;
    font-size: 13px;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    background: white;
    border: 1px solid #dee2e6;
}

.legend-item:hover {
    background: #e9ecef;
    transform: translateY(-1px);
}

.legend-color {
    width: 20px;
    height: 4px;
    border-radius: 2px;
}

.legend-item.inactive {
    opacity: 0.5;
}

.legend-item.inactive .legend-color {
    background: #666 !important;
}

/* Модальное окно */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    max-width: 90%;
    max-height: 90%;
    overflow-y: auto;
    border: 2px solid #3498db;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #3498db;
}

.modal-header h3 {
    color: #2c3e50;
    margin: 0;
    font-size: 22px;
}

.modal-close {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
}

.modal-close:hover {
    background: #c0392b;
    transform: translateY(-2px);
}

/* Таблица данных */
.data-table {
    width: 100%;
    border-collapse: collapse;
    color: #2c3e50;
    font-size: 14px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
}

.data-table th {
    background: #3498db;
    padding: 15px;
    text-align: left;
    color: white;
    font-weight: 600;
    border: none;
}

.data-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #dee2e6;
    background: white;
}

.data-table tr:nth-child(even) td {
    background: #f8f9fa;
}

.data-table tr:hover td {
    background: #e3f2fd;
}

.data-table .positive {
    color: #27ae60;
    font-weight: 600;
}

.data-table .negative {
    color: #e74c3c;
    font-weight: 600;
}

/* Остальные стили */
.stock-list-section, .data-section, .performance-section {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
}

.stock-list-section h3, .data-section h3, .performance-section h3 {
    margin-bottom: 15px;
    color: #2c3e50;
}

.stock-list-section ul {
    list-style: none;
}

.stock-list-section li {
    background: white;
    margin-bottom: 8px;
    padding: 10px 15px;
    border-radius: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 4px solid #3498db;
    transition: all 0.3s;
}

.stock-list-section li:hover {
    transform: translateX(5px);
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}

.stock-list-section li button {
    background: #e74c3c;
    padding: 2px 8px;
    font-size: 12px;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.stock-list-section li button:hover {
    background: #c0392b;
    transform: scale(1.1);
}

.data-output, .perf-result {
    margin-top: 15px;
    padding: 15px;
    background: white;
    border-radius: 5px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 12px;
    max-height: 200px;
    overflow-y: auto;
    white-space: pre-wrap;
    border: 1px solid #dee2e6;
    line-height: 1.5;
}

.info-section {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    margin-top: 20px;
}

.db-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 15px;
}

.db-info p {
    background: white;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #3498db;
    margin: 0;
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
    transition: all 0.3s;
}

.db-info p:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.db-info p:nth-child(2) {
    border-left-color: #2ecc71;
}

#systemInfo {
    background: white;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-size: 14px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
}

/* Анимации для элементов */
.container > * {
    animation: fadeInUp 0.5s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Уведомления */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    z-index: 1001;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.notification.success {
    background: #2ecc71;
    border-left: 4px solid #27ae60;
}

.notification.error {
    background: #e74c3c;
    border-left: 4px solid #c0392b;
}

.notification.info {
    background: #3498db;
    border-left: 4px solid #2980b9;
}

/* Адаптивность */
@media (max-width: 1024px) {
    .main-content {
        flex-direction: column;
    }

    .db-info {
        grid-template-columns: 1fr;
    }

    .chart-container {
        height: 350px;
    }
}

@media (max-width: 768px) {
    .controls {
        flex-direction: column;
    }

    .db-selector, .stock-controls, .chart-controls {
        flex-direction: column;
        align-items: stretch;
    }

    button {
        width: 100%;
        margin-bottom: 5px;
    }

    .chart-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .modal-content {
        padding: 20px;
        max-width: 95%;
    }

    .data-table {
        font-size: 12px;
    }

    .data-table th,
    .data-table td {
        padding: 8px 10px;
    }

    .chart-container {
        height: 300px;
        padding: 15px;
    }
}