:root {
    --primary-color: #0d6efd;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
}

.navbar-brand {
    font-weight: bold;
    font-size: 1.5rem;
}

.card {
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.card-header {
    border-radius: 10px 10px 0 0 !important;
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(0, 0, 0, 0.02);
}

.btn {
    border-radius: 5px;
    padding: 8px 16px;
}

.badge {
    padding: 5px 10px;
    border-radius: 5px;
}

.score-input {
    font-weight: bold;
    text-align: center;
}

.table-secondary {
    opacity: 0.7;
}

.alert {
    border-radius: 8px;
}

.modal-content {
    border-radius: 10px;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.btn-check:checked + .btn-outline-info {
    background-color: var(--info-color);
    border-color: var(--info-color);
}

.btn-check:checked + .btn-outline-warning {
    background-color: var(--warning-color);
    border-color: var(--warning-color);
}

.btn-check:checked + .btn-outline-danger {
    background-color: var(--danger-color);
    border-color: var(--danger-color);
    color: white;
}

.btn-check:checked + .btn-outline-success {
    background-color: var(--success-color);
    border-color: var(--success-color);
}

.game-stats {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 10px;
}

.player-card {
    transition: transform 0.2s;
}

.player-card:hover {
    transform: translateY(-5px);
}

@media (max-width: 768px) {
    body {
        font-size: 14px;
    }
    
    .container {
        padding-left: 10px;
        padding-right: 10px;
    }
    
    h1 {
        font-size: 1.5rem;
    }
    
    h2, h5 {
        font-size: 1.2rem;
    }
    
    .navbar-brand {
        font-size: 1.2rem;
    }
    
    .btn {
        min-height: 44px;
        font-size: 1rem;
        padding: 10px 16px;
    }
    
    .btn-sm {
        min-height: 38px;
        font-size: 0.9rem;
        padding: 8px 12px;
    }
    
    .table-responsive {
        font-size: 0.85rem;
        margin-left: -10px;
        margin-right: -10px;
        border-radius: 0;
    }
    
    .table th, .table td {
        padding: 8px 4px;
        font-size: 0.85rem;
    }
    
    .score-entry-buttons .btn-compact {
        flex: 0 0 auto;
    }
    
    .score-input {
        font-size: 1rem;
        height: 44px;
        text-align: center;
    }
    
    input[type="number"],
    input[type="text"],
    input[type="password"],
    select,
    textarea {
        min-height: 44px;
        font-size: 1rem;
    }
    
    .form-check-input {
        width: 24px;
        height: 24px;
        margin-top: 0;
    }
    
    .card {
        margin-bottom: 15px;
        border-radius: 8px;
    }
    
    .card-body {
        padding: 12px;
    }
    
    .score-col-player {
        min-width: 100px;
        max-width: 100px;
        font-size: 0.85rem;
    }
    
    .score-col-total {
        min-width: 60px;
        right: 90px;
        font-size: 0.9rem;
    }
    
    .score-col-status {
        min-width: 90px;
        font-size: 0.75rem;
    }
    
    .round-score-cell {
        min-width: 50px;
        max-width: 60px;
        font-size: 0.8rem;
        padding: 0.2rem !important;
    }
    
    .modal-dialog {
        margin: 10px;
    }
    
    .modal-body {
        padding: 15px;
    }
    
    .badge {
        font-size: 0.75rem;
        padding: 4px 8px;
    }
    
    .d-flex.gap-2 {
        flex-direction: column;
        gap: 10px !important;
    }
    
    .d-flex.gap-2 .btn {
        width: 100%;
    }
    
    .navbar-nav {
        text-align: center;
    }
    
    .navbar-nav .nav-item {
        padding: 5px 0;
    }
    
    .alert {
        font-size: 0.9rem;
        padding: 10px;
    }
    
    .list-group-item {
        font-size: 0.9rem;
        padding: 10px;
    }
    
    .form-label {
        font-size: 0.95rem;
        margin-bottom: 6px;
    }
    
    .row.mb-3 {
        margin-bottom: 15px !important;
    }
    
    .table-hover tbody tr {
        cursor: pointer;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.3rem;
    }
    
    .score-entry-name {
        min-width: 60px;
        max-width: 70px;
        font-size: 0.75rem;
    }
    
    .score-entry-name strong {
        font-size: 0.8rem;
    }
    
    .score-entry-name small {
        font-size: 0.65rem;
    }
    
    .score-entry-input {
        flex: 0 0 45px;
    }
    
    .score-entry-input input {
        width: 45px;
        height: 36px;
        font-size: 0.95rem;
    }
    
    .btn-compact {
        padding: 3px 4px;
        font-size: 0.7rem;
        min-width: 30px;
        height: 36px;
    }
    
    .score-entry-buttons {
        gap: 2px;
    }
    
    .score-col-player {
        min-width: 80px;
        max-width: 80px;
        font-size: 0.75rem;
    }
    
    .score-col-total {
        min-width: 50px;
        right: 75px;
    }
    
    .score-col-status {
        min-width: 75px;
    }
    
    .round-score-cell {
        min-width: 45px;
        max-width: 50px;
        font-size: 0.75rem;
    }
}

.round-history-item {
    border-left: 3px solid var(--primary-color);
    padding-left: 10px;
    margin-bottom: 15px;
}

.winner-badge {
    font-size: 2rem;
    animation: pulse 2s infinite;
}

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

.table-responsive {
    scroll-behavior: smooth;
}

.table-responsive::-webkit-scrollbar {
    height: 8px;
    width: 8px;
}

.table-responsive::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.sticky-top {
    position: sticky;
    top: 0;
    z-index: 10;
}

.table-bordered td, .table-bordered th {
    border: 1px solid #dee2e6;
}

.table-sm td, .table-sm th {
    padding: 0.5rem;
}

.score-col-player {
    position: sticky;
    left: 0;
    z-index: 3;
    background-color: #f8f9fa;
    font-weight: bold;
    white-space: nowrap;
    min-width: 120px;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-left: 8px !important;
    padding-right: 8px !important;
}

.score-col-total {
    position: sticky;
    right: 120px;
    z-index: 3;
    background-color: #ffc107 !important;
    font-weight: bold;
    font-size: 1.1em;
    min-width: 80px;
    color: #000 !important;
}

.score-col-status {
    position: sticky;
    right: 0;
    z-index: 3;
    background-color: #f8f9fa;
    white-space: nowrap;
    min-width: 120px;
}

.score-player-cell-active {
    background-color: white;
    white-space: nowrap !important;
    overflow: hidden;
    text-overflow: ellipsis;
}

.score-player-cell-out {
    background-color: #e2e3e5;
    white-space: nowrap !important;
    overflow: hidden;
    text-overflow: ellipsis;
}

.score-total-cell-active {
    background-color: #ffc107 !important;
    color: #000 !important;
    font-weight: bold !important;
}

.score-total-cell-out {
    background-color: #e0a800 !important;
    color: #000 !important;
    font-weight: bold !important;
}

.score-status-cell-active {
    background-color: white;
}

.score-status-cell-out {
    background-color: #e2e3e5;
}

thead .score-col-player,
thead .score-col-total,
thead .score-col-status {
    z-index: 4;
}

thead .score-col-total {
    background-color: #ffc107 !important;
    color: #000 !important;
    font-weight: bold !important;
}

.round-score-cell {
    min-width: 70px;
    max-width: 90px;
    white-space: nowrap !important;
    overflow: visible;
    padding: 0.3rem !important;
}

.score-value {
    display: inline;
    font-weight: normal;
}

.score-icon {
    display: inline;
    margin-left: 2px;
    font-size: 0.9em;
}

.btn-outline-info.disabled,
.btn-outline-warning.disabled,
.btn-outline-danger.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-check:disabled + .btn {
    opacity: 0.4;
    cursor: not-allowed;
}

.list-group-item {
    cursor: move;
    transition: background-color 0.2s;
}

.list-group-item:hover {
    background-color: #f8f9fa;
}

.list-group-item.dragging {
    opacity: 0.5;
}

#selected-players-list .badge {
    width: 30px;
    text-align: center;
}

.mobile-score-row {
    background: white;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 8px;
    border: 1px solid #ddd;
}

.score-entry-container {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
}

.score-entry-name {
    flex: 0 0 auto;
    min-width: 80px;
    max-width: 120px;
    font-size: 0.9rem;
}

.score-entry-input {
    flex: 0 0 60px;
}

.score-entry-input input {
    width: 60px;
    padding: 6px 4px;
    text-align: center;
    font-weight: bold;
}

.score-entry-buttons {
    flex: 1 1 auto;
    display: flex;
    gap: 4px;
    flex-wrap: nowrap;
    overflow-x: auto;
}

.btn-compact {
    padding: 6px 8px;
    font-size: 0.85rem;
    white-space: nowrap;
    min-width: 45px;
}

@media (max-width: 768px) {
    .mobile-score-row {
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }
    
    .mobile-score-row strong {
        font-size: 1.1rem;
        display: block;
        margin-bottom: 8px;
    }
    
    .mobile-score-row small {
        font-size: 0.85rem;
    }
    
    .score-entry-row {
        background: #f8f9fa;
        padding: 8px;
        border-radius: 6px;
        margin-bottom: 8px;
    }
    
    .score-entry-container {
        gap: 6px;
    }
    
    .score-entry-name {
        min-width: 70px;
        max-width: 90px;
        font-size: 0.85rem;
    }
    
    .score-entry-name strong {
        font-size: 0.9rem;
        display: block;
        margin-bottom: 2px;
    }
    
    .score-entry-name small {
        font-size: 0.7rem;
    }
    
    .score-entry-input {
        flex: 0 0 50px;
    }
    
    .score-entry-input input {
        width: 50px;
        height: 38px;
        padding: 4px 2px;
        font-size: 1rem;
    }
    
    .score-entry-buttons {
        gap: 3px;
        flex-wrap: nowrap;
    }
    
    .btn-compact {
        padding: 4px 6px;
        font-size: 0.75rem;
        min-width: 35px;
        height: 38px;
        line-height: 1.2;
    }
    
    .btn-group {
        display: flex;
        flex-wrap: nowrap;
    }
    
    .sticky-header-mobile {
        position: sticky;
        top: 56px;
        z-index: 999;
        background: white;
        padding: 10px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }
    
    .score-sheet-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .touch-friendly-checkbox {
        transform: scale(1.5);
        margin-right: 10px;
    }
    
    .d-flex.justify-content-between {
        flex-direction: column;
        gap: 10px;
    }
    
    .d-flex.justify-content-between > * {
        width: 100%;
    }
    
    .mb-4 {
        margin-bottom: 1rem !important;
    }
}

@media (min-width: 769px) {
    .score-entry-container {
        gap: 12px;
    }
    
    .score-entry-name {
        min-width: 120px;
        max-width: 150px;
        font-size: 1rem;
    }
    
    .score-entry-input {
        flex: 0 0 70px;
    }
    
    .score-entry-input input {
        width: 70px;
        height: 42px;
    }
    
    .btn-compact {
        padding: 8px 12px;
        font-size: 0.9rem;
        min-width: auto;
    }
}

/* Full row highlighting styles for highest and lowest scores per round - More specific selectors */
tbody tr.player-row-highest {
    background-color: #ffcdd2 !important; /* Light red background for worst performer */
    color: #b71c1c !important; /* Dark red text for better contrast */
    font-weight: bold !important;
    border-left: 4px solid #d32f2f !important;
    border-right: 4px solid #d32f2f !important;
}

tbody tr.player-row-highest td {
    background-color: #ffcdd2 !important;
    color: #b71c1c !important;
    font-weight: bold !important;
}

tbody tr.player-row-lowest {
    background-color: #c8e6c9 !important; /* Light green background for best performer */
    color: #1b5e20 !important; /* Dark green text for better contrast */
    font-weight: bold !important;
    border-left: 4px solid #388e3c !important;
    border-right: 4px solid #388e3c !important;
}

tbody tr.player-row-lowest td {
    background-color: #c8e6c9 !important;
    color: #1b5e20 !important;
    font-weight: bold !important;
}

/* Ensure highlighted rows override sticky column backgrounds */
tbody tr.player-row-highest .score-col-player,
tbody tr.player-row-highest .score-col-total,
tbody tr.player-row-highest .score-col-status {
    background-color: #ffcdd2 !important;
    color: #b71c1c !important;
    font-weight: bold !important;
}

tbody tr.player-row-lowest .score-col-player,
tbody tr.player-row-lowest .score-col-total,
tbody tr.player-row-lowest .score-col-status {
    background-color: #c8e6c9 !important;
    color: #1b5e20 !important;
    font-weight: bold !important;
}

/* Score entry name highlighting styles - only highlight the player name */
.score-name-highest {
    background-color: #ffcdd2 !important; /* Light red background for worst performer */
    color: #b71c1c !important; /* Dark red text */
    font-weight: bold !important;
    border-radius: 4px !important;
    padding: 4px 8px !important;
    display: inline-block !important;
}

.score-name-lowest {
    background-color: #c8e6c9 !important; /* Light green background for best performer */
    color: #1b5e20 !important; /* Dark green text */
    font-weight: bold !important;
    border-radius: 4px !important;
    padding: 4px 8px !important;
    display: inline-block !important;
    margin: 0 !important; /* Ensure no margin affects alignment */
    vertical-align: baseline !important; /* Maintain baseline alignment */
}

/* Ensure score entry rows maintain proper alignment */
.score-entry-row {
    margin-bottom: 0.5rem !important;
    display: flex !important;
    align-items: center !important;
}

.score-entry-container {
    display: flex !important;
    align-items: center !important;
    width: 100% !important;
}

.score-entry-name {
    flex: 1 !important;
    margin-right: 1rem !important;
}

/* Different colored infinity symbols for Scout and Half Scout */
.infinity-scout {
    color: #1976d2 !important; /* Blue color for Scout (20 points) */
    font-weight: bold !important;
    font-size: 1.1em !important;
    text-shadow: 0 0 2px rgba(25, 118, 210, 0.3) !important;
    margin-left: 2px !important;
}

.infinity-half-scout {
    color: #ff6f00 !important; /* Orange color for Half Scout (40 points) */
    font-weight: bold !important;
    font-size: 1.1em !important;
    text-shadow: 0 0 2px rgba(255, 111, 0, 0.3) !important;
    margin-left: 2px !important;
}

/* Style infinity symbols in score cells */
.round-score-cell .infinity-scout,
.round-score-cell .infinity-half-scout,
.score-highest .infinity-scout,
.score-highest .infinity-half-scout,
.score-lowest .infinity-scout,
.score-lowest .infinity-half-scout {
    font-weight: bold !important;
    font-size: 1.1em !important;
    margin-left: 2px !important;
}

/* Individual score cell highlighting for specific rounds */
.score-highest {
    background-color: #ffcdd2 !important; /* Slightly darker red for individual cells */
    color: #c62828 !important;
    font-weight: bold !important;
    border: 2px solid #e57373 !important;
    border-radius: 4px;
}

.score-lowest {
    background-color: #c8e6c9 !important; /* Slightly darker green for individual cells */
    color: #2e7d32 !important;
    font-weight: bold !important;
    border: 2px solid #81c784 !important;
    border-radius: 4px;
}

/* Ensure highlighting works on mobile */
@media (max-width: 768px) {
    .score-highest,
    .score-lowest {
        font-size: 0.85rem;
        padding: 2px 4px;
    }
    
    .player-row-highest,
    .player-row-lowest {
        font-size: 0.85rem;
    }
}

/* Additional styling for better visibility */
.score-highest .score-value,
.score-lowest .score-value {
    font-weight: bold !important;
    font-size: 1.1em;
}

/* Ensure highlighting works in round history */
.round-history-item .score-highest,
.round-history-item .score-lowest {
    padding: 4px 8px;
    margin: 2px 0;
    border-radius: 4px;
    display: inline-block;
}

.round-history-item .score-highest {
    background-color: #ffebee !important;
    color: #c62828 !important;
    border: 1px solid #e57373 !important;
}

.round-history-item .score-lowest {
    background-color: #e8f5e8 !important;
    color: #2e7d32 !important;
    border: 1px solid #81c784 !important;
}

