/**
 * Darts Training Hub - DartSim (501 Simulation) Styles
 * ====================================================
 */

/* Wrapper Layout */
.wrapper {
    display: grid;
    grid-template-columns: 380px 1fr 380px;
    gap: 20px;
    margin-bottom: 30px;
}

@media (max-width: 1400px) {
    .wrapper {
        grid-template-columns: 380px 1fr;
    }
    .player2-panel {
        display: none;
    }
}

@media (max-width: 992px) {
    .wrapper {
        grid-template-columns: 1fr;
    }
}

/* Panels */
.leftpanel, 
.user-panel,
.player2-panel {
    background: white;
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.boardpanel {
    background: white;
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    display: flex;
    flex-direction: column;
}

/* Player Header */
.player-header {
    background: linear-gradient(135deg, var(--accent-color), #2980b9);
    color: white;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    text-align: center;
}

.player-header h4 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: bold;
}

/* Score Display - DartSim specific override */
.dartsim .score-display,
.dart-input-section .score-display {
    background: linear-gradient(135deg, var(--secondary-color), #c0392b);
    color: white;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.dartsim .score-display h3,
.dart-input-section .score-display h3 {
    font-size: 3rem;
    font-weight: bold;
    margin: 5px 0;
}

.dartsim .score-display small,
.dart-input-section .score-display small {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Board Controls */
.board-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.board-controls form {
    flex: 1;
}

.board-container {
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
    padding: 10px;
}

.board-container img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Stats Box */
.stats-box {
    font-size: 12px;
    margin-bottom: 15px;
    background: var(--gray-light);
    padding: 12px;
    border-radius: 6px;
    border-left: 4px solid var(--accent-color);
}

.stats-box div {
    margin-bottom: 6px;
    color: #555;
}

.stats-box strong {
    color: var(--primary-color);
}

/* Turn List */
.turn-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 500px;
    overflow-y: auto;
    padding-right: 5px;
}

.turn-list::-webkit-scrollbar {
    width: 8px;
}

.turn-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.turn-list::-webkit-scrollbar-thumb {
    background: var(--accent-color);
    border-radius: 10px;
}

/* Turn Card */
.turn-card {
    background: white;
    border: 1px solid #e0e0e0;
    padding: 10px;
    border-radius: 6px;
    transition: all var(--transition-normal);
}

.turn-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transform: translateX(5px);
}

.turn-card.border-danger {
    border-color: var(--secondary-color);
}

.turn-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.turn-header .start {
    font-weight: 600;
    color: var(--primary-color);
}

.turn-score {
    background: var(--secondary-color);
    color: white;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: bold;
    min-width: 45px;
    text-align: center;
}

/* Dart Fields in Turn Card */
.dart-fields {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.dart-field {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-align: center;
    padding: 8px 4px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
}

.dart-field.empty {
    background: #e0e0e0;
    color: #999;
}

.dart-field small {
    display: block;
    font-size: 0.7rem;
    opacity: 0.8;
    margin-top: 3px;
}

/* Strength Selector */
.strength-selector {
    background: var(--gray-light);
    padding: 15px;
    border-radius: 8px;
    margin-top: 15px;
}

.strength-label {
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 10px;
    display: block;
}

.strength-buttons {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.strength-btn {
    flex: 0 0 calc(20% - 5px);
    min-width: 38px;
    padding: 8px 0;
    border: 2px solid #ddd;
    background: white;
    color: #555;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.strength-btn:hover {
    transform: scale(1.05);
}

.strength-btn.active {
    background: var(--secondary-color);
    border-color: var(--secondary-color);
    color: white;
}

/* Strength Slider */
.strength-slider-wrapper {
    margin-top: 10px;
}

.strength-slider-wrapper input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
}

.strength-slider-wrapper input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--secondary-color);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

/* Game Action Buttons */
.btn-game-action {
    padding: 12px 24px;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    transition: all var(--transition-normal);
}

.btn-next {
    background: var(--accent-color);
    color: white;
}

.btn-next:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.btn-reset {
    background: var(--secondary-color);
    color: white;
}

.btn-reset:hover {
    background: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

/* Dart Input Section */
.dart-input-section {
    background: white;
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--box-shadow);
}

.dart-input-panel {
    display: flex;
    gap: 20px;
    align-items: stretch;
}

@media (max-width: 992px) {
    .dart-input-panel {
        flex-direction: column;
    }
}

.dart-controls-wrapper {
    flex: 1;
}

/* Dart Number Grid */
.dart-number-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 12px;
}

@media (max-width: 768px) {
    .dart-number-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Dart Button Group - DartSim specific */
.dart-input-section .dart-btn-group {
    display: flex;
    flex-direction: column;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid #dee2e6;
}

.dart-input-section .dart-btn-group button {
    background: white;
    padding: 4px 2px;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-weight: 600;
    color: #495057;
    border: none;
    border-bottom: 1px solid #dee2e6;
    font-size: 0.5rem;
    line-height: 0.8;
}

.dart-input-section .dart-btn-group button:last-child {
    border-bottom: none;
}

.dart-input-section .dart-btn-group button:hover:not(:disabled) {
    background: #e9ecef;
    color: #212529;
}

.dart-input-section .dart-btn-group button:active {
    background: #dee2e6;
    transform: scale(0.98);
}

.dart-input-section .dart-btn-group button.active {
    background: #0d6efd;
    color: white;
}

.dart-input-section .dart-btn-group .btn-double {
    background: #fdeaea;
    color: var(--secondary-color);
    font-size: 0.7rem;
    padding: 3px 2px;
}

.dart-input-section .dart-btn-group .btn-triple {
    background: #e8f5e9;
    color: var(--success-color);
    font-size: 0.7rem;
    padding: 3px 2px;
}

.dart-input-section .dart-btn-group .btn-number {
    font-size: 0.75rem;
    font-weight: bold;
    padding: 3px 2px;
}

.dart-input-section .dart-btn-group button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    background: #f8f9fa;
}

/* Dart Action Buttons */
.dart-action-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 15px;
    flex-wrap: wrap;
}

.dart-action-buttons .dart-summary {
    background: white;
    border: 2px solid var(--accent-color);
    border-radius: 8px;
    padding: 10px 20px;
    text-align: center;
    min-width: 100px;
}

.dart-action-buttons .dart-summary .total {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--accent-color);
    line-height: 1;
}

.dart-action-buttons .dart-summary .darts {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.dart-action-buttons .btn-undo,
.dart-action-buttons .btn-reset-darts {
    padding: 10px 15px;
}

.dart-action-buttons .btn-submit {
    margin-left: auto;
    padding: 12px 24px;
}

/* Score Display in Input Panel */
.dart-input-panel > .score-display {
    min-width: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0;
}

/* KI Loading Overlay */
.auto-ki-loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(44, 62, 80, 0.95);
    color: white;
    padding: 40px 60px;
    border-radius: 15px;
    font-size: 1.5rem;
    font-weight: bold;
    z-index: 9999;
    display: none;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

.auto-ki-loading.active {
    display: block;
    animation: fadeIn 0.3s ease-in;
}

.auto-ki-loading i {
    font-size: 3rem;
    margin-bottom: 15px;
    display: block;
    animation: kiPulse 1.5s infinite;
}

@keyframes kiPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.05); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Winner Modal/Banner */
.winner-banner {
    background: linear-gradient(135deg, var(--success-color), #1abc9c);
    color: white;
    padding: 30px;
    border-radius: var(--border-radius);
    text-align: center;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(39, 174, 96, 0.3);
}

.winner-banner h2 {
    font-size: 2rem;
    margin-bottom: 10px;
}

.winner-banner.lost {
    background: linear-gradient(135deg, var(--secondary-color), #c0392b);
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3);
}

/* Checkout Helper */
.checkout-helper {
    background: linear-gradient(135deg, var(--warning-color), #e67e22);
    color: white;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    text-align: center;
}

.checkout-helper h5 {
    margin: 0 0 5px 0;
    font-size: 0.9rem;
    opacity: 0.9;
}

.checkout-helper .checkout-path {
    font-size: 1.3rem;
    font-weight: bold;
}