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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f5f5f5;
    color: #333;
    overflow-x: hidden;
}

.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 100%;
}

/* Header */
header {
    background: #4A90E2;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

header h1 {
    color: white;
    font-size: 24px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0;
    flex: 1;
}

/* Hamburger Menu */
.hamburger-menu-btn {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: 3px solid white;
    border-radius: 0;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    z-index: 1001;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hamburger-menu-btn:hover {
    border-color: rgba(255, 255, 255, 0.8);
}

.hamburger-menu-btn.active {
    border-radius: 50%;
}

.hamburger-menu-btn span {
    display: none;
}

/* Menu Dropdown */
.menu-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border-radius: 0 0 0 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 10001;
    overflow: hidden;
}

.menu-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.menu-item {
    width: 100%;
    padding: 15px 20px;
    border: none;
    background: white;
    color: #333;
    font-size: 16px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid #f0f0f0;
}

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

.menu-item:hover {
    background: #f5f5f5;
}

.menu-item:active {
    background: #e5e5e5;
}

/* Map Container */
.map-container {
    flex: 1;
    width: 100%;
    min-height: 0;
    position: relative;
}

#map {
    width: 100%;
    height: 100%;
}

/* Bottom Section */
.bottom-section {
    display: flex;
    flex-direction: column;
    height: 50vh;
    min-height: 300px;
    border-top: 2px solid #ddd;
    background: white;
}

/* Leaderboard Panel (Top) */
.leaderboard-panel {
    flex: 1;
    border-bottom: 2px solid #ddd;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.leaderboard-scrollable {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    padding: 15px;
    margin-bottom: 12px;
    background: #f9f9f9;
    border-radius: 8px;
    border-left: 4px solid #4A90E2;
    gap: 15px;
}

.leaderboard-item.first {
    border-left-color: #FFD700;
    background: #fff9e6;
}

.leaderboard-item.second {
    border-left-color: #C0C0C0;
    background: #f5f5f5;
}

.leaderboard-item.third {
    border-left-color: #CD7F32;
    background: #faf5f0;
}

.player-avatar {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 3px solid #4A90E2;
    overflow: hidden;
    background: white;
}

.player-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.leaderboard-item.first .player-avatar {
    border-color: #FFD700;
}

.leaderboard-item.second .player-avatar {
    border-color: #C0C0C0;
}

.leaderboard-item.third .player-avatar {
    border-color: #CD7F32;
}

.player-info {
    flex: 1;
    min-width: 0;
}

.player-name {
    font-weight: 600;
    font-size: 16px;
    color: #333;
    margin-bottom: 4px;
}

.player-score {
    font-size: 18px;
    font-weight: bold;
    color: #4A90E2;
}

/* Found Plate Panel (Bottom) */
.found-plate-panel {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    padding: 0 15px 10px 15px;
    justify-content: flex-end;
}

.btn-add-plate {
    background: #4A90E2;
    color: white;
    border: none;
    padding: 15px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: background 0.2s;
    align-self: stretch;
}

.btn-add-plate:hover {
    background: #357ABD;
}

.found-plate-controls {
    display: flex;
    justify-content: center;
}

.btn-submit {
    flex: 1;
    background: #4A90E2;
    color: white;
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-submit:hover:not(:disabled) {
    background: #357ABD;
}

.btn-submit:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Modal Styles */
.modal {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 15px;
    padding: 30px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.modal-content h2 {
    font-size: 24px;
    margin-bottom: 10px;
    color: #333;
    text-align: center;
}

.modal-subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 20px;
}

#players-input-container {
    margin-bottom: 20px;
}

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

.player-input {
    flex: 1;
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 16px;
}

.player-input:focus {
    outline: none;
    border-color: #4A90E2;
}

.remove-player-btn {
    width: 30px;
    height: 30px;
    border: none;
    background: transparent;
    color: #ef4444;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
    line-height: 1;
}

.remove-player-btn:hover {
    color: #dc2626;
    transform: scale(1.2);
}

.modal-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

button {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: #4A90E2;
    color: white;
    width: 100%;
}

.btn-primary:hover:not(:disabled) {
    background: #357ABD;
}

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.btn-secondary {
    background: #e5e7eb;
    color: #374151;
    flex: 1;
}

.btn-secondary:hover {
    background: #d1d5db;
}

#add-more-players-btn {
    margin-top: 5px;
    margin-bottom: 5px;
}

/* Plate Selection Modal */
.plate-modal-content {
    max-width: 600px;
}

.state-search {
    margin-bottom: 20px;
}

#state-search-input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 16px;
}

#state-search-input:focus {
    outline: none;
    border-color: #4A90E2;
}

.state-list-scrollable {
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.state-option {
    padding: 15px;
    border-bottom: 1px solid #e5e7eb;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.state-option:hover {
    background: #f0f0f0;
}

.state-option.selected {
    background: #e8f4f8;
    border-left: 4px solid #4A90E2;
}

.state-option-name {
    font-weight: 600;
    font-size: 16px;
}

.state-option-points {
    color: #4A90E2;
    font-weight: bold;
}

/* Responsive Design */
@media (max-width: 768px) {
    .bottom-section {
        height: auto;
        max-height: 50vh;
    }

    .leaderboard-panel {
        flex: 1;
        border-bottom: 2px solid #ddd;
    }

    .found-plate-panel {
        flex: 0 0 auto;
        padding-bottom: 10px;
    }

    header h1 {
        font-size: 20px;
    }
    
    .hamburger-menu-btn {
        right: 15px;
        width: 25px;
        height: 25px;
    }
    
    .menu-dropdown {
        min-width: 180px;
    }
    
    .menu-item {
        padding: 12px 15px;
        font-size: 14px;
    }

    .player-name {
        font-size: 14px;
    }

    .player-score {
        font-size: 16px;
    }
}

/* Scrollbar Styling */
.leaderboard-scrollable::-webkit-scrollbar,
.state-list-scrollable::-webkit-scrollbar {
    width: 8px;
}

.leaderboard-scrollable::-webkit-scrollbar-track,
.state-list-scrollable::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.leaderboard-scrollable::-webkit-scrollbar-thumb,
.state-list-scrollable::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.leaderboard-scrollable::-webkit-scrollbar-thumb:hover,
.state-list-scrollable::-webkit-scrollbar-thumb:hover {
    background: #555;
}
