/* Custom styles for Archery Scores app */

.score-cell {
    padding: 5px;
}

.shots {
    font-size: 0.9em;
    color: #666;
}

.end-total {
    font-size: 1.1em;
    margin-top: 2px;
}

.qr-code {
    max-width: 80px;
    height: auto;
}

/* Scoreboard table styling */
.scoreboard-table {
    table-layout: auto;
    width: 100%;
}

/* Let columns size naturally without fixed widths */

.archer-name {
    font-size: 1.1em; /* Match the end-total font size */
}

/* End cells will size naturally */

/* Responsive adjustments for smaller screens */
@media (max-width: 992px) {
    .scoreboard-table {
        font-size: 0.9em;
    }
}

.x-cell {
    color: #000 !important; /* Black text color */
}

.total-cell {
    font-weight: bold;
    font-size: 1.1em; /* Match the archer-name font size */
}

.total-cell h5 {
    font-weight: bold;
    font-size: 1.1em; /* Match the archer-name font size */
}

/* Mobile-friendly adjustments */
@media (max-width: 768px) {
    .table-responsive {
        font-size: 0.8em;
    }
    
    .qr-code {
        max-width: 60px;
    }
    
    .score-cell {
        padding: 2px;
    }
    
    .scoreboard-table .rank-col {
        width: 40px;
    }
    
    .scoreboard-table .archer-col {
        width: 120px;
    }
    
    .scoreboard-table .end-col {
        width: 60px;
    }
    
    .scoreboard-table .x-col {
        width: 40px;
    }
    
    .scoreboard-table .total-col {
        width: 60px;
    }
    
    .archer-name {
        font-size: 1.2em; /* Slightly smaller increase on mobile */
    }
    
    .end-cell {
        width: 60px;
        min-width: 60px;
    }
}

/* Score entry form styling */
.shot-input {
    font-size: 1.2em;
    text-align: center;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 1.2em;
}

/* Admin panel styling */
.list-group-item {
    border: 1px solid #dee2e6;
    margin-bottom: 2px;
}

.list-group-item-success {
    background-color: #d1e7dd;
    border-color: #badbcc;
}

/* Navbar brand emoji */
.navbar-brand {
    font-size: 1.5em;
}

/* Scoreboard enhancements */
.table th {
    vertical-align: middle;
    text-align: center;
}

.table td {
    vertical-align: middle;
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* QR Codes in corners */
.qr-codes-container {
    position: relative;
    pointer-events: none; /* Allow clicks to pass through */
}

.qr-codes-container > div {
    pointer-events: auto; /* Re-enable clicks on the actual elements */
}

.qr-code-corner {
    position: fixed;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid #dee2e6;
    border-radius: 8px;
    padding: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(5px);
    text-align: center;
}

.qr-code-corner img {
    max-width: 201px;  /* 50% bigger than 134px */
    height: auto;
    display: block;
    margin: 0 auto;
}

.qr-code-corner a {
    text-decoration: none;
    color: inherit;
    display: block;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.qr-code-corner a:hover {
    transform: scale(1.05);
    opacity: 0.9;
    text-decoration: none;
    color: inherit;
}

.qr-code-corner a:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

.qr-top-left {
    top: 20px;
    left: 20px;
}

.qr-top-right {
    top: 20px;
    right: 20px;
}

.qr-bottom-left {
    bottom: 20px;
    left: 20px;
}

.qr-bottom-right {
    bottom: 20px;
    right: 20px;
}

.qr-label {
    font-size: 1.6em;  /* Twice as big as original 0.8em */
    color: #666;
    margin-top: 4px;
    font-weight: 500;
}

/* Mobile responsive adjustments for QR codes */
@media (max-width: 768px) {
    .qr-code-corner {
        padding: 6px;
    }
    
    .qr-code-corner img {
        max-width: 120px;  /* 50% bigger than 80px */
    }
    
    .qr-code-corner a:hover {
        transform: scale(1.03);  /* Smaller hover effect on mobile */
    }
    
    .qr-top-left, .qr-top-right {
        top: 10px;
    }
    
    .qr-bottom-left, .qr-bottom-right {
        bottom: 10px;
    }
    
    .qr-top-left, .qr-bottom-left {
        left: 10px;
    }
    
    .qr-top-right, .qr-bottom-right {
        right: 10px;
    }
    
    .qr-label {
        font-size: 1.4em;  /* Twice as big as original 0.7em */
    }
}

/* =============================================
   MOBILE-FRIENDLY SCOREBOARD
   ============================================= */

/* Hide QR codes and corner logos on mobile */
@media (max-width: 768px) {
    .qr-codes-container {
        display: none !important;
    }
}

/* Mobile title bar - shown only on mobile */
.mobile-scoreboard-nav {
    display: none;
}

@media (max-width: 768px) {
    /* Hide the main site navbar on scoreboard */
    body.scoreboard-page .navbar {
        display: none !important;
    }

    /* Remove container padding so scoreboard goes edge-to-edge */
    body.scoreboard-page .container.mt-4 {
        max-width: 100%;
        padding-left: 0;
        padding-right: 0;
        margin-top: 0 !important;
    }

    .mobile-scoreboard-nav {
        display: flex;
        align-items: center;
        justify-content: space-between;
        background: linear-gradient(135deg, #212529, #343a40);
        color: #fff;
        padding: 10px 14px;
        position: sticky;
        top: 0;
        z-index: 100;
        box-shadow: 0 2px 8px rgba(0,0,0,0.25);
    }

    .mobile-scoreboard-nav .mobile-nav-title {
        font-weight: 700;
        font-size: 1rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        flex: 1;
        min-width: 0;
        margin-right: 8px;
    }

    .mobile-scoreboard-nav .mobile-nav-links {
        display: flex;
        gap: 6px;
        flex-shrink: 0;
    }

    .mobile-scoreboard-nav .mobile-nav-links a {
        color: #fff;
        background: rgba(255,255,255,0.15);
        padding: 6px 12px;
        border-radius: 6px;
        font-size: 0.78rem;
        font-weight: 500;
        text-decoration: none;
        white-space: nowrap;
        transition: background 0.2s;
    }

    .mobile-scoreboard-nav .mobile-nav-links a:hover,
    .mobile-scoreboard-nav .mobile-nav-links a:active {
        background: rgba(255,255,255,0.3);
    }
}

/* Hide columns on mobile that are not essential */
@media (max-width: 768px) {
    .mobile-hide {
        display: none !important;
    }
}

/* Mobile scoreboard table improvements */
@media (max-width: 768px) {
    /* Remove header row above the table on mobile */
    .scoreboard-desktop-header {
        display: none !important;
    }

    /* Push content below sticky mobile nav */
    #scoreboardWrapper {
        padding-top: 6px;
    }

    /* Full-bleed cards with no border radius */
    #scoreboardWrapper .card {
        border-radius: 0;
        border-left: none;
        border-right: none;
        overflow: visible;
        margin-bottom: 0;
    }

    #scoreboardWrapper .card + .card,
    #scoreboardWrapper .card.mb-3 {
        margin-bottom: 0 !important;
        border-top: 2px solid #dee2e6;
    }

    #scoreboardWrapper .card-header {
        padding: 8px 14px;
        border-radius: 0;
    }

    #scoreboardWrapper .card-header h6 {
        font-size: 0.85rem;
    }

    /* Let table-responsive be visible so position:sticky works on thead */
    #scoreboardWrapper .table-responsive {
        overflow: visible;
    }

    /* Table compact styling */
    #scoreboardWrapper .table {
        font-size: 0.9rem;
        margin-bottom: 0;
        table-layout: fixed;
        width: 100%;
    }

    #scoreboardWrapper .table th,
    #scoreboardWrapper .table td {
        padding: 8px 6px;
        vertical-align: middle;
    }

    /* Column widths when only showing: Rank, Archer, X's, Total */
    #scoreboardWrapper .table th.col-rank,
    #scoreboardWrapper .table td.col-rank {
        width: 36px;
        text-align: center;
        white-space: nowrap;
    }

    #scoreboardWrapper .table th.col-archer,
    #scoreboardWrapper .table td.col-archer {
        text-align: left;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        padding-left: 12px;
    }

    #scoreboardWrapper .table th.col-xs,
    #scoreboardWrapper .table td.col-xs {
        width: 36px;
        text-align: center;
        white-space: nowrap;
    }

    #scoreboardWrapper .table th.col-ends,
    #scoreboardWrapper .table td.col-ends {
        width: 50px;
        text-align: center;
        white-space: nowrap;
    }

    #scoreboardWrapper .table th.col-total,
    #scoreboardWrapper .table td.col-total {
        width: 58px;
        text-align: center;
        font-weight: 700;
    }

    /* 3D event mobile columns */
    #scoreboardWrapper .table th.col-targets,
    #scoreboardWrapper .table td.col-targets {
        width: 55px;
        text-align: center;
    }

    /* Larger text for scores */
    #scoreboardWrapper .table td.col-total strong,
    #scoreboardWrapper .table td.col-total {
        font-size: 1rem;
        font-weight: 700;
    }

    /* Make rank badges smaller */
    #scoreboardWrapper .table .badge {
        font-size: 0.75rem;
        padding: 3px 7px;
        min-width: 24px;
    }

    /* Archer name styling */
    #scoreboardWrapper .table td.col-archer {
        font-size: 0.88rem;
    }

    /* Sticky header on mobile */
    #scoreboardWrapper .table thead {
        position: sticky;
        top: 44px; /* below the sticky mobile nav */
        z-index: 10;
    }

    /* Alternating row colors that look good on mobile */
    #scoreboardWrapper .table-striped > tbody > tr:nth-of-type(odd) > td {
        background-color: #f8f9fa;
    }

    /* Idle league overlay - fix insane padding */
    #idleLeagueOverlay .container-fluid {
        padding-left: 10px !important;
        padding-right: 10px !important;
        padding-top: 10px !important;
        padding-bottom: 80px !important;
    }

    #idleLeagueOverlay h2 {
        font-size: 1.1rem;
    }

    #idleLeagueOverlay .d-flex.justify-content-between {
        flex-direction: column;
        gap: 4px;
    }

    #idleLeagueOverlay .table {
        font-size: 0.82rem;
    }

    #idleLeagueOverlay .table th,
    #idleLeagueOverlay .table td {
        padding: 6px 4px;
    }

    /* Hide less important idle league columns on mobile */
    #idleLeagueOverlay .table th:nth-child(3),
    #idleLeagueOverlay .table td:nth-child(3),
    #idleLeagueOverlay .table th:nth-child(4),
    #idleLeagueOverlay .table td:nth-child(4) {
        display: none;
    }

    /* No-data alert edge-to-edge */
    .alert {
        border-radius: 0;
        margin-left: 0;
        margin-right: 0;
    }
}

/* Hide desktop-only elements on mobile, show on desktop */
.desktop-hide {
    display: none;
}

@media (max-width: 768px) {
    .desktop-hide {
        display: table-cell !important;
    }
}

