/* Dark Theme - CS 1.6 Style */
:root {
    --bg-primary: #0a0e17;
    --bg-secondary: #111827;
    --bg-tertiary: #1f2937;
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --accent-primary: #f59e0b; /* CS 1.6 orange */
    --accent-secondary: #10b981; /* Green for kills */
    --accent-danger: #ef4444; /* Red for deaths */
    --accent-info: #3b82f6; /* Blue for skill */
    --border-color: #374151;
    --table-header-bg: #1f2937;
    --table-row-bg: #111827;
    --table-row-hover: #1f2937;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
    display: flex;
    flex-direction: column;
}

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

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 30px 20px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* Connect Button Small - Header */
.connect-button-small {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 12px;
    background: linear-gradient(135deg, var(--accent-primary) 0%, #d97706 100%);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 8px;
    text-decoration: none;
    color: #0a0e17;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.2);
}

.connect-button-small:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
    border-color: rgba(245, 158, 11, 0.6);
}

.connect-icon-small {
    font-size: 18px;
}

/* Header */
.header {
    background: var(--bg-secondary);
    border-bottom: 2px solid var(--accent-primary);
    padding: 20px 0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

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

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.title {
    font-family: 'Orbitron', monospace;
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
}

.trophy {
    font-size: 32px;
}

.title-text {
    background: linear-gradient(135deg, var(--accent-primary) 0%, #d97706 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

/* Live Indicator */
.live-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 20px;
}

.live-dot {
    width: 10px;
    height: 10px;
    background: #10b981;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
}

.live-text {
    font-size: 12px;
    font-weight: 600;
    color: #10b981;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Time Filter */
.time-filter {
    display: flex;
    align-items: center;
    gap: 10px;
}

.time-filter label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

.time-filter-select {
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.time-filter-select:hover {
    border-color: var(--accent-primary);
}

.time-filter-select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
}

/* Stats Cards - Centralizado */
.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    width: 100%;
    max-width: 1400px;
}

.stat-card {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 12px rgba(0, 0, 0, 0.4);
}

.stat-value {
    font-family: 'Orbitron', monospace;
    font-size: 28px;
    font-weight: 700;
    color: var(--accent-primary);
    margin-bottom: 8px;
}

.stat-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Search Container - Centralizado */
.search-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin: 40px 0 30px 0;
    width: 100%;
    max-width: 1400px;
    flex-wrap: wrap;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.search-input-wrapper {
    flex: 1;
    min-width: 250px;
    max-width: 500px;
    position: relative;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    z-index: 1;
}

.search-input {
    width: 100%;
    padding: 12px 12px 12px 42px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 400;
    transition: all 0.3s ease;
}

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

.search-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
}

/* Auto Refresh Toggle */
.auto-refresh-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--text-secondary);
}

.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    transition: all 0.3s ease;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background-color: var(--text-muted);
    border-radius: 50%;
    transition: all 0.3s ease;
}

input:checked + .slider {
    background-color: var(--accent-primary);
    border-color: var(--accent-primary);
}

input:checked + .slider:before {
    transform: translateX(20px);
    background-color: white;
}

/* Table Container - Centralizado */
.table-container {
    width: 100%;
    max-width: 1400px;
    margin-bottom: 30px;
}

.table-wrapper {
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden; /* Remove overflow-x to prevent horizontal scroll */
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.ranking-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

/* Table Header */
.ranking-table thead {
    background: var(--table-header-bg);
    position: sticky;
    top: 0;
    z-index: 10;
}

.ranking-table th {
    padding: 16px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

/* Table Body */
.ranking-table tbody {
    background: var(--table-row-bg);
}

.player-row {
    border-bottom: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.player-row:hover {
    background: var(--table-row-hover);
}

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

/* Column Styles */
.rank-column {
    width: 60px;
    text-align: center;
    padding: 16px 8px;
}

.player-column {
    min-width: 200px;
    max-width: 250px;
    padding: 16px 12px;
}

.skill-column {
    width: 80px;
    text-align: right;
    padding: 16px 12px;
}

.kills-column {
    width: 80px;
    text-align: right;
    padding: 16px 12px;
}

.deaths-column {
    width: 80px;
    text-align: right;
    padding: 16px 12px;
}

.kd-column {
    width: 70px;
    text-align: right;
    padding: 16px 12px;
}

.hs-column {
    width: 70px;
    text-align: right;
    padding: 16px 12px;
}

.hs-percent-column {
    width: 80px;
    text-align: right;
    padding: 16px 12px;
}

.time-column {
    width: 100px;
    text-align: right;
    padding: 16px 12px;
}

/* Rank Badge */
.rank-badge {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.rank-badge.rank-1 {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: #0a0e17;
    box-shadow: 0 0 20px rgba(251, 191, 36, 0.5);
}

.rank-badge.rank-2 {
    background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%);
    color: #0a0e17;
    box-shadow: 0 0 15px rgba(156, 163, 175, 0.5);
}

.rank-badge.rank-3 {
    background: linear-gradient(135deg, #cd7f32 0%, #b45309 100%);
    color: #0a0e17;
    box-shadow: 0 0 15px rgba(205, 127, 50, 0.5);
}

/* Player Info */
.player-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.player-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.player-steamid {
    font-size: 11px;
    font-weight: 400;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Stat Values */
.stat-value {
    font-weight: 600;
    font-size: 14px;
    font-family: 'Inter', monospace;
}

.skill-value {
    color: var(--accent-info);
}

.kills-value {
    color: var(--accent-secondary);
}

.deaths-value {
    color: var(--accent-danger);
}

.kd-value {
    color: var(--text-primary);
}

.kd-value.kd-excellent {
    color: #10b981;
    font-weight: 700;
}

.kd-value.kd-good {
    color: #34d399;
    font-weight: 600;
}

.kd-value.kd-average {
    color: #fbbf24;
}

.kd-value.kd-poor {
    color: #ef4444;
}

.hs-value {
    color: #f59e0b;
}

.hs-percent-value {
    color: #8b5cf6;
}

.time-value {
    color: var(--text-muted);
    font-size: 13px;
}

/* No Data */
.no-data {
    text-align: center;
    padding: 60px 20px;
}

.no-data-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.no-data-icon {
    font-size: 48px;
    opacity: 0.5;
}

.no-data p {
    font-size: 16px;
    color: var(--text-secondary);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 20px 0;
    flex-wrap: wrap;
}

.pagination-btn {
    padding: 10px 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: #0a0e17;
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-info {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Footer */
.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 20px 0;
    margin-top: 60px;
}

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

.footer-content p {
    font-size: 12px;
    color: var(--text-muted);
}

.server-address {
    color: var(--accent-primary);
    font-weight: 600;
}

.server-link {
    color: var(--accent-primary);
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
}

.server-link:hover {
    color: #d97706;
    text-decoration: underline;
}

/* Server Connect Wrapper */
.server-connect-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

.server-address-popup {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 16px;
    min-width: 250px;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.server-connect-wrapper:hover .server-address-popup {
    display: flex;
    align-items: center;
    gap: 8px;
}

.server-address-text {
    font-family: 'Orbitron', monospace;
    color: var(--text-primary);
    font-size: 13px;
    flex: 1;
}

.copy-button,
.copy-button-inline {
    background: var(--accent-primary);
    border: none;
    border-radius: 4px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.copy-button:hover,
.copy-button-inline:hover {
    background: #d97706;
    transform: translateY(-1px);
}

.copy-button-inline {
    margin-left: 8px;
    font-size: 12px;
    padding: 4px 8px;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 14, 23, 0.95);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay p {
    font-size: 16px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Error Overlay */
.error-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 14, 23, 0.95);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.error-overlay.hidden {
    display: none;
}

.error-content {
    background: var(--bg-secondary);
    padding: 40px;
    border-radius: 12px;
    border: 1px solid var(--accent-danger);
    text-align: center;
    max-width: 400px;
}

.error-content h2 {
    font-size: 24px;
    color: var(--accent-danger);
    margin-bottom: 16px;
}

.error-content p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.btn-retry {
    padding: 12px 24px;
    background: var(--accent-primary);
    border: none;
    border-radius: 8px;
    color: #0a0e17;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-retry:hover {
    background: #d97706;
    transform: translateY(-2px);
}

/* Hidden Class */
.hidden {
    display: none !important;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .title {
        font-size: 24px;
    }
    
    .player-column {
        min-width: 180px;
    }
    
    .ranking-table {
        font-size: 13px;
    }
    
    .ranking-table th {
        padding: 12px 8px;
    }
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        align-items: stretch;
    }
    
    .header-right {
        flex-direction: column;
        align-items: stretch;
    }
    
    .time-filter {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .time-filter-select {
        width: 100%;
    }
    
    .search-container {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-input-wrapper {
        max-width: 100%;
    }
    
    .stats-container {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stat-value {
        font-size: 24px;
    }
    
    .table-wrapper {
        overflow-x: auto; /* Enable horizontal scroll on mobile */
    }
    
    .ranking-table {
        min-width: 800px; /* Force minimum width on mobile */
    }
}

/* Notification */
.notification {
    position: fixed;
    top: 100px;
    right: 20px;
    background: var(--accent-primary);
    color: var(--bg-primary);
    padding: 16px 24px;
    border-radius: 8px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
    z-index: 10000;
    opacity: 0;
    transform: translateX(100px);
    transition: all 0.3s ease;
    max-width: 400px;
}

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

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 480px) {
    .title {
        font-size: 20px;
    }
    
    .stats-container {
        grid-template-columns: 1fr;
    }
    
    .pagination {
        flex-direction: column;
        gap: 10px;
    }
    
    .footer-content {
        flex-direction: column;
        text-align: center;
    }
    
    .server-address-popup {
        min-width: 200px;
        right: -50px;
    }
    
    .notification {
        right: 10px;
        left: 10px;
        max-width: none;
    }
}