/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

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

/* Header Styles */
.header {
    text-align: center;
    margin-bottom: 30px;
}

.header-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.title i {
    color: #667eea;
}

.subtitle {
    font-size: 1.1rem;
    color: #718096;
    font-weight: 400;
}

/* Main Menu */
.main-menu {
    background: white;
    border-radius: 15px;
    padding: 40px;
    margin-bottom: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.menu-container {
    max-width: 800px;
    margin: 0 auto;
}

.menu-title {
    color: #2d3748;
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 40px;
    text-align: center;
}

.menu-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    justify-content: center;
}

.menu-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: none;
    border-radius: 15px;
    padding: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.menu-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.menu-btn.statistics-btn {
    background: linear-gradient(135deg, #48bb78, #38a169);
    box-shadow: 0 4px 15px rgba(72, 187, 120, 0.3);
}

.menu-btn.statistics-btn:hover {
    box-shadow: 0 8px 25px rgba(72, 187, 120, 0.4);
}

.menu-btn.upload-btn {
    background: linear-gradient(135deg, #ed8936, #dd6b20);
    box-shadow: 0 4px 15px rgba(237, 137, 54, 0.3);
}

.menu-btn.upload-btn:hover {
    box-shadow: 0 8px 25px rgba(237, 137, 54, 0.4);
}

.menu-btn-icon {
    flex-shrink: 0;
}

.menu-btn-icon i {
    font-size: 3rem;
}

.menu-btn-content h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0 0 10px 0;
}

.menu-btn-content p {
    font-size: 1rem;
    margin: 0;
    opacity: 0.9;
    line-height: 1.4;
}

/* Configuration Panel */
.config-panel {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.config-header h2 {
    font-size: 1.4rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.back-btn {
    margin-left: auto;
}

.header-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
}

.config-header i {
    color: #667eea;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #4a5568;
}

.input-group input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    background: white;
}

.input-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.url-hint {
    display: block;
    margin-top: 0.5rem;
    color: #6b7280;
    font-size: 0.85rem;
    font-style: italic;
}

.controls {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

/* Button Styles */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    min-width: 120px;
    justify-content: center;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #e2e8f0;
    color: #4a5568;
}

.btn-secondary:hover:not(:disabled) {
    background: #cbd5e0;
}

.btn-danger {
    background: #e53e3e;
    color: white;
    border: 2px solid #e53e3e;
}

.btn-danger:hover:not(:disabled) {
    background: #c53030;
    border-color: #c53030;
}

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

/* Dashboard Styles */
.dashboard {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* Stats Overview */
.stats-overview {
    padding: 25px;
    background: linear-gradient(135deg, #f7fafc, #edf2f7);
}

.database-stats-header {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.database-stats-header h2 {
    margin: 0 0 10px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
}

.database-stats-header h2 i {
    margin-right: 10px;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.85rem;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-small:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.highlights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-card.highlight {
    min-height: 140px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #ffeaa7, #fab1a0);
    border-left: 4px solid #e17055;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    padding: 24px 12px;
}

.stat-card.highlight .stat-icon {
    width: 56px;
    height: 56px;
    font-size: 2.2rem;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #cdff04, #48bb78);
    border-radius: 50%;
}

.stat-info h3 {
    font-size: 1.8rem;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 5px;
}

.stat-info p {
    color: #718096;
    font-size: 0.9rem;
    font-weight: 500;
}

/* Tabs */
.tabs {
    display: flex;
    background: #f7fafc;
    border-bottom: 1px solid #e2e8f0;
}

.tab-btn {
    background: none;
    border: none;
    padding: 20px 30px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    color: #718096;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 3px solid transparent;
}

.tab-btn:hover {
    color: #4a5568;
    background: #edf2f7;
}

.tab-btn.active {
    color: #667eea;
    background: white;
    border-bottom-color: #667eea;
}

/* Tab Content */
.tab-content {
    min-height: 500px;
}

.tab-pane {
    display: none;
    padding: 25px;
}

.tab-pane.active {
    display: block;
}

/* Table Controls */
.table-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 20px;
    flex-wrap: wrap;
}

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

.search-box {
    position: relative;
    flex: 1;
    max-width: 300px;
}

.search-box i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #a0aec0;
}

.search-box input {
    width: 100%;
    padding: 12px 15px 12px 45px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.search-box input:focus {
    outline: none;
    border-color: #667eea;
}

.last-updated-control {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #f8f9fa;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #4a5568;
    white-space: nowrap;
}

.last-updated-control i {
    color: #667eea;
    font-size: 0.85rem;
}

.last-updated-text {
    font-weight: 500;
}

#last-updated {
    font-weight: 600;
    color: #2d3748;
}

#sort-select {
    padding: 12px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    font-size: 1rem;
    cursor: pointer;
}

/* Table Styles */
.table-container {
    overflow-x: auto;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    font-size: 0.9rem;
}

.stats-table th {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 15px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stats-table td {
    padding: 12px;
    border-bottom: 1px solid #e2e8f0;
    transition: background 0.3s ease;
}

.stats-table tbody tr:hover {
    background: #f7fafc;
}

.stats-table tbody tr:nth-child(even) {
    background: #f9f9f9;
}

.stats-table tbody tr:nth-child(even):hover {
    background: #f0f0f0;
}

/* Position styling */
.position-1 { font-weight: 700; color: #d4af37; }
.position-2 { font-weight: 600; color: #c0c0c0; }
.position-3 { font-weight: 600; color: #cd7f32; }

/* Player info styles for table */
.stats-table .player-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stats-table .player-name {
    font-weight: 600;
    color: #2d3748;
}

.stats-table .player-region {
    font-size: 0.9em;
    opacity: 0.8;
}

/* Team Controls */
.team-controls {
    margin-bottom: 30px;
}

.team-settings {
    display: flex;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
}

.setting-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.setting-group label {
    font-weight: 500;
    color: #4a5568;
    font-size: 0.9rem;
}

.setting-group select {
    padding: 10px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    background: white;
    font-size: 0.9rem;
    cursor: pointer;
}

/* Teams Container */
.teams-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
}

.team-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border-left: 4px solid #667eea;
}

.team-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f7fafc;
}

.team-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: #2d3748;
}

.team-rating {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.team-players {
    list-style: none;
}

.team-player {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f7fafc;
}

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

.player-name {
    font-weight: 500;
    color: #2d3748;
}

.player-stats {
    font-size: 0.8rem;
    color: #718096;
}

/* Maps Analysis */
.maps-analysis {
    margin-top: 20px;
}

.map-stats-overview h3,
.map-stats-overview h4 {
    color: #2d3748;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.map-details-header {
    margin-bottom: 20px;
    padding: 15px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 10px;
    color: white;
}

.map-details-header h4 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
    color: white;
}

.top-player {
    background: linear-gradient(90deg, rgba(102, 126, 234, 0.1), rgba(255, 255, 255, 0.1));
    border-left: 4px solid #667eea;
}

.no-map-data {
    text-align: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, #f7fafc, #edf2f7);
    border-radius: 15px;
    border: 2px dashed #cbd5e0;
    margin: 20px 0;
}

.no-map-data h4 {
    color: #4a5568;
    font-size: 1.3rem;
    margin-bottom: 15px;
    font-weight: 600;
}

.no-map-data p {
    color: #718096;
    font-size: 1rem;
    margin-bottom: 15px;
    font-weight: 500;
}

.no-map-data ul {
    text-align: left;
    display: inline-block;
    margin: 0;
    padding: 0;
    list-style: none;
}

.no-map-data li {
    color: #4a5568;
    padding: 8px 0;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.no-map-data li:before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background: #667eea;
    border-radius: 50%;
    flex-shrink: 0;
}

.no-map-data em {
    font-style: normal;
    font-weight: 600;
    color: #667eea;
}

.map-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.map-stat-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border-left: 4px solid #667eea;
    transition: transform 0.3s ease;
}

.map-stat-card:hover {
    transform: translateY(-2px);
}

.map-stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.map-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2d3748;
}

.map-games-count {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 500;
}

.map-stat-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    font-size: 0.9rem;
}

.map-stat-item {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    border-bottom: 1px solid #f7fafc;
}

.map-stat-item:last-child {
    border-bottom: none;
}

.map-stat-label {
    color: #718096;
    font-weight: 500;
}

.map-stat-value {
    color: #2d3748;
    font-weight: 600;
}

.map-selector {
    margin-bottom: 20px;
}

.map-selector select {
    padding: 12px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    font-size: 1rem;
    cursor: pointer;
    min-width: 200px;
}

/* Charts */
.charts-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 30px;
}

.chart-section {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.chart-section h3 {
    margin-bottom: 15px;
    color: #2d3748;
    font-weight: 600;
}

/* Loading State */
.loading {
    text-align: center;
    padding: 60px 20px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e2e8f0;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading p {
    color: #718096;
    font-size: 1.1rem;
}

/* Error State */
.error {
    text-align: center;
    padding: 60px 20px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.error i {
    font-size: 3rem;
    color: #e53e3e;
    margin-bottom: 20px;
}

.error h3 {
    color: #2d3748;
    margin-bottom: 10px;
}

.error p {
    color: #718096;
    margin-bottom: 20px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .title {
        font-size: 2rem;
        flex-direction: column;
        gap: 10px;
    }
    
    .controls {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    .stats-overview {
        padding: 20px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 15px;
    }
    
    .highlights-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .database-stats-header h2 {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .main-menu {
        padding: 20px;
    }
    
    .menu-title {
        font-size: 1.5rem;
        margin-bottom: 30px;
    }
    
    .menu-buttons {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .menu-btn {
        padding: 20px;
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .menu-btn-icon i {
        font-size: 2.5rem;
    }
    
    .menu-btn-content h3 {
        font-size: 1.3rem;
    }
    
    .menu-btn-content p {
        font-size: 0.9rem;
    }
    
    .config-header h2 {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .header-buttons {
        flex-direction: column;
        width: 100%;
        gap: 10px;
    }
    
    .tabs {
        flex-direction: column;
    }
    
    .tab-btn {
        text-align: center;
        justify-content: center;
    }
    
    .table-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .filter-controls {
        justify-content: center;
        gap: 10px;
    }
    
    .search-box {
        max-width: none;
    }
    
    .last-updated-control {
        justify-content: center;
        font-size: 0.85rem;
        padding: 10px 12px;
    }
    
    .team-settings {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .charts-container {
        grid-template-columns: 1fr;
    }
    
    .map-stats-grid {
        grid-template-columns: 1fr;
    }
    
    .map-selector select {
        min-width: 100%;
    }
}

@media (max-width: 480px) {
    .stats-table {
        font-size: 0.8rem;
    }
    
    .stats-table th,
    .stats-table td {
        padding: 8px 6px;
    }
    
    .team-settings {
        gap: 10px;
    }
    
    .teams-container {
        grid-template-columns: 1fr;
    }
}

/* Team Balancing Improvements */
.balance-info {
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.balance-stats h3 {
    color: #2d3748;
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 20px;
    text-align: center;
}

.balance-stats h3::before {
    content: '';
    display: inline-block;
    margin-right: 10px;
}

.balance-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 25px;
}

.balance-section {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.balance-section h4 {
    color: #4a5568;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.balance-item {
    display: block;
    margin-bottom: 8px;
    padding: 8px 12px;
    background: #f7fafc;
    border-radius: 8px;
    font-size: 0.95rem;
    color: #4a5568;
}

.balance-good {
    background: linear-gradient(135deg, #c6f6d5, #9ae6b4);
    color: #2f855a;
    font-weight: 600;
}

.balance-fair {
    background: linear-gradient(135deg, #fef5e7, #fed7aa);
    color: #c05621;
    font-weight: 600;
}

.balance-poor {
    background: linear-gradient(135deg, #fed7d7, #fc8181);
    color: #c53030;
    font-weight: 600;
}

/* Enhanced Team Cards */
.team-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
}

.team-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #edf2f7;
}

.team-title {
    color: #2d3748;
    font-size: 1.4rem;
    font-weight: 600;
}

.team-rating {
    display: flex;
    gap: 20px;
    align-items: center;
}

.composite-rating {
    text-align: center;
    padding: 10px 15px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 10px;
    color: white;
    min-width: 120px;
}

.traditional-rating {
    text-align: center;
    padding: 10px 15px;
    background: linear-gradient(135deg, #48bb78, #38a169);
    border-radius: 10px;
    color: white;
    min-width: 120px;
}

.total-rating {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
}

.avg-rating, .traditional-total, .traditional-avg {
    font-size: 0.85rem;
    opacity: 0.9;
    margin-top: 4px;
}

/* Enhanced Player Display */
.team-players {
    list-style: none;
    margin-bottom: 20px;
}

.team-player {
    background: #f7fafc;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 12px;
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
}

.team-player:hover {
    background: #edf2f7;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.team-player:last-child {
    margin-bottom: 0;
}

.player-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.player-name {
    font-weight: 600;
    color: #2d3748;
    font-size: 1.1rem;
}

.player-composite-score {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
}

.player-stats {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.stat-item {
    background: white;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.9rem;
    color: #4a5568;
    border: 1px solid #e2e8f0;
}

.stat-item strong {
    color: #2d3748;
}

.team-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #edf2f7;
    border-radius: 10px;
    font-size: 0.95rem;
    color: #4a5568;
    font-weight: 500;
}

/* Responsive Design for Team Balancing */
@media (max-width: 768px) {
    .balance-metrics {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .balance-section {
        padding: 15px;
    }
    
    .team-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .team-rating {
        flex-direction: column;
        gap: 10px;
    }
    
    .player-main {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }
    
    .player-stats {
        justify-content: center;
        gap: 8px;
    }
    
    .team-summary {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .balance-item {
        font-size: 0.85rem;
        padding: 6px 10px;
    }
    
    .team-card {
        padding: 20px;
    }
    
    .team-player {
        padding: 12px;
    }
    
    .stat-item {
        font-size: 0.8rem;
        padding: 3px 8px;
    }
}

/* Player Selection Styles */
.player-selection-section {
    background: white;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
}

.player-selection-section h3 {
    color: #2d3748;
    margin-bottom: 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.method-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 15px;
}

.method-btn {
    padding: 12px 20px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    color: #718096;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.method-btn:hover {
    border-color: #667eea;
    color: #667eea;
}

.method-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
}

.selection-method {
    display: none;
}

.selection-method.active {
    display: block;
}

.method-description {
    color: #718096;
    font-style: italic;
    margin: 15px 0;
    padding: 15px;
    background: #f7fafc;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.manual-controls {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.player-search-box {
    position: relative;
    flex: 1;
    min-width: 250px;
}

.player-search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #a0aec0;
    font-size: 0.9rem;
}

.player-search-box input {
    width: 100%;
    padding: 12px 15px 12px 40px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    transition: border-color 0.3s ease;
}

.player-search-box input:focus {
    outline: none;
    border-color: #667eea;
}

.quick-actions {
    display: flex;
    gap: 10px;
}

.btn-sm {
    padding: 8px 15px;
    font-size: 0.85rem;
}

.players-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
}

.available-players h4,
.selected-players h4 {
    color: #2d3748;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e2e8f0;
    font-weight: 600;
}

.players-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f7fafc;
}

.player-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid #e2e8f0;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
    margin: 2px;
    border-radius: 6px;
}

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

.player-item:hover {
    background: #edf2f7;
    transform: translateY(-1px);
}

.player-item.selected {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.player-info {
    flex: 1;
}

.player-name {
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 2px;
}

.player-region {
    font-size: 0.9em;
    opacity: 0.8;
}

.player-item.selected .player-name {
    color: white;
}

.player-stats {
    font-size: 0.85rem;
    color: #718096;
}

.player-item.selected .player-stats {
    color: rgba(255, 255, 255, 0.9);
}

.player-action {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.add-player {
    background: #48bb78;
    color: white;
}

.add-player:hover {
    background: #38a169;
}

.remove-player {
    background: #e53e3e;
    color: white;
}

.remove-player:hover {
    background: #c53030;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #a0aec0;
    font-style: italic;
}

.empty-state i {
    font-size: 2rem;
    margin-bottom: 10px;
    display: block;
}

@media (max-width: 768px) {
    .players-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .manual-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .player-search-box {
        min-width: 100%;
    }
    
    .method-tabs {
        flex-direction: column;
    }
    
         .quick-actions {
         justify-content: center;
     }
 }

/* Data Source Tabs */
.data-source-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 15px;
}

.source-tab {
    padding: 12px 20px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    color: #718096;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.source-tab:hover {
    border-color: #667eea;
    color: #667eea;
}

.source-tab.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
}

.data-source-panel {
    display: none;
}

.data-source-panel.active {
    display: block;
}

/* Screenshot Upload Styles */
.screenshot-upload {
    max-width: 600px;
    margin: 0 auto;
}

.upload-area {
    border: 3px dashed #cbd5e0;
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    background: #f7fafc;
    transition: all 0.3s ease;
    cursor: pointer;
    margin-bottom: 20px;
}

.upload-area:hover {
    border-color: #667eea;
    background: #edf2f7;
}

.upload-area.dragover {
    border-color: #667eea;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
}

.upload-content i {
    font-size: 3rem;
    color: #a0aec0;
    margin-bottom: 15px;
    display: block;
}

.upload-content h3 {
    color: #2d3748;
    margin-bottom: 10px;
    font-weight: 600;
}

.upload-content p {
    color: #718096;
    margin-bottom: 5px;
}

.file-types {
    font-size: 0.85rem;
    color: #a0aec0 !important;
    font-style: italic;
}

.ocr-info {
    margin-top: 1rem;
    padding: 0.75rem;
    background: linear-gradient(135deg, #10b981, #34d399);
    border-radius: 8px;
    color: white;
    font-size: 0.85rem;
}

.ocr-info i {
    margin-right: 0.5rem;
    color: #fbbf24;
    animation: sparkle 2s ease-in-out infinite;
}

@keyframes sparkle {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.screenshot-options {
    display: flex;
    gap: 20px;
    align-items: end;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.screenshot-options .input-group {
    flex: 1;
    min-width: 200px;
}

.screenshot-options button {
    flex-shrink: 0;
}

.screenshot-preview {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    background: white;
}

.screenshot-preview h4 {
    color: #2d3748;
    margin-bottom: 15px;
    font-weight: 600;
}

.screenshot-preview img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

/* File Selected State */
.upload-area.file-selected {
    border-color: #48bb78;
    background: rgba(72, 187, 120, 0.1);
}

.upload-area.file-selected .upload-content i {
    color: #48bb78;
}

.upload-area.file-selected .upload-content h3 {
    color: #2f855a;
}

/* Processing State */
.upload-area.processing {
    border-color: #ed8936;
    background: rgba(237, 137, 54, 0.1);
}

.upload-area.processing .upload-content i {
    color: #ed8936;
    animation: pulse 1.5s ease-in-out infinite;
}

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

/* Error State */
.upload-area.error {
    border-color: #e53e3e;
    background: rgba(229, 62, 62, 0.1);
}

.upload-area.error .upload-content i {
    color: #e53e3e;
}

.upload-area.error .upload-content h3 {
    color: #c53030;
}

/* Success State */
.upload-area.success {
    border-color: #48bb78;
    background: rgba(72, 187, 120, 0.1);
}

.upload-area.success .upload-content i {
    color: #48bb78;
}

.upload-area.success .upload-content h3 {
    color: #2f855a;
}

@media (max-width: 768px) {
    .data-source-tabs {
        flex-direction: column;
    }
    
    .screenshot-options {
        flex-direction: column;
        align-items: stretch;
    }
    
    .screenshot-options button {
        width: 100%;
    }
    
    .upload-area {
        padding: 30px 15px;
    }
}

/* Regional tabs styling */
.regional-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    padding: 8px;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
}

.region-tab-btn {
    padding: 12px 20px;
    background: linear-gradient(135deg, #ffffff 0%, #f1f5f9 100%);
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 14px;
    color: #475569;
    position: relative;
    overflow: hidden;
    min-width: 120px;
    text-align: center;
}

.region-tab-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-color: #cbd5e1;
}

.region-tab-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.3);
}

/* Specific regional styles */
.region-tab-btn[data-region="vietnam"] {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    color: white;
    border-color: #ff6b6b;
}

.region-tab-btn[data-region="vietnam"]:hover,
.region-tab-btn[data-region="vietnam"].active {
    background: linear-gradient(135deg, #ff5252 0%, #e53935 100%);
    box-shadow: 0 4px 16px rgba(255, 107, 107, 0.4);
}

.region-tab-btn[data-region="thailand"] {
    background: linear-gradient(135deg, #4ecdc4 0%, #44a08d 100%);
    color: white;
    border-color: #4ecdc4;
}

.region-tab-btn[data-region="thailand"]:hover,
.region-tab-btn[data-region="thailand"].active {
    background: linear-gradient(135deg, #26d0ce 0%, #1a9c91 100%);
    box-shadow: 0 4px 16px rgba(78, 205, 196, 0.4);
}

.region-tab-btn[data-region="bali"] {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    color: #8b4513;
    border-color: #fcb69f;
}

.region-tab-btn[data-region="bali"]:hover,
.region-tab-btn[data-region="bali"].active {
    background: linear-gradient(135deg, #ff8c00 0%, #ff6b00 100%);
    color: white;
    box-shadow: 0 4px 16px rgba(255, 140, 0, 0.4);
}

.region-tab-btn[data-region="all"] {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
}

.region-tab-btn[data-region="all"]:hover,
.region-tab-btn[data-region="all"].active {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
}

/* Regional indicator in player table */
.region-indicator {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    margin-left: 8px;
}

.region-indicator.vietnam {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    color: white;
}

.region-indicator.thailand {
    background: linear-gradient(135deg, #4ecdc4 0%, #44a08d 100%);
    color: white;
}

.region-indicator.bali {
    background: linear-gradient(135deg, #ffb347 0%, #ff8c00 100%);
    color: white;
}

/* Sync button styling */
.sync-btn {
    padding: 12px 16px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: 2px solid #10b981;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 14px;
    margin-left: auto;
    min-width: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.sync-btn:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.sync-btn:disabled {
    background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%);
    border-color: #9ca3af;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.sync-btn i {
    font-size: 14px;
}

/* Regional sync status indicator */
.sync-status {
    font-size: 12px;
    color: #6b7280;
    margin-left: 8px;
    font-style: italic;
}

.sync-status.success {
    color: #10b981;
}

.sync-status.error {
    color: #ef4444;
}

.sync-status.pending {
    color: #f59e0b;
}

/* Responsive regional tabs */
@media (max-width: 768px) {
    .regional-tabs {
        flex-wrap: wrap;
        padding: 10px;
        gap: 5px;
    }
    
    .region-tab-btn {
        padding: 8px 12px;
        font-size: 12px;
        flex: 1;
        min-width: 120px;
        justify-content: center;
    }
}

/* Sync panel styling */
.sync-panel {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
    padding: 8px 12px;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border: 2px solid #cbd5e1;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.sync-status-text {
    font-size: 12px;
    color: #475569;
    font-weight: 500;
    white-space: nowrap;
}

.sync-status-text.active {
    color: #059669;
}

.sync-status-text.inactive {
    color: #ef4444;
}

/* Updated sync button for panel */
.sync-panel .sync-btn {
    padding: 8px 12px;
    min-width: 120px;
    font-size: 12px;
    margin-left: 0;
}

/* Auto sync indicator */
.auto-sync-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: #059669;
    background: rgba(5, 150, 105, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    margin-right: 8px;
}

.auto-sync-indicator.inactive {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.auto-sync-indicator i {
    font-size: 10px;
}

/* No map data message styling */
.no-map-data {
    text-align: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    color: #475569;
    max-width: 600px;
    margin: 0 auto;
}

.no-map-data h3 {
    color: #1e293b;
    margin-bottom: 16px;
    font-size: 20px;
}

.no-map-data p {
    margin-bottom: 12px;
    font-size: 14px;
    line-height: 1.5;
}

.no-map-data ul {
    text-align: left;
    display: inline-block;
    margin: 16px 0;
    padding-left: 0;
    list-style: none;
}

.no-map-data li {
    padding: 8px 0;
    font-size: 14px;
    position: relative;
    padding-left: 24px;
}

.no-map-data li:before {
    content: "•";
    color: #3b82f6;
    font-weight: bold;
    position: absolute;
    left: 8px;
}

.no-map-data em {
    font-style: italic;
    color: #64748b;
    font-size: 13px;
}

/* Manual Input Styles */
.manual-input-section {
    margin-top: 20px;
}

.format-selector {
    margin-bottom: 25px;
    padding: 15px;
    background: #f7fafc;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}

.format-selector label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #4a5568;
}

.format-selector select {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    transition: border-color 0.3s ease;
}

.format-selector select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.manual-players-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.manual-player-input {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
}

.manual-player-input:hover {
    border-color: #cbd5e0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.manual-player-input.filled {
    border-color: #667eea;
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
}

.player-input-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.player-number {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
}

.player-input-title {
    color: #4a5568;
    font-weight: 600;
    font-size: 1rem;
}

.input-field {
    margin-bottom: 15px;
}

.input-field label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #4a5568;
    font-size: 0.9rem;
}

.input-field input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.input-field input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.input-field input.filled {
    border-color: #48bb78;
    background: #f0fff4;
}

.input-field input.error {
    border-color: #e53e3e;
    background: #fef5f5;
}

.rating-input {
    position: relative;
}

.rating-input input[type="number"] {
    padding-right: 50px;
}

.rating-hint {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #a0aec0;
    font-size: 0.8rem;
    pointer-events: none;
}

.manual-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    padding: 20px;
    background: #f7fafc;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}

.manual-actions .btn {
    flex: 1;
    max-width: 200px;
}

.input-validation {
    margin-top: 20px;
    padding: 15px;
    border-radius: 10px;
    display: none;
}

.input-validation.success {
    background: #c6f6d5;
    color: #2f855a;
    border: 1px solid #9ae6b4;
    display: block;
}

.input-validation.error {
    background: #fed7d7;
    color: #c53030;
    border: 1px solid #fc8181;
    display: block;
}

.input-validation i {
    margin-right: 8px;
}

/* Team Format Info */
.team-format-info {
    background: linear-gradient(135deg, #e6fffa 0%, #b2f5ea 100%);
    border: 1px solid #81e6d9;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 20px;
    text-align: center;
}

.team-format-info h4 {
    color: #234e52;
    margin-bottom: 8px;
    font-size: 1.1rem;
}

.team-format-info p {
    color: #2d3748;
    margin: 0;
    font-size: 0.95rem;
}

/* Responsive Design for Manual Input */
@media (max-width: 768px) {
    .manual-players-container {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .manual-player-input {
        padding: 15px;
    }
    
    .manual-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .manual-actions .btn {
        max-width: none;
    }
}

@media (max-width: 480px) {
    .format-selector {
        padding: 12px;
    }
    
    .player-input-header {
        gap: 8px;
    }
    
    .player-number {
        width: 25px;
        height: 25px;
        font-size: 0.8rem;
    }
    
    .input-field input {
        padding: 8px 10px;
        font-size: 0.9rem;
    }
}  