/* Live-Punktetafel CSS */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

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

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 300;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 10px;
}

.connected {
    color: #4ade80;
}

.disconnected {
    color: #f87171;
}

main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.control-panel {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.team-management, .round-control, .mass-import-control {
    margin-bottom: 30px;
}

h2 {
    color: #4a5568;
    margin-bottom: 15px;
    font-size: 1.5rem;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 10px;
}

.add-team {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.add-team input {
    flex: 1;
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.add-team input:focus {
    outline: none;
    border-color: #667eea;
}

.add-team button {
    padding: 12px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.3s;
}

.add-team button:hover {
    background: #5a67d8;
}

.teams-list {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 15px;
    background: #f8fafc;
}

.team-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    margin-bottom: 10px;
    background: white;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.team-info {
    flex: 1;
}

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

.team-cards {
    font-size: 0.9rem;
    color: #718096;
}

.team-actions {
    display: flex;
    gap: 8px;
}

.team-actions button {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.3s;
}

.remove-card-btn {
    background: #fed7d7;
    color: #c53030;
}

.remove-card-btn:hover {
    background: #feb2b2;
}

.remove-team-btn {
    background: #feebc8;
    color: #dd6b20;
}

.remove-team-btn:hover {
    background: #fbd38d;
}

.round-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    padding: 15px;
    background: #f7fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.round-info strong {
    color: #4a5568;
}

.round-info span {
    margin-right: 20px;
}

.round-control button {
    display: block;
    width: 100%;
    padding: 12px;
    margin-bottom: 10px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.3s;
}

.new-round-btn {
    background: #4ade80;
    color: white;
}

.new-round-btn:hover {
    background: #22c55e;
}

.reset-score-btn {
    background: #fed7d7;
    color: #c53030;
}

.reset-score-btn:hover {
    background: #feb2b2;
}

.reset-bonus-btn {
    background: #bfdbfe;
    color: #1e40af;
}

.reset-bonus-btn:hover {
    background: #93c5fd;
}

/* Massenimport-Styling */
.mass-import-status {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    padding: 10px;
    border-radius: 6px;
    font-weight: 500;
}

.mass-import-status.active {
    background: #dcfce7;
    color: #166534;
}

.mass-import-status.inactive {
    background: #f3f4f6;
    color: #6b7280;
}

.mass-import-team-info {
    font-size: 0.9rem;
}

.mass-import-team-info.active {
    color: #059669;
    font-weight: 600;
}

.mass-import-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
}

.mass-import-actions button {
    padding: 10px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.3s;
}

.enable-mass-import-btn {
    background: #10b981;
    color: white;
}

.enable-mass-import-btn:hover:not(:disabled) {
    background: #059669;
}

.enable-mass-import-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

.disable-mass-import-btn {
    background: #ef4444;
    color: white;
}

.disable-mass-import-btn:hover:not(:disabled) {
    background: #dc2626;
}

.disable-mass-import-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

.mass-import-actions select {
    padding: 10px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.mass-import-actions select:focus {
    outline: none;
    border-color: #667eea;
}

.mass-import-actions select:disabled {
    background: #f3f4f6;
    color: #9ca3af;
    cursor: not-allowed;
}

.mass-import-info {
    padding: 10px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 6px;
    font-size: 0.9rem;
    color: #1e40af;
}

.scoreboard {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.round-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: #f7fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.timer {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    color: #4a5568;
}

.scoreboard-content {
    min-height: 300px;
}

.no-teams {
    text-align: center;
    color: #718096;
    padding: 40px;
}

.team-score {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    margin-bottom: 10px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    transition: transform 0.2s;
}

.team-score:hover {
    transform: translateX(5px);
}

.team-score .team-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

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

.team-score .team-number {
    font-size: 0.9rem;
    color: #718096;
}

.team-score .score {
    font-size: 1.5rem;
    font-weight: bold;
    color: #667eea;
}

.serial-control {
    grid-column: 1 / -1;
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.connection-panel {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: #f7fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.connection-panel button {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.3s;
}

.connect-btn {
    background: #10b981;
    color: white;
}

.connect-btn:hover {
    background: #059669;
}

.disconnect-btn {
    background: #ef4444;
    color: white;
}

.disconnect-btn:hover {
    background: #dc2626;
}

.port-info {
    display: flex;
    gap: 20px;
    color: #718096;
}

.device-control, .log-panel {
    margin-bottom: 20px;
}

.device-control h3, .log-panel h3 {
    color: #4a5568;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.display-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}

.display-controls label {
    font-weight: 500;
    color: #4a5568;
}

.display-controls input {
    width: 100px;
    padding: 8px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    text-align: center;
}

.display-controls button {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.3s;
}

.show-display-btn {
    background: #667eea;
    color: white;
}

.show-display-btn:hover {
    background: #5a67d8;
}

.hide-display-btn {
    background: #6b7280;
    color: white;
}

.hide-display-btn:hover {
    background: #4b5563;
}

.log-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.log-controls button {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.3s;
}

.clear-log-btn {
    background: #ef4444;
    color: white;
}

.clear-log-btn:hover {
    background: #dc2626;
}

.log-status {
    color: #718096;
    font-size: 0.9rem;
}

.serial-log {
    height: 200px;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 10px;
    background: #1a202c;
    color: #e2e8f0;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

.log-entry {
    margin-bottom: 5px;
    padding: 2px 5px;
    border-radius: 3px;
}

.log-entry.incoming {
    color: #4ade80;
}

.log-entry.outgoing {
    color: #60a5fa;
}

.log-entry.error {
    color: #f87171;
}

.log-entry.info {
    color: #fbbf24;
}

.timestamp {
    color: #9ca3af;
    margin-right: 10px;
}

.unassigned-cards {
    grid-column: 1 / -1;
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.unassigned-cards h2 {
    margin-bottom: 20px;
}

.no-cards {
    text-align: center;
    color: #718096;
    padding: 20px;
}

.unassigned-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    margin-bottom: 10px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.card-info {
    flex: 1;
    display: flex;
    gap: 20px;
    align-items: center;
}

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

.scan-count, .first-seen {
    font-size: 0.9rem;
    color: #718096;
}

.card-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.card-actions select {
    padding: 8px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.9rem;
    min-width: 150px;
}

.card-actions button {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.3s;
}

.assign-card-btn {
    background: #10b981;
    color: white;
}

.assign-card-btn:hover {
    background: #059669;
}

/* Modal-Styling */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 10px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-content h3 {
    color: #4a5568;
    margin-bottom: 20px;
    font-size: 1.3rem;
}

.card-list {
    margin-bottom: 20px;
}

.card-list label {
    display: block;
    margin-bottom: 10px;
    font-weight: 500;
    color: #4a5568;
}

.remove-card-item {
    display: flex;
    align-items: center;
    padding: 12px;
    margin-bottom: 8px;
    background: #f8fafc;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    transition: background 0.2s;
}

.remove-card-item:hover {
    background: #e2e8f0;
}

.remove-card-item.selected {
    background: #dbeafe;
    border-color: #3b82f6;
}

.remove-card-item input[type="radio"] {
    margin-right: 10px;
}

.remove-card-item label {
    margin: 0;
    cursor: pointer;
    flex: 1;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.modal-actions button {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.3s;
}

.cancel-remove-btn {
    background: #6b7280;
    color: white;
}

.cancel-remove-btn:hover {
    background: #4b5563;
}

.confirm-remove-btn {
    background: #ef4444;
    color: white;
}

.confirm-remove-btn:hover {
    background: #dc2626;
}

footer {
    text-align: center;
    color: #718096;
    padding: 20px;
    border-top: 1px solid #e2e8f0;
}

/* Responsive Design */
@media (max-width: 768px) {
    main {
        grid-template-columns: 1fr;
    }

    .container {
        padding: 10px;
    }

    header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    .port-info {
        flex-direction: column;
        gap: 5px;
    }

    .card-info {
        flex-direction: column;
        gap: 5px;
        align-items: flex-start;
    }

    .card-actions {
        flex-direction: column;
        gap: 5px;
        width: 100%;
    }

    .card-actions select {
        width: 100%;
    }
}
/* Modus-Auswahl-Styling */
.mode-selector {
    display: flex;
    background: #f8f9fa;
    border-radius: 25px;
    padding: 4px;
    border: 2px solid #e2e8f0;
    margin-bottom: 20px;
}

.mode-option {
    padding: 10px 20px;
    border: none;
    background: transparent;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    color: #4a5568;
}

.mode-option.active {
    background: #667eea;
    color: white;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.mode-option:hover:not(.active) {
    background: #e2e8f0;
    color: #4a5568;
}

/* Modus-Beschreibungen */
.mode-description {
    background: #f8f9fa;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    display: none;
}

.mode-description.active {
    display: block;
}

.mode-description h3 {
    margin-top: 0;
    color: #4a5568;
    margin-bottom: 10px;
}

.mode-description ul {
    margin: 0;
    padding-left: 20px;
}

.mode-description li {
    margin-bottom: 5px;
    color: #718096;
}

/* Fortschritts-Modus-Anzeige */
.progress-mode {
    background: #e0f2fe;
    border: 2px solid #0ea5e9;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    display: none;
}

.progress-mode.active {
    display: block;
}

.progress-mode h3 {
    color: #0369a1;
    margin-bottom: 10px;
}

.progress-mode ul {
    margin: 0;
    padding-left: 20px;
    margin-bottom: 15px;
}

.progress-mode li {
    margin-bottom: 5px;
    color: #0f172a;
}

.progress-display {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 10px;
}

.progress-bar {
    flex: 1;
    height: 20px;
    background: #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #0ea5e9, #0284c7);
    border-radius: 10px;
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.progress-text {
    min-width: 80px;
    text-align: center;
    font-weight: bold;
    color: #0369a1;
}

/* Bonus-Modus-Anzeige */
.bonus-mode {
    background: #fef3c7;
    border: 2px solid #f59e0b;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    display: none;
}

.bonus-mode.active {
    display: block;
}

.bonus-mode h3 {
    color: #92400e;
    margin-bottom: 10px;
}

.bonus-mode ul {
    margin: 0;
    padding-left: 20px;
}

.bonus-mode li {
    margin-bottom: 5px;
    color: #78350f;
}

/* Runden-Info erweitern */
.round-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    padding: 15px;
    background: #f7fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    flex-wrap: wrap;
    gap: 10px;
}

.round-info span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.round-info .mode-indicator {
    background: #667eea;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 500;
}

.round-info .mode-indicator.progress {
    background: #0ea5e9;
}

/* Team-Info erweitern */
.team-score .team-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.team-score .team-rank {
    font-size: 0.9rem;
    color: #718096;
    font-weight: 500;
}

.team-score .team-difference {
    font-size: 0.9rem;
    color: #10b981;
    font-weight: 500;
}

.team-score .team-difference.negative {
    color: #ef4444;
}
