/* Enhanced Rugby Controller Styling */
.controller-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
}

.controller-header {
    background: linear-gradient(135deg, #4A90E2, #87CEEB);
    color: white;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    text-align: center;
}

.controller-header h1 {
    margin: 0 0 15px 0;
    font-size: 2.5em;
    font-weight: bold;
}

.main-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.primary-btn {
    background: #FF6B35;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
}

.primary-btn:hover {
    background: #E55A2B;
}

.secondary-btn {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.3s;
}

.secondary-btn:hover {
    background: #45a049;
}

/* Section Styling */
section {
    background: white;
    margin-bottom: 20px;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

section h2 {
    margin: 0 0 15px 0;
    color: #2E86AB;
    font-size: 1.5em;
    font-weight: bold;
    border-bottom: 2px solid #2E86AB;
    padding-bottom: 5px;
}

section h3 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 1.2em;
    font-weight: bold;
}

/* Teams Section */
.teams-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.team-card {
    padding: 15px;
    border-radius: 8px;
    border: 2px solid #ddd;
}

.home-team {
    border-color: #4A90E2;
    background: #f0f8ff;
}

.away-team {
    border-color: #FF6B35;
    background: #fff5f0;
}

.team-name-input {
    width: 95%;
    padding: 8px;
    margin: 5px 0 10px 0;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

.logo-input {
    width: 100%;
    margin: 5px 0;
}

.logo-preview {
    max-width: 100px;
    max-height: 50px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-top: 5px;
}

/* Game Control Section */
.control-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.clock-card, .conversion-card {
    padding: 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: #f9f9f9;
}

.clock-inputs {
    display: flex;
    gap: 10px;
    align-items: center;
    margin: 10px 0;
}

.clock-controls, .kick-type-selector {
    display: flex;
    gap: 15px;
    margin: 10px 0;
    justify-content: center;
}

.kick-type-selector label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: bold;
    padding: 5px 10px;
    border-radius: 4px;
    background: #f0f8ff;
    border: 1px solid #4A90E2;
}
.boldLabel {
    font-weight: bold;
    color: #333;
}
.conversion-controls {
    display: flex;
    gap: 15px;
    margin: 10px 0;
    justify-content: center;
}

.start-btn {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
}

.stop-btn {
    background: #f44336;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
}

.set-btn {
    background: #9C27B0;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
}

.sync-btn {
    background: #2196F3;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
}

.half-control {
    margin-top: 20px;
    padding: 15px;
    background: #f0f8ff;
    border-radius: 8px;
}

.half-text-input {
    width: 200px;
    padding: 8px;
    margin: 10px 0;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.half-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.half-buttons label {
    display: flex;
    align-items: center;
    gap: 5px;
}

.t4sNumber {
    width: 60px;
    padding: 5px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: center;
}

.styleField {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: monospace;
}

/* Scoring Section */
.scoring-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.team-scoring {
    padding: 15px;
    border-radius: 8px;
    border: 2px solid #ddd;
}

.home-scoring {
    border-color: #4A90E2;
    background: #f0f8ff;
}

.away-scoring {
    border-color: #FF6B35;
    background: #fff5f0;
}

.score-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 15px;
}

.score-item {
    display: flex;
    flex-direction: column;
}

.score-item label {
    font-weight: bold;
    margin-bottom: 5px;
    color: #333;
}

.total-score {
    text-align: center;
    padding: 10px;
    background: #e6f3ff;
    border-radius: 6px;
    border: 2px solid #4A90E2;
}

.total-score label {
    font-weight: bold;
    font-size: 1.1em;
    color: #2E86AB;
}

.total-score-input {
    font-size: 1.5em;
    font-weight: bold;
    text-align: center;
    width: 80px;
    padding: 5px;
    border: 2px solid #4A90E2;
    border-radius: 4px;
    margin-left: 10px;
}

/* Match Settings Section */
.settings-grid {
    display: grid;
    gap: 20px;
}

.animation-settings, .message-settings {
    padding: 15px;
    background: #f9f9f9;
    border-radius: 8px;
    border: 1px solid #ddd;
}

.animation-settings label {
    display: flex;
    align-items: center;
    gap: 5px;
    margin: 5px 0;
}

.message-input {
    width: 95%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin: 10px 0;
}

.clear-btn {
    background: #f44336;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
}

/* Players Section */
.add-player-card {
    background: #f0f8ff;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #4A90E2;
    margin-bottom: 20px;
}

.sin-bin-editor {
    background: #fff8dc;
    padding: 15px;
    border-radius: 8px;
    border: 2px solid #FFD700;
    margin-bottom: 20px;
}

.sin-bin-editor h3 {
    margin: 0 0 10px 0;
    color: #B8860B;
}

.sin-bin-controls {
    display: grid;
    grid-template-columns: 1fr 1fr 120px auto;
    gap: 10px;
    align-items: center;
}

.sin-bin-controls select,
.sin-bin-controls input {
    padding: 8px;
    border: 1px solid #DAA520;
    border-radius: 4px;
}

.edit-btn {
    background: #DAA520;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}

.edit-btn:hover {
    background: #B8860B;
}

/* Card Management Styles */
.card-management {
    margin-bottom: 30px;
}

.teams-container {
    display: flex;
    gap: 20px;
    margin-top: 15px;
}

.team-roster {
    flex: 1;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    border: 2px solid #e9ecef;
}

.team-roster h4 {
    margin: 0 0 15px 0;
    color: #495057;
    font-size: 16px;
    font-weight: bold;
}

.roster-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.player-card-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: white;
    border-radius: 5px;
    border: 1px solid #dee2e6;
}

.player-info {
    font-weight: 500;
    color: #495057;
    flex: 1;
}

.card-time {
    font-size: 12px;
    color: #856404;
    font-weight: normal;
    font-style: italic;
}

.player-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-buttons {
    display: flex;
    gap: 5px;
}

.sub-controls {
    display: flex;
    align-items: center;
}

.sub-select {
    padding: 2px 6px;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 11px;
    background: white;
    cursor: pointer;
    min-width: 50px;
}

.sub-select:hover {
    border-color: #007bff;
}

.sub-select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 1px #007bff;
}

.card-btn {
    padding: 4px 8px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    min-width: 35px;
}

.yellow-btn {
    background: #ffc107;
    color: #000;
}

.yellow-btn:hover {
    background: #e0a800;
}

.red-btn {
    background: #dc3545;
    color: white;
}

.red-btn:hover {
    background: #c82333;
}

.clear-btn {
    background: #6c757d;
    color: white;
}

.clear-btn:hover {
    background: #5a6268;
}

.card-btn.active {
    box-shadow: 0 0 0 2px #007bff;
}

/* Tackle Count Styles */
.tackle-count-section {
    background: white;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.tackle-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.tackle-display {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: bold;
}

.tackle-label {
    color: #495057;
}

.tackle-number {
    background: #007bff;
    color: white;
    padding: 8px 16px;
    border-radius: 50%;
    font-size: 24px;
    font-weight: bold;
    min-width: 50px;
    text-align: center;
}

.tackle-number.fifth-tackle {
    background: #dc3545;
    animation: pulse 1s infinite;
}

.tackle-number.sixth-tackle {
    background: #6f42c1;
}

.tackle-of {
    color: #6c757d;
    font-size: 16px;
}

.tackle-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.tackle-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
}

.tackle-btn:hover {
    background: #218838;
}

.tackle-btn:nth-child(2) {
    background: #17a2b8;
}

.tackle-btn:nth-child(2):hover {
    background: #138496;
}

.tackle-btn:nth-child(3) {
    background: #ffc107;
    color: #000;
}

.tackle-btn:nth-child(3):hover {
    background: #e0a800;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.player-inputs {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.team-selector {
    display: flex;
    gap: 20px;
}

.team-selector label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: bold;
}

.player-details {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.player-details label {
    font-weight: bold;
}

.add-btn {
    background: #4A90E2;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}

.players-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.team-players {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #ddd;
}

.team-players h4 {
    margin: 0 0 10px 0;
    color: #2E86AB;
    font-weight: bold;
}

/* Style Section */
.theme-selector {
    background: #f0f8ff;
    padding: 15px;
    border-radius: 8px;
    border: 2px solid #4A90E2;
    margin-bottom: 20px;
}

.theme-selector h3 {
    margin: 0 0 10px 0;
    color: #2E86AB;
}

.theme-selector select {
    width: 100%;
    padding: 10px;
    border: 1px solid #4A90E2;
    border-radius: 4px;
    font-size: 16px;
    background: white;
}

.style-inputs {
    display: grid;
    gap: 15px;
}

.style-item {
    display: flex;
    flex-direction: column;
}

.style-item label {
    font-weight: bold;
    margin-bottom: 5px;
    color: #333;
}

/* Responsive Design */
@media (max-width: 768px) {
    .teams-grid, .control-grid, .scoring-grid, .players-grid {
        grid-template-columns: 1fr;
    }

    .settings-grid {
        grid-template-columns: 1fr;
    }

    .player-details {
        flex-direction: column;
        align-items: stretch;
    }

    .main-controls {
        flex-direction: column;
    }

    .message-control {
        flex-direction: column;
        align-items: stretch;
    }

    .animation-options {
        flex-direction: column;
        gap: 10px;
    }
}

/* Football-specific styles */
.animation-control {
    margin-top: 20px;
    padding: 15px;
    background: #f0f8ff;
    border-radius: 8px;
    border: 2px solid #4A90E2;
}

.animation-options {
    display: flex;
    gap: 20px;
    margin-top: 10px;
}

.animation-options label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: bold;
}

.message-section {
    margin-bottom: 20px;
}

.message-control {
    display: flex;
    gap: 15px;
    align-items: center;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 8px;
    border: 2px solid #ddd;
}

.message-input {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

.clear-btn {
    background: #f44336;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}

.clear-btn:hover {
    background: #d32f2f;
}

.player-name-input {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    min-width: 150px;
}

.players-list {
    min-height: 100px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fafafa;
}

.team-players {
    padding: 15px;
    border-radius: 8px;
    border: 2px solid #ddd;
    background: #f9f9f9;
}

.styling-section {
    margin-bottom: 20px;
}

.styling-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

/* Connection status styles */
.connection-status {
    text-align: center;
    margin-bottom: 10px;
}

.status-connected {
    color: #4CAF50;
    font-weight: bold;
}

.status-disconnected {
    color: #f44336;
    font-weight: bold;
}

/* Tab Navigation Styles */
.tab-container {
    margin-bottom: 20px;
}

.tab-navigation {
    display: flex;
    background: #f5f5f5;
    border-radius: 8px;
    padding: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.tab-btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    background: transparent;
    color: #666;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.tab-btn:hover {
    background: rgba(74, 144, 226, 0.1);
    color: #4A90E2;
}

.tab-btn.active {
    background: #4A90E2;
    color: white;
    box-shadow: 0 2px 8px rgba(74, 144, 226, 0.3);
}

.tab-btn.active:hover {
    background: #357ABD;
}

/* Tab Content Styles */
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease-in;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive tab design */
@media (max-width: 768px) {
    .tab-btn {
        font-size: 14px;
        padding: 10px 15px;
    }

    .tab-navigation {
        flex-direction: column;
        gap: 2px;
    }

    .tab-btn {
        border-radius: 4px;
    }
}

/* Game Log Styles */
.game-log-section {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.log-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.clear-log-btn, .export-log-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}

.clear-log-btn {
    background-color: #dc3545;
    color: white;
}

.export-log-btn {
    background-color: #28a745;
    color: white;
}

.clear-log-btn:hover {
    background-color: #c82333;
}

.export-log-btn:hover {
    background-color: #218838;
}

.game-log-container {
    border: 1px solid #ddd;
    border-radius: 4px;
    max-height: 500px;
    overflow-y: auto;
}

.log-header {
    display: grid;
    grid-template-columns: 100px 120px 1fr;
    gap: 10px;
    padding: 10px;
    background-color: #f8f9fa;
    border-bottom: 2px solid #ddd;
    font-weight: bold;
}

.log-entries {
    max-height: 450px;
    overflow-y: auto;
}

.log-entry {
    display: grid;
    grid-template-columns: 100px 120px 1fr;
    gap: 10px;
    padding: 8px 10px;
    border-bottom: 1px solid #eee;
    font-size: 14px;
}

.log-entry:nth-child(even) {
    background-color: #f8f9fa;
}

.log-time {
    font-weight: bold;
    color: #007bff;
}

.log-action {
    font-weight: bold;
}

.log-action.card {
    color: #dc3545;
}

.log-action.score {
    color: #28a745;
}

.log-details {
    color: #666;
}

/* Player Display Styles */
.player-display-section {
    background: #e8f4fd;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    border: 2px solid #007bff;
}

.player-display-controls {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.player-display-controls .show-players-btn {
    flex: 1;
    min-width: 150px;
}

.player-display-controls .hide-players-btn {
    flex: 2;
    min-width: 200px;
}

.show-players-btn, .hide-players-btn {
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
    transition: all 0.3s ease;
}

.show-players-btn {
    background-color: #007bff;
    color: white;
}

.show-players-btn:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
}

.hide-players-btn {
    background-color: #6c757d;
    color: white;
}

.hide-players-btn:hover {
    background-color: #545b62;
    transform: translateY(-2px);
}

.player-display-info {
    background: white;
    padding: 15px;
    border-radius: 4px;
    border-left: 4px solid #007bff;
}

.player-display-info p {
    margin: 5px 0;
    color: #495057;
}

.player-display-info strong {
    color: #007bff;
}

/* Player Management Controls */
.player-management-controls {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    padding: 15px;
    background-color: rgba(255, 0, 0, 0.1);
    border: 1px solid rgba(255, 0, 0, 0.3);
    border-radius: 8px;
}

.clear-players-btn {
    padding: 10px 15px;
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: bold;
    transition: all 0.3s ease;
    flex: 1;
}

.clear-players-btn:hover {
    background: linear-gradient(135deg, #c82333, #a71e2a);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(220, 53, 69, 0.3);
}

.clear-players-btn.danger {
    background: linear-gradient(135deg, #8B0000, #660000);
    border: 2px solid #FF4500;
}

.clear-players-btn.danger:hover {
    background: linear-gradient(135deg, #660000, #4d0000);
    border-color: #FF6500;
    box-shadow: 0 4px 12px rgba(139, 0, 0, 0.5);
}

/* Unified Player Management */
.player-management-unified {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.player-summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.team-summary {
    background: #f8f9fa;
    border-radius: 6px;
    padding: 15px;
    text-align: center;
    border: 2px solid #dee2e6;
}

.team-summary h3 {
    margin: 0 0 10px 0;
    color: #495057;
    font-size: 1.2em;
}

.player-count {
    background: #007bff;
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-weight: bold;
    display: inline-block;
}

.player-management-actions {
    text-align: center;
}

.manage-players-btn {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 10px;
}

.manage-players-btn:hover {
    background: linear-gradient(135deg, #0056b3, #004085);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 123, 255, 0.3);
}

.management-info {
    color: #6c757d;
    font-size: 0.9em;
    margin: 0;
    font-style: italic;
}

@media (max-width: 768px) {
    .player-summary {
        grid-template-columns: 1fr;
    }
}