/* --- ОПТИМИЗИРОВАННЫЕ СТИЛИ --- */
:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --card-bg: rgba(255,255,255,0.95);
    --card-shadow: 0 20px 40px rgba(0,0,0,0.1);
    --border-radius: 20px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
html { 
    box-sizing: border-box; 
    scroll-behavior: smooth;
}
*, *::before, *::after { box-sizing: inherit; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--primary-gradient);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* Оптимизация для прокрутки */
    overflow-x: hidden;
    will-change: scroll-position;
}
.header {
    text-align: center;
    margin-bottom: 3rem;
    color: white;
    animation: fadeInDown 0.8s ease-out;
}
.logo-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1rem;
    min-height: 80px;
}
.logo-img {
    max-width: 200px;
    max-height: 80px;
    height: auto;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}
.logo-text {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 700;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    background: linear-gradient(45deg, #fff, #f0f0f0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.logo-text .logo-ne {
    color: #b83d5a;
    -webkit-text-fill-color: #b83d5a;
    background: none;
}
.hidden-logo {
    display: none;
}
.header h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 700;
    margin-bottom: 1rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    background: linear-gradient(45deg, #fff, #f0f0f0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.header-top {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    min-height: 60px;
    padding-right: 200px; /* Место для кнопки авторизации */
}
.auth-status {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    z-index: 10;
    min-height: 40px;
}
.auth-status .btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    border-radius: 20px;
    white-space: nowrap;
}
.auth-status .user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: white;
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.2);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    backdrop-filter: blur(10px);
}
.auth-status .user-info a {
    color: white !important;
    text-decoration: none !important;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}
.auth-status .user-info a:hover {
    text-decoration: underline !important;
    opacity: 0.9;
}
.auth-status .user-info .btn-sm {
    padding: 0.25rem 0.75rem;
    font-size: 0.8rem;
}
@media (max-width: 768px) {
    .header-top {
        padding-right: 0;
    }
    .auth-status {
        position: static;
        margin-top: 1rem;
        justify-content: center;
        width: 100%;
    }
}
.header p {
    font-size: clamp(1rem, 2.5vw, 1.2rem);
    opacity: 0.9;
    font-weight: 300;
    max-width: 600px;
    margin: 0 auto;
}
.card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    padding: clamp(1.5rem, 4vw, 2rem);
    box-shadow: var(--card-shadow);
    border: 1px solid rgba(255,255,255,0.2);
    transition: var(--transition);
    height: 100%;
    position: relative;
    overflow: hidden;
    /* Оптимизация для анимаций */
    will-change: transform;
    transform: translateZ(0);
}
.card:hover {
    transform: translateY(-8px) translateZ(0);
    box-shadow: 0 25px 50px rgba(0,0,0,0.15);
}
.card h2 {
    font-size: clamp(1.2rem, 3vw, 1.5rem);
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: #2d3748;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.rate-item {
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    padding: 1rem;
    border-radius: 12px;
    border-left: 4px solid #667eea;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    /* Оптимизация для анимаций */
    will-change: transform;
    transform: translateZ(0);
}
.rate-item:hover {
    transform: translateX(4px) translateZ(0);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}
.rate-item h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 0.5rem;
}
.rate-values {
    display: flex;
    justify-content: space-between;
    font-size: 1.1rem;
    font-weight: 500;
    gap: 1rem;
}
.buy { color: #38a169; }
.sell { color: #e53e3e; }
.btn-custom {
    background: var(--primary-gradient);
    color: white;
    border: none;
    padding: 0.875rem 1.75rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    /* Оптимизация для анимаций */
    will-change: transform;
    transform: translateZ(0);
}
.btn-custom:hover {
    transform: translateY(-2px) translateZ(0);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}
.btn-custom:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}
.form-control-custom {
    padding: 0.875rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1rem;
    transition: var(--transition);
    background: white;
    width: 100%;
}
.form-control-custom:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}
.currency-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 500;
}
.currency-usd-white { background: #e6fffa; color: #234e52; }
.currency-usd-blue { background: #ebf8ff; color: #2a4365; }
.currency-eur { background: #faf5ff; color: #553c9a; }
.side-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}
.side-buy { background: #c6f6d5; color: #22543d; }
.side-sell { background: #fed7d7; color: #742a2a; }
.rating-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 500;
    background: #fef5e7;
    color: #d69e2e;
}
.rating-badge i {
    font-size: 0.7rem;
}
.table-responsive {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    /* Оптимизация для прокрутки */
    will-change: scroll-position;
    transform: translateZ(0);
}
.orders-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    /* Оптимизация для прокрутки */
    will-change: scroll-position;
}
.orders-table th,
.orders-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
    /* Оптимизация для рендеринга */
    transform: translateZ(0);
}
.orders-table th {
    background: #f7fafc;
    font-weight: 600;
    color: #4a5568;
    position: sticky;
    top: 0;
    z-index: 10;
}
.orders-table tbody tr {
    transition: background-color 0.2s ease;
    /* Оптимизация для анимаций */
    will-change: background-color;
}
.orders-table tbody tr:hover {
    background-color: #f7fafc;
}
.orders-table tr:hover {
    background: #f7fafc;
    transform: scale(1.01);
    transition: var(--transition);
}
/* Автоширина столбцов */
.orders-table th:nth-child(1), .orders-table td:nth-child(1) { width: 80px; } /* Рейтинг */
.orders-table th:nth-child(2), .orders-table td:nth-child(2) { width: 120px; } /* Пользователь */
.orders-table th:nth-child(3), .orders-table td:nth-child(3) { width: 100px; } /* Валюта */
.orders-table th:nth-child(4), .orders-table td:nth-child(4) { width: 80px; } /* Тип */
.orders-table th:nth-child(5), .orders-table td:nth-child(5) { width: 100px; } /* Сумма */
.orders-table th:nth-child(6), .orders-table td:nth-child(6) { width: 100px; } /* Курс */
.orders-table th:nth-child(7), .orders-table td:nth-child(7) { width: 120px; } /* Дата */
.orders-table th:nth-child(8), .orders-table td:nth-child(8) { width: auto; } /* Комментарий - самый широкий */
.orders-table th:nth-child(9), .orders-table td:nth-child(9) { width: 60px; } /* ID */
.orders-table th:nth-child(10), .orders-table td:nth-child(10) { width: 80px; } /* Действия */

.loading {
    text-align: center;
    padding: 2rem;
    color: #718096;
}
.loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #667eea;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
    margin-left: 0.5rem;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-30px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}
/* Информационный блок */
.info-section {
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    font-size: 0.95rem;
    line-height: 1.5;
}
.info-section h4 {
    color: #2d3748;
    font-weight: 600;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}
.info-section ul {
    list-style: none;
    padding-left: 0;
    margin-bottom: 1rem;
}
.info-section li {
    padding: 0.75rem 0;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.9rem;
}
.info-section li:last-child {
    border-bottom: none;
}
.info-section .highlight {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-weight: 500;
}
.info-section p {
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}
.warning-box {
    background: #fff5f5;
    border: 1px solid #fed7d7;
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
    font-size: 0.85rem;
}
.warning-box h5 {
    color: #742a2a;
    font-weight: 600;
    margin-bottom: 0.75rem;
    font-size: 1rem;
}
.warning-box h6 {
    color: #742a2a;
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}
.warning-box ul {
    list-style: none;
    padding-left: 0;
    margin-bottom: 0.5rem;
}
.warning-box li {
    padding: 0.25rem 0;
    font-size: 0.8rem;
}
.warning-box p {
    font-size: 0.8rem;
    margin-bottom: 0.25rem;
}
.telegram-link {
    color: #0088cc;
    text-decoration: none;
    font-weight: 500;
}
.telegram-link:hover {
    text-decoration: underline;
}
/* Фильтры */
.filters-section {
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
    /* Оптимизация для анимаций */
    will-change: height, opacity;
}
.filter-input {
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    transition: var(--transition);
}
.filter-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}
.btn-secondary-custom {
    background: linear-gradient(135deg, #718096 0%, #4a5568 100%);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}
.btn-secondary-custom:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(113, 128, 150, 0.3);
}
.clear-filters-btn {
    background: none;
    border: 1px solid #e53e3e;
    color: #e53e3e;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}
.clear-filters-btn:hover {
    background: #e53e3e;
    color: white;
}
.toggle-btn {
    background: none;
    border: 1px solid #667eea;
    color: #667eea;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}
.toggle-btn:hover {
    background: #667eea;
    color: white;
}
/* Пагинация */
.pagination {
    display: flex;
    justify-content: center;
    list-style: none;
    padding: 0;
    margin: 1rem 0 0 0;
}
.page-item {
    margin: 0 0.25rem;
}
.page-link {
    display: block;
    padding: 0.5rem 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    color: #667eea;
    text-decoration: none;
    transition: all 0.2s ease;
    /* Оптимизация для анимаций */
    will-change: background-color, color;
}
.page-link:hover {
    background: #f7fafc;
    border-color: #667eea;
}
.page-item.active .page-link {
    background: #667eea;
    border-color: #667eea;
    color: white;
}
.page-item.disabled .page-link {
    color: #a0aec0;
    pointer-events: none;
    background: #f7fafc;
}
/* Капча */
.captcha-container {
    background: #f7fafc;
    border-radius: 8px;
    padding: 1rem;
}
.captcha-input {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 0.5rem;
}
.captcha-image {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 1.2rem;
    font-weight: bold;
    letter-spacing: 0.2rem;
    user-select: none;
    min-width: 120px;
    text-align: center;
}
.captcha-refresh {
    background: none;
    border: 1px solid #667eea;
    color: #667eea;
    padding: 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
}
.captcha-refresh:hover {
    background: #667eea;
    color: white;
}
/* Адаптивность */
@media (max-width: 768px) {
    .card {
        padding: 1rem;
    }
    .rate-values {
        flex-direction: column;
        gap: 0.5rem;
    }
    .orders-table th,
    .orders-table td {
        padding: 0.5rem;
        font-size: 0.8rem;
    }
    .filters-section {
        padding: 1rem;
    }
    .captcha-input {
        flex-direction: column;
        align-items: stretch;
    }
    .captcha-image {
        align-self: center;
    }
}
/* Доступность */
.visually-hidden-focusable {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}
.visually-hidden-focusable:focus {
    position: static !important;
    width: auto !important;
    height: auto !important;
    padding: inherit !important;
    margin: inherit !important;
    overflow: visible !important;
    clip: auto !important;
    white-space: normal !important;
}
/* Фокус для клавиатурной навигации */
.btn:focus,
.form-control:focus,
.form-select:focus,
.page-link:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}
/* Улучшенная читаемость для скринридеров */
[aria-live] {
    position: relative;
}
/* Анимации для улучшения UX */
.card {
    animation-fill-mode: both;
}
.rate-item {
    animation: fadeInUp 0.4s ease-out both;
}
.rate-item:nth-child(1) { animation-delay: 0.1s; }
.rate-item:nth-child(2) { animation-delay: 0.2s; }
.rate-item:nth-child(3) { animation-delay: 0.3s; }
.rate-item:nth-child(4) { animation-delay: 0.4s; }
.rate-item:nth-child(5) { animation-delay: 0.5s; }
.rate-item:nth-child(6) { animation-delay: 0.6s; }
/* Улучшенные стили для статистики */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}
.stats-item {
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    padding: 1.5rem;
    border-radius: 12px;
    text-align: center;
    border-left: 4px solid #667eea;
    transition: var(--transition);
}
.stats-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(102, 126, 234, 0.15);
}
.stats-value {
    font-size: 2rem;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 0.5rem;
}
.stats-label {
    font-size: 0.9rem;
    color: #4a5568;
    font-weight: 500;
}
/* Улучшенные стили для курсов валют */
.rates-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.currency-name {
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

.buy-rate, .sell-rate {
    font-size: 13px;
    color: #666;
}

.buy-rate {
    color: #28a745;
}

.sell-rate {
    color: #dc3545;
}

.loading, .error, .no-data {
    text-align: center;
    color: #666;
    font-style: italic;
}

.error {
    color: #dc3545;
}

/* Блок «Поделиться лучшим курсом» */
.share-rates-block {
    padding-top: 0.75rem;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}
.share-rates-label {
    font-size: 0.9rem;
    color: #4a5568;
    font-weight: 500;
    margin-bottom: 0.5rem;
}
.share-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}
.share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    color: #fff;
    text-decoration: none;
    transition: transform 0.2s, box-shadow 0.2s;
    font-size: 1.1rem;
    cursor: pointer;
}
.share-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    color: #fff;
}
.share-btn:focus {
    outline: 2px solid var(--bs-primary, #0d6efd);
    outline-offset: 2px;
}
.share-btn-native {
    background: #6c757d;
}
.share-btn-telegram {
    background: #0088cc;
}
.share-btn-whatsapp {
    background: #25d366;
}
.share-btn-vk {
    background: #0077ff;
}
.share-btn-vk-label {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.share-btn-instagram {
    background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
}
.share-btn-copied {
    opacity: 0.9;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.2);
}

/* Футер */
.footer {
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 2rem;
    margin-top: 3rem;
    text-align: center;
    color: white;
}
.footer a {
    color: #fff;
    text-decoration: none;
    font-weight: 500;
}
.footer a:hover {
    text-decoration: underline;
}
/* Дополнительные медиа-запросы */
@media (max-width: 576px) {
    .header h1 { font-size: 2rem; }
    .card { padding: 1rem; }
    .btn-custom { padding: 0.75rem 1.5rem; font-size: 0.9rem; }
}
@media print {
    .card { box-shadow: none; border: 1px solid #ccc; }
    .btn-custom { display: none; }
}
/* Оптимизация для пагинации */
.pagination-container {
    /* Оптимизация для рендеринга */
    transform: translateZ(0);
}

.pagination .page-link {
    transition: all 0.2s ease;
    /* Оптимизация для анимаций */
    will-change: background-color, color;
}
/* Оптимизация таблицы */
.orders-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    /* Оптимизация для прокрутки */
    will-change: scroll-position;
}

.orders-table th {
    background: var(--primary-gradient);
    color: white;
    padding: 1rem;
    text-align: left;
    font-weight: 500;
    font-size: 0.9rem;
    white-space: nowrap;
}

.orders-table td {
    padding: 1rem;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.9rem;
    vertical-align: middle;
}

/* Стили для даты и времени */
.date-time-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.date-time-info .date {
    font-weight: 500;
    color: #2d3748;
}

.date-time-info .time {
    font-size: 0.8rem;
    color: #718096;
}

/* Обеспечиваем прокрутку для таблицы */
.table-responsive {
    overflow-x: auto;
    max-width: 100%;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Минимальная ширина для столбцов */
.orders-table th:nth-child(1), .orders-table td:nth-child(1) { min-width: 60px; } /* ID */
.orders-table th:nth-child(2), .orders-table td:nth-child(2) { min-width: 120px; } /* Пользователь */
.orders-table th:nth-child(3), .orders-table td:nth-child(3) { min-width: 100px; } /* Валюта */
.orders-table th:nth-child(4), .orders-table td:nth-child(4) { min-width: 80px; } /* Тип */
.orders-table th:nth-child(5), .orders-table td:nth-child(5) { min-width: 80px; } /* Сумма */
.orders-table th:nth-child(6), .orders-table td:nth-child(6) { min-width: 80px; } /* Курс */
.orders-table th:nth-child(7), .orders-table td:nth-child(7) { min-width: 120px; } /* Дата добавления */
.orders-table th:nth-child(8), .orders-table td:nth-child(8) { min-width: 150px; max-width: 200px; } /* Комментарий */
.orders-table th:nth-child(9), .orders-table td:nth-child(9) { min-width: 80px; } /* Действия */

/* Обработка длинного текста в комментарии */
.orders-table td:nth-child(8) {
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 200px;
}

.orders-table tr:hover {
    background-color: #f7fafc;
}
