/* =============== ПОЛНОСТЬЮ ТЕМНАЯ ТЕМА =============== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #111;
    --bg-tertiary: #1a1a1a;
    --text-primary: #e0e0e0;
    --text-secondary: #999;
    --text-tertiary: #666;
    --accent: #ff8c00;
    --accent-hover: #ffa500;
    --accent-glow: rgba(255, 140, 0, 0.3);
    --border: #222;
    --border-light: #333;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg-primary);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* =============== ШАПКА =============== */
.header {
    background: var(--bg-secondary);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
    padding: 15px 0;
    margin-bottom: 30px;
    border-bottom: 1px solid var(--border);
}

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

.site-branding {
    display: flex;
    align-items: center;
    gap: 15px;
}

.site-title {
    font-size: 1.8em;
    color: var(--accent);
    text-decoration: none;
    margin: 0;
    text-shadow: 0 0 10px var(--accent-glow);
    transition: all 0.3s;
    font-weight: 700;
}

.site-title:hover {
    color: var(--accent-hover);
    text-shadow: 0 0 20px var(--accent-glow);
}

.stats-date {
    color: var(--text-tertiary);
    font-size: 0.85em;
    white-space: nowrap;
}

.header-search {
    flex: 1;
    max-width: 400px;
    min-width: 200px;
}

.search-wrapper {
    position: relative;
    width: 100%;
}

.search-input {
    width: 100%;
    padding: 10px 15px;
    font-size: 15px;
    border: 1px solid var(--border);
    border-radius: 8px;
    outline: none;
    transition: all 0.3s;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(255, 140, 0, 0.2);
    background: #151515;
}

.search-input::placeholder {
    color: var(--text-tertiary);
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-top: 5px;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.8);
    z-index: 1000;
    display: none;
}

.search-results.active {
    display: block;
}

.search-result-item {
    padding: 12px 20px;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 1px solid var(--bg-tertiary);
    color: var(--text-primary);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: var(--bg-tertiary);
    color: var(--accent);
}

/* =============== АДАПТИВНОСТЬ ШАПКИ =============== */
@media (max-width: 768px) {
    .header {
        padding: 12px 0;
    }
    
    .header-content {
        flex-direction: column;
        align-items: center;
        gap: 12px;
    }
    
    .site-branding {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 5px;
        width: 100%;
    }
    
    .site-title {
        font-size: 1.4em;
    }
    
    .stats-date {
        font-size: 0.8em;
    }
    
    .header-search {
        width: 100%;
        max-width: 100%;
    }
}

/* =============== LAYOUT =============== */
.main-container {
    padding: 20px 0;
}

.layout {
    display: grid;
    grid-template-columns: 280px 1fr 300px;
    gap: 20px;
    align-items: start;
}

@media (max-width: 1200px) {
    .layout {
        grid-template-columns: 250px 1fr;
    }
    .sidebar-right {
        grid-column: 1 / -1;
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    .layout {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .sidebar-left,
    .sidebar-right,
    .content-center {
        width: 100%;
        max-width: 100%;
        margin-left: 0;
        margin-right: 0;
    }
}

/* =============== БОКОВЫЕ ПАНЕЛИ =============== */
.sidebar-left {
    position: sticky;
    top: 20px;
}

.sidebar-right {
    position: sticky;
    top: 20px;
}

.stats-block,
.megablocks-block {
    margin-top: 20px;
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border);
    width: 100%;
}

.stats-block h3,
.megablocks-block h3 {
    color: var(--accent);
    margin-bottom: 15px;
    font-size: 1.3em;
    font-weight: 700;
}

.stats-block h4 {
    color: var(--accent-hover);
    margin: 15px 0 10px;
    font-size: 1em;
    font-weight: 600;
}

.stats-block hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 15px 0;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    padding: 8px;
    border-radius: 6px;
    transition: background 0.2s;
}

.stat-item.small {
    padding: 5px 8px;
    font-size: 0.9em;
}

.stat-link {
    display: flex;
    justify-content: space-between;
    width: 100%;
    text-decoration: none;
    color: inherit;
}

.stat-link:hover {
    background: rgba(255, 140, 0, 0.1);
}

.stat-label {
    color: var(--text-secondary);
    font-weight: 500;
}

.stat-value {
    color: var(--accent);
    font-weight: bold;
}

/* =============== ТАЙМЕР МЕГАБЛОКА =============== */
.megablock-timer {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
    color: #000;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    margin-top: 10px;
    box-shadow: 0 0 20px var(--accent-glow);
}

.megablock-timer h4 {
    color: #000;
    margin-bottom: 10px;
    font-weight: 700;
}

.timer-display {
    font-size: 2.5em;
    font-weight: bold;
    font-family: 'Courier New', monospace;
    margin: 10px 0;
}

.timer-info {
    font-size: 0.85em;
    opacity: 0.9;
    margin-top: 10px;
}

/* =============== ЦЕНТРАЛЬНАЯ КОЛОНКА =============== */
.content-center {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    min-height: 600px;
    border: 1px solid var(--border);
}

.loading, .loading-small {
    text-align: center;
    color: var(--text-tertiary);
    padding: 40px;
}

.loading-small {
    padding: 20px;
    font-size: 0.9em;
}

/* =============== ПАГИНАЦИЯ =============== */
.pagination-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.per-page-selector {
    display: flex;
    gap: 5px;
    align-items: center;
    flex-wrap: wrap;
}

.per-page-selector span {
    color: var(--text-secondary);
    font-size: 0.9em;
}

.per-page-btn,
.page-btn {
    padding: 6px 12px;
    border: 1px solid var(--border);
    background: var(--bg-primary);
    color: var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9em;
}

.per-page-btn:hover,
.page-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent);
    color: var(--accent);
}

.per-page-btn.active,
.page-btn.active {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
    font-weight: bold;
}

.page-btn {
    min-width: 40px;
    text-align: center;
}

.page-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.pagination-pages {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

/* =============== ТАБЛИЦА БЛОКОВ =============== */
.blocks-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.blocks-table th,
.blocks-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.blocks-table th {
    background: var(--bg-primary);
    font-weight: 600;
    color: var(--accent);
    position: sticky;
    top: 0;
    border-bottom: 2px solid var(--accent);
    cursor: pointer;
    user-select: none;
    transition: all 0.2s;
}

.blocks-table th:hover {
    background: var(--bg-tertiary);
    color: var(--accent-hover);
}

.blocks-table th.sortable {
    position: relative;
    padding-right: 25px;
}

.blocks-table th.sortable::after {
    content: '⇅';
    position: absolute;
    right: 8px;
    opacity: 0.3;
    font-size: 0.9em;
}

.blocks-table th.sortable.asc::after {
    content: '▲';
    opacity: 1;
    color: var(--accent);
}

.blocks-table th.sortable.desc::after {
    content: '▼';
    opacity: 1;
    color: var(--accent);
}

.blocks-table tr {
    transition: background 0.2s;
    background: var(--bg-secondary);
}

.blocks-table tr:hover {
    background: var(--bg-tertiary);
}

.blocks-table tr.megablock {
    background: linear-gradient(90deg, rgba(255, 140, 0, 0.15), rgba(255, 140, 0, 0.05));
    border-left: 4px solid var(--accent);
}

.blocks-table tr.megablock:hover {
    background: linear-gradient(90deg, rgba(255, 140, 0, 0.2), rgba(255, 140, 0, 0.08));
}

.blocks-table tr.megablock td {
    font-weight: 600;
}

.megablock-badge {
    display: inline-block;
    background: var(--accent);
    color: #000;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.75em;
    font-weight: bold;
    margin-left: 5px;
}

.miner-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.miner-link:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* =============== ПРАВАЯ ПАНЕЛЬ - МЕГАБЛОКИ =============== */
.sidebar-right {
    position: sticky;
    top: 20px;
}

.megablocks-list {
    max-height: 800px;
    overflow-y: auto;
}

.megablocks-list::-webkit-scrollbar {
    width: 8px;
}

.megablocks-list::-webkit-scrollbar-track {
    background: var(--bg-primary);
    border-radius: 10px;
}

.megablocks-list::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 10px;
}

.megablock-item {
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 10px;
    background: linear-gradient(90deg, rgba(255, 140, 0, 0.1), rgba(255, 140, 0, 0.03));
    border-left: 3px solid var(--accent);
    cursor: pointer;
    transition: all 0.2s;
}

.megablock-item:hover {
    transform: translateX(-3px);
    box-shadow: 0 2px 10px var(--accent-glow);
    background: linear-gradient(90deg, rgba(255, 140, 0, 0.2), rgba(255, 140, 0, 0.05));
}

.megablock-item-id {
    font-weight: bold;
    color: var(--accent);
    font-size: 1.1em;
}

.megablock-item-miner {
    color: var(--text-primary);
    font-size: 0.9em;
    margin: 5px 0;
}

.megablock-item-date {
    color: var(--text-secondary);
    font-size: 0.8em;
}

/* =============== ДЕТАЛИ ПОЛЬЗОВАТЕЛЯ =============== */
.user-details {
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.user-header {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
    color: #000;
    padding: 25px;
    border-radius: 10px;
    margin-bottom: 25px;
    box-shadow: 0 0 30px var(--accent-glow);
}

.user-header h2 {
    font-size: 2em;
    margin-bottom: 15px;
    font-weight: 700;
}

.user-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.user-stat-card {
    background: rgba(0, 0, 0, 0.3);
    padding: 15px;
    border-radius: 8px;
    text-align: center;
}

.user-stat-value {
    font-size: 2em;
    font-weight: bold;
    display: block;
}

.user-stat-label {
    font-size: 0.9em;
    opacity: 0.9;
    display: block;
    margin-top: 5px;
}

/* =============== ГРАФИК =============== */
.chart-container {
    margin: 25px 0;
    padding: 20px;
    background: var(--bg-primary);
    border-radius: 10px;
    border: 1px solid var(--border);
}

.chart-container h3 {
    color: var(--accent);
    margin-bottom: 15px;
    font-weight: 700;
}

#hashrateChart {
    max-height: 300px;
}

.chart-placeholder {
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border-radius: 8px;
    color: var(--text-tertiary);
}

.back-btn {
    display: inline-block;
    padding: 10px 20px;
    background: var(--accent);
    color: #000;
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 20px;
    transition: all 0.2s;
    font-weight: bold;
}

.back-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 140, 0, 0.4);
}

/* =============== ФУТЕР =============== */
.footer {
    background: var(--bg-secondary);
    padding: 20px 0;
    margin-top: 40px;
    text-align: center;
    color: var(--text-secondary);
    border-top: 1px solid var(--border);
}

/* =============== ������������ =============== */
@media (max-width: 768px) {
    /* �������� ��������� - ������� ����� �������� */
    .container {
        padding: 0 15px;
        width: 100%;
        max-width: 100%;
    }
    
    /* ����� */
    .header {
        padding: 12px 0;
    }
    
    .header-content {
        flex-direction: column;
        align-items: center;
        gap: 12px;
        width: 100%;
    }
    
    .site-branding {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 5px;
        width: 100%;
    }
    
    .site-title {
        font-size: 1.4em;
    }
    
    .stats-date {
        font-size: 0.8em;
    }
    
    .header-search {
        width: 100%;
        max-width: 100%;
    }
    
    /* Layout - ���� ������� */
    .layout {
        display: flex;
        flex-direction: column;
        gap: 15px;
        width: 100%;
    }
    
    /* �����: ������ ������ (���) ������������ ������ */
    .sidebar-right {
        order: -1;
        position: static !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    /* ������� ������ - ������� sticky � ����������� */
    .sidebar-left {
        
        order: 0;
        position: static !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        margin-top: -20px; 
    }
    
    /* ����������� ������� ��������� */
    .content-center {
        order: 1;
        padding: 15px;
        width: 100%;
        margin: 0;
    }
    
    /* ����� ���������� */
    .stats-block,
    .megablocks-block {
        margin: 0 0 15px 0;
        width: 100%;
        padding: 15px;
    }
    
    .stats-block h3,
    .megablocks-block h3 {
        font-size: 1.2em;
    }
    
    /* ������� */
    .blocks-table {
        font-size: 0.85em;
        display: block;
        overflow-x: auto;
        width: 100%;
    }
    
    .blocks-table th,
    .blocks-table td {
        padding: 8px 5px;
        white-space: nowrap;
    }
    
    /* ���������� ������������ */
    .user-details {
        width: 100%;
    }
    
    .user-header {
        padding: 20px 15px;
    }
    
    .user-header h2 {
        font-size: 1.5em;
    }
    
    .user-stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    
    .user-stat-value {
        font-size: 1.5em;
    }
    
    /* ��������� */
    .pagination-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .per-page-selector {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .pagination-pages {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .per-page-btn,
    .page-btn {
        font-size: 0.85em;
        padding: 5px 10px;
    }
    
    /* ������ */
    .chart-container {
        padding: 15px;
        margin: 15px 0;
    }
    
    #hashrateChart {
        max-height: 250px;
        width: 100%;
    }
    
    /* ������ */
    .timer-display {
        font-size: 2em;
    }
    
    /* ������ ���������� */
    .megablocks-list {
        max-height: 400px;
    }
    
    .megablock-item {
        padding: 10px;
    }
    
    /* ������ ����� */
    .back-btn {
        display: block;
        text-align: center;
        width: 100%;
        margin-bottom: 15px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 10px;
    }
    
    .site-title {
        font-size: 1.2em;
    }
    
    .stats-block,
    .megablocks-block {
        padding: 12px;
    }
    
    .user-stats-grid {
        grid-template-columns: 1fr;
    }
    
    .user-stat-value {
        font-size: 1.3em;
    }
    
    .timer-display {
        font-size: 1.8em;
    }
    
    .blocks-table {
        font-size: 0.75em;
    }
    
    .blocks-table th,
    .blocks-table td {
        padding: 6px 3px;
    }
    
    .megablock-badge {
        font-size: 0.65em;
        padding: 2px 6px;
    }
    
    .per-page-btn,
    .page-btn {
        font-size: 0.8em;
        padding: 4px 8px;
        min-width: 35px;
    }
}
.sidebar-left {
        margin-top: -20px; 
    }