/* Header */
.app-header {
    background: white;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 15px 0;
}

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

.logo {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.logo-icon {
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    font-size: 20px;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.logo-text span {
    color: var(--accent);
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 30px;
}

.nav-menu a {
    color: var(--secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 16px;
    padding: 8px 0;
    position: relative;
    transition: color 0.3s ease;
}

.nav-menu a:hover,
.nav-menu a.active {
    color: var(--accent);
}

.nav-menu a.active::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--accent);
    border-radius: 2px;
}

/* Hero section */
.hero {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 50px;
    align-items: center;
    padding: 60px 0;
}

.hero-content h1 {
    font-size: 2.8rem;
    margin-bottom: 20px;
}

.hero-content p {
    font-size: 1.2rem;
    color: var(--gray);
    margin-bottom: 30px;
    line-height: 1.7;
}

.stats-card {
    background: white;
    border-radius: var(--radius);
    padding: 30px;
    box-shadow: var(--shadow);
}

.stat {
    display: flex;
    align-items: center;
    margin-bottom: 25px;
}

.stat:last-child {
    margin-bottom: 0;
}

.stat i {
    background: var(--light);
    color: var(--accent);
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin-right: 15px;
}

.stat h3 {
    margin: 0;
    font-size: 1.8rem;
}

.stat p {
    color: var(--gray);
    margin: 5px 0 0;
}

/* Market Overview */
.market-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.overview-card {
    background: white;
    border-radius: var(--radius);
    padding: 25px;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease;
}

.overview-card:hover {
    transform: translateY(-5px);
}

.overview-card h3 {
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--gray);
    margin-bottom: 10px;
}

.overview-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

/* Auctions Preview */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.auctions-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.auction-card {
    background: white;
    border-radius: var(--radius);
    padding: 25px;
    box-shadow: var(--shadow);
    border-top: 4px solid var(--accent);
}

.auction-card h3 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.auction-id {
    font-family: monospace;
    background: var(--light);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.9rem;
}

.auction-meta {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    color: var(--gray);
    font-size: 0.9rem;
}

.auction-volume {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    margin: 15px 0;
}

.status-badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.status-active {
    background: #d4edda;
    color: #155724;
}

.status-completed {
    background: #cce5ff;
    color: #004085;
}

/* Footer */
.app-footer {
    background: var(--primary);
    color: white;
    padding: 50px 0 20px;
    margin-top: 60px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 40px;
    margin-bottom: 40px;
}

.footer-section h4 {
    color: white;
    margin-bottom: 20px;
    font-size: 1.2rem;
}

.footer-section p, .footer-section a {
    color: #bdc3c7;
    margin-bottom: 10px;
    text-decoration: none;
    display: block;
    transition: color 0.3s ease;
}

.footer-section a:hover {
    color: white;
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: #bdc3c7;
    font-size: 0.9rem;
}

/* Таблицы */
.auctions-table {
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.table-header {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
    background: var(--light);
    padding: 15px 20px;
    font-weight: 600;
    color: var(--primary);
    border-bottom: 2px solid var(--border);
}

.table-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border);
    align-items: center;
}

.table-row:last-child {
    border-bottom: none;
}

/* Стили для формы создания аукциона */
.auctions-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
}

.auctions-controls .filters {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.auctions-controls select {
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
    font-size: 14px;
    min-width: 150px;
}

.auctions-container {
    background: white;
    border-radius: var(--radius);
    padding: 25px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.info-card {
    background: #f8f9fa;
    border-radius: var(--radius);
    padding: 25px;
    border-left: 4px solid var(--accent);
    margin-top: 30px;
}

.info-card h3 {
    color: var(--accent);
    margin-bottom: 15px;
}

.info-card p {
    margin-bottom: 10px;
    color: var(--secondary);
    padding-left: 10px;
}

.no-data {
    text-align: center;
    padding: 40px;
    color: var(--gray);
    font-size: 1.1rem;
}

/* Улучшенные стили для таблицы */
.auctions-table {
    width: 100%;
    overflow-x: auto;
}

.table-header {
    display: grid;
    grid-template-columns: 150px 150px 150px 120px 150px;
    background: #f8f9fa;
    padding: 15px 20px;
    font-weight: 600;
    color: var(--primary);
    border-bottom: 2px solid var(--border);
    min-width: 700px;
}

.table-row {
    display: grid;
    grid-template-columns: 150px 150px 150px 120px 150px;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border);
    align-items: center;
    min-width: 700px;
}

.table-row:hover {
    background: #f8fafc;
}

.fuel-type.ai-95 { color: #3498db; font-weight: 600; }
.fuel-type.ai-92 { color: #e74c3c; font-weight: 600; }
.fuel-type.дт { color: #2ecc71; font-weight: 600; }

/* Адаптивность для таблицы */
@media (max-width: 768px) {
    .auctions-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .auctions-controls .filters {
        flex-direction: column;
        align-items: stretch;
    }
    
    .auctions-controls select {
        width: 100%;
    }
    
    .table-header, .table-row {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 10px;
        min-width: unset;
    }
}

/* Адаптивность */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 15px;
    }
    
    .nav-menu {
        gap: 15px;
    }
    
    .hero {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .hero-content h1 {
        font-size: 2.2rem;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .market-overview {
        grid-template-columns: 1fr;
    }
    
    .auctions-list {
        grid-template-columns: 1fr;
    }
    
    .table-header, .table-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }
}

.new-badge {
    display: inline-block;
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.65rem;
    font-weight: 600;
    margin-left: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

/* Подсветка созданных пользователем аукционов */
.auction-id.user-created {
    color: #e74c3c;
    font-weight: bold;
    position: relative;
}

.auction-id.user-created::before {
    content: "★";
    color: #f39c12;
    margin-right: 5px;
}

/* Анимация подсветки новой строки */
.table-row.new-auction {
    background: #f8fafc;
    border-left: 4px solid #3498db;
    animation: highlightRow 3s ease;
    position: relative;
}

.table-row.new-auction::after {
    content: "Новый";
    position: absolute;
    top: 10px;
    right: 10px;
    background: #3498db;
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
}

@keyframes highlightRow {
    0% { 
        background: #e3f2fd; 
        box-shadow: 0 0 15px rgba(52, 152, 219, 0.3);
    }
    70% { 
        background: #f0f7ff; 
        box-shadow: 0 0 5px rgba(52, 152, 219, 0.1);
    }
    100% { 
        background: #f8fafc; 
        box-shadow: none;
    }
}

/* Улучшенные стили для карточек аукционов */
.auction-card .auction-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.auction-bids {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #7f8c8d;
    font-size: 0.9rem;
}

.auction-bids i {
    color: #3498db;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
}

/* Стили для фильтров */
.filters select {
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
    font-size: 14px;
    min-width: 150px;
    transition: all 0.3s;
}

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

/* Информационная карточка */
.info-card {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: var(--radius);
    padding: 25px;
    border-left: 4px solid var(--accent);
    margin-top: 30px;
}

.info-card h3 {
    color: var(--accent);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.info-card p {
    margin-bottom: 10px;
    color: var(--secondary);
    padding-left: 10px;
    position: relative;
}

.info-card p::before {
    content: "•";
    color: var(--accent);
    font-weight: bold;
    position: absolute;
    left: 0;
}

/* Состояния загрузки */
#auctionsLoading {
    text-align: center;
    padding: 40px;
    color: #7f8c8d;
}

#auctionsLoading i {
    margin-right: 10px;
}

/* Адаптивность для модального окна */
@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
    
    .modal-content {
        width: 95%;
        max-height: 95vh;
    }
    
    .modal-footer {
        flex-direction: column;
    }
    
    .modal-footer button {
        width: 100%;
    }
}

/* Стили для бейджей топлива в таблице */
.fuel-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
}

.fuel-badge.ai-95 {
    background: rgba(52, 152, 219, 0.1);
    color: #3498db;
    border: 1px solid rgba(52, 152, 219, 0.3);
}

.fuel-badge.ai-92 {
    background: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
    border: 1px solid rgba(231, 76, 60, 0.3);
}

.fuel-badge.ai-98 {
    background: rgba(155, 89, 182, 0.1);
    color: #9b59b6;
    border: 1px solid rgba(155, 89, 182, 0.3);
}

.fuel-badge.дт {
    background: rgba(46, 204, 113, 0.1);
    color: #2ecc71;
    border: 1px solid rgba(46, 204, 113, 0.3);
}

/* Индикаторы трендов в таблице */
.trend-indicator {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
}

.trend-indicator.positive {
    background: rgba(39, 174, 96, 0.1);
    color: #27ae60;
}

.trend-indicator.negative {
    background: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
}

.trend-indicator.neutral {
    background: rgba(243, 156, 18, 0.1);
    color: #f39c12;
}

/* Дополнительные стили для страницы аналитики */

.text-primary { color: #3498db !important; }
.text-success { color: #27ae60 !important; }
.text-warning { color: #f39c12 !important; }
.text-danger { color: #e74c3c !important; }
.text-info { color: #17a2b8 !important; }

/* Анимации для графиков */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(20px);
    }
}

.chart-container {
    animation: slideIn 0.5s ease;
}

/* Кастомный скроллбар для таблицы */
.data-table-container::-webkit-scrollbar {
    height: 8px;
}

.data-table-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.data-table-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.data-table-container::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Стили для тултипов */
.chartjs-tooltip {
    background: rgba(44, 62, 80, 0.9) !important;
    border-radius: 6px !important;
    padding: 10px 15px !important;
    border: none !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15) !important;
}

.chartjs-tooltip-key {
    display: inline-block;
    width: 10px;
    height: 10px;
    margin-right: 8px;
    border-radius: 2px;
}

/* Адаптивные улучшения */
@media (max-width: 768px) {
    .analytics-dashboard {
        grid-template-columns: 1fr;
    }
    
    .chart-wrapper {
        height: 250px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .data-table {
        font-size: 0.9rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 10px 8px;
    }
    
    .trend-indicator {
        font-size: 0.75rem;
        padding: 3px 8px;
    }
}

/* Темная тема для графиков */
@media (prefers-color-scheme: dark) {
    .chart-container,
    .stats-card,
    .comparison-card,
    .filters-panel,
    .data-table-container {
        background: #2c3e50;
        color: #ecf0f1;
    }
    
    .chart-title,
    .stats-card h3,
    .comparison-card h3 {
        color: #ecf0f1;
    }
    
    .stat-item {
        background: #34495e;
    }
    
    .stat-value {
        color: #ecf0f1;
    }
    
    .data-table th {
        background: #34495e;
        color: #ecf0f1;
    }
    
    .data-table tr:hover {
        background: #3a506b;
    }
}

.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 600;
    background: #3498db;
    color: white;
    min-width: 20px;
    text-align: center;
}

/* Стили для таблицы с действиями */
.table-header {
    display: grid;
    grid-template-columns: 150px 120px 120px 100px 150px 150px;
    background: #f8f9fa;
    padding: 15px 20px;
    font-weight: 600;
    color: var(--primary);
    border-bottom: 2px solid var(--border);
    min-width: 800px;
}

.table-row {
    display: grid;
    grid-template-columns: 150px 120px 120px 100px 150px 150px;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border);
    align-items: center;
    min-width: 800px;
}

/* Иконка пользователя в ID */
.auction-id.user-created {
    display: flex;
    align-items: center;
    gap: 5px;
}

.auction-id.user-created i {
    color: #3498db;
}

/* Кнопки действий в компактном виде */
.action-buttons {
    display: flex;
    gap: 5px;
    justify-content: center;
}

.btn-view, .btn-edit, .btn-delete {
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    font-size: 0.8rem;
}

/* Состояния аукционов */
.status-badge.status-cancelled {
    background: #f8d7da;
    color: #721c24;
}

.status-badge.status-pending {
    background: #fff3cd;
    color: #856404;
}

/* Стили для пустого состояния */
.empty-state .btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 15px;
}

/* Анимация удаления */
.table-row.removing {
    animation: slideOutLeft 0.3s ease;
    background: #f8d7da;
}

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

/* Контейнер уведомлений */
#notificationsContainer {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
}

/* Адаптивность для таблицы с действиями */
@media (max-width: 768px) {
    .table-header, .table-row {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 10px;
        min-width: unset;
    }
    
    .action-buttons {
        justify-content: flex-start;
        margin-top: 10px;
    }
    
    .auction-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .user-auctions-filter {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Стили для модальных окон на мобильных */
@media (max-width: 480px) {
    .modal-content {
        width: 95%;
        margin: 10px;
    }
    
    .confirm-actions {
        flex-direction: column;
    }
    
    .confirm-actions button {
        width: 100%;
    }
}

canvas {
    max-width: 100%;
    height: 300px !important;
}

.chart-wrapper {
    position: relative;
    height: 300px;
    margin-top: 20px;
    width: 100%;
}

/* Убедитесь что canvas имеет правильные размеры */
#priceChart,
#regionChart {
    width: 100% !important;
    height: 300px !important;
}

/* Стили для легенды */
.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #f0f0f0;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #7f8c8d;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

/* Адаптивность графиков */
@media (max-width: 768px) {
    .chart-wrapper {
        height: 250px;
    }
    
    canvas {
        height: 250px !important;
    }
    
    .chart-legend {
        flex-direction: column;
        gap: 8px;
    }
}