/* ====================================================================
   overlay.css — capa HTML por encima del canvas original del juego
   - Botones flotantes de icono (jugadores, historial, verificar)
   - Modales para las funcionalidades agregadas
   - Ticket térmico 80mm para impresión
   ==================================================================== */

/* === FLOATING ACTION BUTTONS (FABs) === */
.gh-fab-container {
    position: fixed;
    top: 16px;
    left: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 9000;
    pointer-events: none;
}

.gh-fab {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2c3e50, #1a2530);
    border: 2px solid #f4c542;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #f4c542;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    pointer-events: auto;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

.gh-fab:hover {
    transform: scale(1.08);
    background: linear-gradient(135deg, #34495e, #243240);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.gh-fab:active {
    transform: scale(0.96);
}

.gh-fab svg {
    width: 28px;
    height: 28px;
    fill: currentColor;
    pointer-events: none;
}

.gh-fab-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    background: #e74c3c;
    color: #fff;
    font-size: 11px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    border: 2px solid #1a2530;
}

.gh-fab-tooltip {
    position: absolute;
    left: 70px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 13px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;
}

.gh-fab:hover .gh-fab-tooltip {
    opacity: 1;
}

/* === MODAL FRAMEWORK === */
.gh-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: ghFadeIn 0.2s ease;
}

.gh-modal-backdrop.gh-open {
    display: flex;
}

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

.gh-modal {
    background: linear-gradient(180deg, #2c3e50 0%, #1f2d3a 100%);
    border: 2px solid #f4c542;
    border-radius: 12px;
    max-width: 980px;
    width: 100%;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    color: #f5f5f5;
    font-family: Arial, sans-serif;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    animation: ghSlideUp 0.25s ease;
}

@keyframes ghSlideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.gh-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 22px;
    border-bottom: 1px solid rgba(244, 197, 66, 0.3);
    flex-shrink: 0;
}

.gh-modal-title {
    font-size: 20px;
    font-weight: bold;
    color: #f4c542;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.gh-modal-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.15s;
}

.gh-modal-close:hover {
    background: rgba(231, 76, 60, 0.8);
}

.gh-modal-body {
    padding: 20px 22px;
    overflow-y: auto;
    flex: 1;
}

.gh-modal-footer {
    padding: 14px 22px;
    border-top: 1px solid rgba(244, 197, 66, 0.3);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-shrink: 0;
}

/* === BUTTONS === */
.gh-btn {
    background: #f4c542;
    color: #1a2530;
    border: none;
    padding: 10px 18px;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    font-size: 14px;
    transition: filter 0.15s, transform 0.1s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.gh-btn:hover:not(:disabled) {
    filter: brightness(1.1);
}

.gh-btn:active:not(:disabled) {
    transform: translateY(1px);
}

.gh-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.gh-btn-secondary {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.gh-btn-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.25);
}

.gh-btn-danger {
    background: #e74c3c;
    color: #fff;
}

.gh-btn-success {
    background: #27ae60;
    color: #fff;
}

.gh-btn-icon {
    padding: 8px;
    width: 36px;
    height: 36px;
    justify-content: center;
}

.gh-btn-icon svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* === PLAYERS MODAL === */
.gh-players-toolbar {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.gh-input {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(244, 197, 66, 0.4);
    color: #fff;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
}

.gh-input:focus {
    outline: 2px solid #f4c542;
    border-color: #f4c542;
}

.gh-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.gh-player-card {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(244, 197, 66, 0.25);
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.gh-player-name {
    font-size: 16px;
    font-weight: bold;
    color: #f4c542;
    flex: 1;
    min-width: 120px;
}

.gh-player-total {
    font-size: 14px;
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    padding: 4px 10px;
    border-radius: 4px;
}

.gh-player-status {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: bold;
}

.gh-player-status.pending {
    background: rgba(243, 156, 18, 0.25);
    color: #f39c12;
    border: 1px solid #f39c12;
}

.gh-player-status.no-bets {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.5);
}

.gh-player-actions {
    display: flex;
    gap: 6px;
}

.gh-summary-bar {
    background: rgba(244, 197, 66, 0.12);
    border: 1px solid rgba(244, 197, 66, 0.3);
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
}

.gh-summary-bar .total {
    color: #f4c542;
    font-size: 18px;
}

/* === BETS SUB-MODAL === */
.gh-bet-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 16px;
}

.gh-bet-table th, .gh-bet-table td {
    padding: 8px 6px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 13px;
}

.gh-bet-table th {
    background: rgba(244, 197, 66, 0.15);
    color: #f4c542;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
}

.gh-bet-table td.dog-name {
    text-align: left;
    font-weight: bold;
    color: #fff;
    text-transform: capitalize;
}

.gh-bet-table .odd {
    color: rgba(255, 255, 255, 0.6);
    font-size: 11px;
    display: block;
}

.gh-bet-input {
    width: 70px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 5px 6px;
    border-radius: 4px;
    text-align: center;
    font-size: 13px;
}

.gh-bet-input:focus {
    outline: none;
    border-color: #f4c542;
}

.gh-bet-input:not([value="0"]):not([value=""]) {
    background: rgba(244, 197, 66, 0.15);
    border-color: #f4c542;
}

.gh-section-title {
    color: #f4c542;
    font-size: 15px;
    font-weight: bold;
    margin: 14px 0 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.gh-forecast-grid {
    display: grid;
    grid-template-columns: 80px repeat(6, 1fr);
    gap: 4px;
    background: rgba(0, 0, 0, 0.2);
    padding: 8px;
    border-radius: 6px;
}

.gh-forecast-cell {
    background: rgba(255, 255, 255, 0.05);
    padding: 4px;
    text-align: center;
    font-size: 11px;
    border-radius: 3px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 50px;
}

.gh-forecast-cell.header {
    background: rgba(244, 197, 66, 0.15);
    color: #f4c542;
    font-weight: bold;
}

.gh-forecast-cell.diagonal {
    background: rgba(0, 0, 0, 0.4);
}

.gh-forecast-cell input {
    width: 100%;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 2px;
    border-radius: 3px;
    text-align: center;
    font-size: 11px;
}

.gh-forecast-cell .odd-label {
    color: rgba(255, 255, 255, 0.5);
    font-size: 9px;
    margin-bottom: 2px;
}

/* === HISTORY MODAL === */
.gh-history-filters {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
    flex-wrap: wrap;
    align-items: center;
}

.gh-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.gh-stat-card {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(244, 197, 66, 0.2);
    padding: 10px 12px;
    border-radius: 6px;
    text-align: center;
}

.gh-stat-card .label {
    color: rgba(255, 255, 255, 0.6);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.gh-stat-card .value {
    color: #f4c542;
    font-size: 20px;
    font-weight: bold;
    margin-top: 4px;
}

.gh-stat-card .value.positive { color: #27ae60; }
.gh-stat-card .value.negative { color: #e74c3c; }

.gh-history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.gh-history-table th {
    background: rgba(244, 197, 66, 0.15);
    color: #f4c542;
    padding: 8px 6px;
    text-align: left;
    position: sticky;
    top: 0;
    text-transform: uppercase;
    font-size: 11px;
}

.gh-history-table td {
    padding: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.gh-history-table tr:hover {
    background: rgba(244, 197, 66, 0.05);
}

.gh-history-table .ticket-id-cell {
    font-family: 'Courier New', monospace;
    color: #f4c542;
    font-weight: bold;
}

.gh-status-badge {
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: bold;
    text-transform: uppercase;
}

.gh-status-badge.won { background: rgba(39, 174, 96, 0.25); color: #2ecc71; border: 1px solid #27ae60; }
.gh-status-badge.lost { background: rgba(231, 76, 60, 0.25); color: #e74c3c; border: 1px solid #c0392b; }
.gh-status-badge.pending { background: rgba(243, 156, 18, 0.25); color: #f39c12; border: 1px solid #f39c12; }
.gh-status-badge.scanned { background: rgba(52, 152, 219, 0.25); color: #3498db; border: 1px solid #2980b9; margin-left: 4px; }

.gh-table-actions {
    display: flex;
    gap: 4px;
}

/* === VERIFY MODAL === */
.gh-verify-input-row {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.gh-verify-input-row .gh-input {
    flex: 1;
    font-family: 'Courier New', monospace;
    font-size: 16px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.gh-verify-result {
    padding: 14px 16px;
    border-radius: 8px;
    margin-top: 10px;
    font-size: 14px;
}

.gh-verify-result.success {
    background: rgba(39, 174, 96, 0.2);
    border: 1px solid #27ae60;
    color: #2ecc71;
}

.gh-verify-result.warning {
    background: rgba(243, 156, 18, 0.2);
    border: 1px solid #f39c12;
    color: #f39c12;
}

.gh-verify-result.error {
    background: rgba(231, 76, 60, 0.2);
    border: 1px solid #e74c3c;
    color: #e74c3c;
}

.gh-verify-result h4 {
    margin: 0 0 8px;
    font-size: 16px;
}

/* === THERMAL TICKET (80mm) === */
.gh-ticket {
    width: 302px; /* 80mm @ 96dpi */
    background: #fff;
    color: #000;
    padding: 12px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.4;
    margin: 0 auto;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

.gh-ticket-header {
    text-align: center;
    border-bottom: 2px dashed #000;
    padding-bottom: 8px;
    margin-bottom: 10px;
}

.gh-ticket-header h2 {
    font-size: 16px;
    margin: 0 0 4px;
    font-weight: bold;
}

.gh-ticket-header .subtitle {
    font-size: 10px;
}

.gh-ticket-section {
    margin-bottom: 8px;
}

.gh-ticket-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2px;
}

.gh-ticket-row strong { font-weight: bold; }

.gh-ticket-bets {
    border-top: 1px dashed #000;
    border-bottom: 1px dashed #000;
    padding: 6px 0;
    margin: 8px 0;
}

.gh-ticket-bet-line {
    font-size: 11px;
    display: flex;
    justify-content: space-between;
    margin-bottom: 2px;
}

.gh-ticket-status-box {
    border: 2px solid #000;
    padding: 8px;
    text-align: center;
    margin: 8px 0;
    font-weight: bold;
}

.gh-ticket-status-box.pending { background: #fff8e1; }
.gh-ticket-status-box.won { background: #c8e6c9; }
.gh-ticket-status-box.lost { background: #ffcdd2; }

.gh-ticket-id {
    font-size: 14px;
    letter-spacing: 1px;
    text-align: center;
    font-weight: bold;
    padding: 4px 0;
}

.gh-ticket-verifier {
    text-align: center;
    font-size: 16px;
    font-weight: bold;
    letter-spacing: 2px;
    padding: 6px 0;
    margin: 6px 0;
    border: 1px solid #000;
}

.gh-ticket-qr {
    display: flex;
    justify-content: center;
    margin: 8px 0;
}

.gh-ticket-qr svg {
    width: 120px;
    height: 120px;
}

.gh-ticket-footer {
    text-align: center;
    font-size: 9px;
    border-top: 1px dashed #000;
    padding-top: 6px;
    margin-top: 8px;
}

.gh-ticket-scanned-stamp {
    border: 2px solid #c00;
    color: #c00;
    text-align: center;
    padding: 6px;
    font-weight: bold;
    transform: rotate(-3deg);
    margin: 8px 0;
    font-size: 11px;
    background: rgba(255, 200, 200, 0.3);
}

/* === PRINT === */
@media print {
    body > *:not(.gh-print-target) {
        display: none !important;
    }
    .gh-print-target {
        display: block !important;
        position: static !important;
    }
    .gh-print-target * {
        visibility: visible;
    }
    .gh-ticket {
        box-shadow: none;
        margin: 0;
    }
    @page {
        size: 80mm auto;
        margin: 0;
    }
}

/* === EMPTY STATE === */
.gh-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: rgba(255, 255, 255, 0.5);
    font-style: italic;
}

.gh-bet-table .trap-row {
    background: rgba(231, 76, 60, 0.05);
}
.gh-bet-table .trap-row td.dog-name {
    color: #f39c12;
}

/* === QR CAMERA SCANNER === */
.gh-qr-scanner {
    position: relative;
    width: 100%;
    max-width: 480px;
    margin: 14px auto;
    background: #000;
    border: 2px solid #f4c542;
    border-radius: 10px;
    overflow: hidden;
    aspect-ratio: 4/3;
}

.gh-qr-scanner video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.gh-qr-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    /* Cuadro central de escaneo */
}

.gh-qr-overlay::before {
    content: '';
    position: absolute;
    top: 15%;
    left: 15%;
    right: 15%;
    bottom: 15%;
    border: 2px dashed rgba(244, 197, 66, 0.6);
    border-radius: 8px;
}

.gh-qr-corner {
    position: absolute;
    width: 28px;
    height: 28px;
    border-color: #f4c542;
    border-style: solid;
    border-width: 0;
}

.gh-qr-corner.tl { top: 14%; left: 14%; border-top-width: 4px; border-left-width: 4px; border-top-left-radius: 8px; }
.gh-qr-corner.tr { top: 14%; right: 14%; border-top-width: 4px; border-right-width: 4px; border-top-right-radius: 8px; }
.gh-qr-corner.bl { bottom: 14%; left: 14%; border-bottom-width: 4px; border-left-width: 4px; border-bottom-left-radius: 8px; }
.gh-qr-corner.br { bottom: 14%; right: 14%; border-bottom-width: 4px; border-right-width: 4px; border-bottom-right-radius: 8px; }

.gh-qr-status {
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 13px;
    white-space: nowrap;
    max-width: 90%;
    text-overflow: ellipsis;
    overflow: hidden;
}

.gh-qr-status.success {
    background: rgba(39, 174, 96, 0.9);
    color: #fff;
}

.gh-qr-status.error {
    background: rgba(231, 76, 60, 0.9);
    color: #fff;
    white-space: normal;
    text-align: center;
}

.gh-qr-controls {
    position: absolute;
    bottom: 10px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 10px;
    z-index: 2;
}

/* === MOBILE === */
@media (max-width: 600px) {
    .gh-fab {
        width: 48px;
        height: 48px;
    }
    .gh-fab svg {
        width: 22px;
        height: 22px;
    }
    .gh-modal-body { padding: 14px; }
    .gh-modal-header { padding: 12px 16px; }
    .gh-forecast-grid {
        grid-template-columns: 60px repeat(6, 1fr);
        font-size: 10px;
    }
    .gh-bet-table th, .gh-bet-table td {
        padding: 6px 3px;
        font-size: 11px;
    }
    .gh-history-table {
        font-size: 11px;
    }
}
