/* Betting Calculator Styles */

/* Hide number input spinner arrows */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Team visibility is controlled by JavaScript */

/* Firefox */
input[type="number"] {
    -moz-appearance: textfield;
}

.btn-check:checked + .btn-outline-primary {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
    color: white;
}

/* ===== Banner & Header ===== */
.calc-banner {
    background: linear-gradient(135deg, #0c2340 0%, #1a3a5c 50%, #002D62 100%);
    border-radius: 12px 12px 0 0;
    padding: 1rem 1.5rem;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.calc-banner-title {
    color: #fff;
    font-weight: 800;
    font-size: 1.35rem;
    margin-bottom: 0;
}

.calc-sport-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.6rem;
}

.calc-banner-label {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0;
    white-space: nowrap;
}

/* Sport pill toggles inside the banner */
.calc-sport-toggle {
    display: inline-flex;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    padding: 3px;
}

.calc-sport-btn {
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.8);
    padding: 6px 18px;
    border-radius: 18px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.calc-sport-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.calc-sport-btn.active {
    background: #fff;
    color: #0c2340;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

/* ===== Prop Line Input ===== */
.prop-line-prefix {
    background-color: #fff;
    border-right: none;
}

.prop-line-input {
    border-left: none;
    background-color: #f0f8ff;
    font-weight: 500;
}

/* ===== Add-to-Parlay Button ===== */
.btn-add-parlay {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border: none;
    font-weight: 600;
    padding: 12px 32px;
    border-radius: 8px;
    font-size: 16px;
    box-shadow: 0 4px 6px rgba(59, 130, 246, 0.3);
    transition: all 0.3s;
}

.btn-add-parlay:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: white;
    box-shadow: 0 6px 10px rgba(59, 130, 246, 0.4);
    transform: translateY(-1px);
}

/* ===== Results Cards ===== */
.results-card {
    background: white;
    border: none;
    border-radius: 15px;
}

.results-stat-cell {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 1rem 0.5rem;
}

.results-stat-cell h3 {
    color: #000;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.results-stat-cell small {
    color: #4b5563;
    font-size: 0.75rem;
}

.results-divider {
    border-top: 3px solid #9ca3af;
    margin: 2rem 0;
}

/* ===== Parlay Sidebar Header ===== */
.parlay-sidebar-header {
    background: linear-gradient(135deg, #374151 0%, #111827 100%);
}

/* ===== Parlay Overall Summary ===== */
.parlay-summary {
    padding: 16px;
    margin-top: 16px;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: 12px;
    border: 1px solid #cbd5e1;
}

/* ===== Parlay Bet Remove Button ===== */
.parlay-bet-remove {
    background: #fee2e2;
    color: #dc2626;
    border: none;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s;
}

.parlay-bet-remove:hover {
    background: #fecaca;
    color: #dc2626;
}

/* ===== Parlay Results Card ===== */
.parlay-results-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
}

.parlay-results-stat {
    text-align: center;
    padding: 20px;
    background: #f8fafc;
    border-radius: 12px;
    min-height: 180px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Usage display styles */
.usage-display {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Upgrade button enhancement */
.btn-success.fw-bold {
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
    transition: all 0.3s ease;
}

.btn-success.fw-bold:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
}

.btn-check:checked + .btn-outline-success {
    background-color: var(--bs-success);
    border-color: var(--bs-success);
    color: white;
}

.parlay-bet-card {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    background: #f8f9fa;
}

.parlay-bet-card .bet-description {
    font-weight: 500;
    color: #333;
}

.parlay-bet-card .bet-odds {
    color: var(--bs-primary);
    font-weight: 600;
}

.parlay-bet-card .remove-bet {
    color: #dc3545;
    cursor: pointer;
    float: right;
}

.parlay-bet-card .remove-bet:hover {
    color: #a71e2a;
}

.dropdown-menu {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.dropdown-item:hover {
    background-color: var(--bs-primary);
    color: white;
}

#playerName:focus {
    box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.25);
}

/* Login Overlay Styles */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.login-overlay-content {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 100%;
    animation: overlaySlideIn 0.3s ease-out;
}
.login-overlay-header {
    padding: 24px 24px 16px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.login-overlay-header h3 {
    margin: 0;
    color: #1e293b;
    font-size: 1.25rem;
    font-weight: 600;
}
.close-overlay-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #64748b;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: background-color 0.2s;
}
.close-overlay-btn:hover {
    background-color: #f1f5f9;
    color: #334155;
}
.login-overlay-body {
    padding: 16px 24px 24px;
}
.login-overlay-body p {
    color: #64748b;
    line-height: 1.6;
}
@keyframes overlaySlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Spinning loading animation */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.spinner-icon {
    animation: spin 1s linear infinite;
}

/* Loading button styles - Green theme */
.btn-loading {
    position: relative;
    pointer-events: none;
    background: linear-gradient(135deg, #059669 0%, #047857 100%) !important;
    border-color: #059669 !important;
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.4);
    color: white !important;
    overflow: hidden;
}

.btn-loading:hover,
.btn-loading:focus,
.btn-loading:active,
.btn-loading:disabled {
    background: linear-gradient(135deg, #059669 0%, #047857 100%) !important;
    border-color: #059669 !important;
    color: white !important;
}

.btn-loading:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: inherit;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    /* Fix text wrapping issues */
    .text-center h2, .text-center h3 {
        font-size: 1.5rem !important;
        line-height: 1.3;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Prevent number wrapping - make larger */
    .display-4, .display-5, .display-6 {
        white-space: nowrap;
        font-size: 2.5rem !important;
        font-weight: bold !important;
    }

    /* Better mobile labels for result stat cells */
    .results-stat-cell small {
        font-size: 0.7rem !important;
        line-height: 1.1 !important;
        white-space: nowrap !important;
        display: inline-block !important;
    }

    /* Histogram and chart optimizations */
    #chart-container {
        width: 100% !important;
        min-height: 350px !important;
        margin: 2rem 0 1.5rem 0;
    }

    /* Results section mobile optimization - force 3 columns */
    .row .col-4 {
        min-width: 0;
        flex: 1 1 0;
        text-align: center;
        padding: 0.5rem 0.25rem;
        max-width: 33.33%;
    }

    /* Make cards more readable on mobile */
    .card-body {
        padding: 2rem 0.5rem;
    }

    /* Larger text for better readability */
    .alert {
        font-size: 1.1rem;
        line-height: 1.4;
        padding: 1rem;
    }

    /* Compact stat cells on mobile */
    .results-stat-cell {
        padding: 0.75rem 0.25rem !important;
    }

    .results-stat-cell h3 {
        white-space: nowrap !important;
        font-size: 1.4rem !important;
    }

    .results-stat-cell small {
        font-size: 0.65rem !important;
        line-height: 1.2 !important;
        display: block !important;
    }

    /* Container padding adjustments */
    .col-4 .p-2, .col-4 .p-md-3 {
        padding: 0.25rem !important;
    }

    /* Mobile chart optimizations - clean responsive approach */
    .bar-chart-container {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding: 0;
    }

    .bar-chart-container svg,
    .bar-chart-container .chart-inner {
        min-width: 300px;
        width: 100%;
    }

    /* Hide Y-axis label on mobile for cleaner display */
    .bar-chart-container .y-axis-label {
        display: none !important;
    }

    .bar-chart-wrapper {
        margin: 0 !important;
        padding: 0 !important;
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        overflow-x: auto !important;
        position: relative !important;
    }

    .bar-chart-bars {
        height: 350px !important;
        padding-bottom: 20px !important;
        padding-left: 0px !important;
        padding-right: 0px !important;
        width: 100% !important;
        max-width: none !important;
        overflow: visible !important;
        box-sizing: border-box !important;
    }

    .y-axis-label {
        font-size: 12px !important;
        left: -50px !important;
        top: calc(50% - 32px) !important;
        z-index: 10 !important;
        white-space: nowrap !important;
    }

    .y-axis-scale {
        display: none !important;
    }

    .bar-chart-bar {
        min-width: 25px !important;
        max-width: none !important;
        margin: 0 1px !important;
        flex: 1 !important;
    }

    .bar-label {
        font-size: 9px !important;
        bottom: -40px !important;
        font-weight: 500 !important;
        color: #374151 !important;
        text-shadow: 0 1px 2px rgba(255,255,255,0.8) !important;
        transform: translateX(-50%) rotate(-45deg) !important;
        transform-origin: center bottom !important;
        left: 50% !important;
        white-space: nowrap !important;
    }

    /* Value labels on bars - horizontal on mobile */
    .bar-chart-bar > div:last-child {
        font-size: 10px !important;
        font-weight: 600 !important;
        left: 50% !important;
        color: #1f2937 !important;
        text-shadow: 0 2px 4px rgba(255,255,255,1) !important;
        transform: translateX(-50%) !important;
        white-space: nowrap !important;
        z-index: 9999 !important;
        position: absolute !important;
    }

    .bar-chart-container .bar-date-below {
        transform: translateX(-50%) rotate(-45deg) !important;
        transform-origin: center top !important;
    }

    .bar-date-below.rotate-label {
        transform: rotate(-30deg) !important;
        transform-origin: center center !important;
    }

    /* Chart title and subtitle */
    .bar-chart-container h5 {
        font-size: 16px !important;
        font-weight: 600 !important;
    }

    .bar-chart-container small {
        font-size: 12px !important;
    }

    /* Fix title cutoff on mobile */
    .calc-banner .calc-banner-title {
        font-size: 1.5rem !important;
        line-height: 1.2 !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
    }

    .calc-banner {
        padding: 1.5rem 1rem !important;
    }

    .calc-banner .calc-banner-subtitle {
        font-size: 0.9rem !important;
        line-height: 1.3 !important;
    }

    /* Fix disclaimer text wrapping on mobile */
    .text-center small {
        display: block !important;
        font-size: 11px !important;
        line-height: 1.4 !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        white-space: normal !important;
        padding: 0 10px !important;
    }
}

/* Live game pulse animation */
@keyframes pulse {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.05);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Mobile button improvements */
@media (max-width: 576px) {
    .parlay-mobile-btn {
        min-width: 70px !important;
        max-width: 80px !important;
        width: 70px !important;
        padding: 8px 12px !important;
        font-size: 12px !important;
        font-weight: 600 !important;
        border-radius: 8px !important;
        transition: all 0.2s ease !important;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
        white-space: nowrap !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .parlay-mobile-btn:hover {
        transform: translateY(-1px) !important;
        box-shadow: 0 4px 8px rgba(0,0,0,0.15) !important;
    }

    .parlay-mobile-btn:active {
        transform: translateY(0px) !important;
    }

    /* Both buttons white with black text */
    .parlay-mobile-btn.btn-light {
        background: white !important;
        border: 1px solid #dee2e6 !important;
        color: #212529 !important;
    }

    .parlay-mobile-btn.btn-light:hover {
        background: #f8f9fa !important;
        border: 1px solid #adb5bd !important;
        color: #212529 !important;
    }

    .parlay-mobile-btn.btn-light:active {
        background: #e9ecef !important;
        color: #212529 !important;
    }

    /* Make sure icons are properly spaced */
    .parlay-mobile-btn i {
        margin-right: 4px !important;
        font-size: 12px !important;
    }

    /* Mobile optimizations for bet cards */
    .parlay-bet-card {
        padding: 12px !important;
        margin-bottom: 8px !important;
    }

    .parlay-bet-card .card-avatar {
        display: none !important;
    }

    .parlay-bet-card .card-content {
        width: 100% !important;
    }

    /* Mobile parlay summary layout with risk button positioning */
    .parlay-risk-desktop {
        display: none !important;
    }

    .parlay-risk-button {
        display: block !important;
    }

    .parlay-content-wrapper {
        padding-top: 40px !important; /* Make room for the absolute positioned risk button */
    }

    .parlay-content-wrapper > div:first-child {
        padding-right: 0 !important; /* Remove desktop padding on mobile */
    }
}

/* Desktop styles - show desktop risk button, hide mobile one */
@media (min-width: 577px) {
    .parlay-risk-button {
        display: none !important;
    }

    .parlay-risk-desktop {
        display: flex !important;
    }
}

/* Parlay Sidebar Styles */
#parlaySidebar .card {
    border: 2px solid #e9ecef;
    border-radius: 12px;
    overflow: hidden;
}

#parlaySidebar .parlay-empty-state {
    text-align: center;
    padding: 2rem 1rem;
    color: #6c757d;
}

#parlaySidebar .parlay-empty-state i {
    font-size: 2.5rem;
    color: #dee2e6;
    margin-bottom: 0.75rem;
}

/* Sidebar highlight animation when leg is added */
@keyframes sidebarPulse {
    0% { box-shadow: 0 0 0 0 rgba(13, 110, 253, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(13, 110, 253, 0); }
    100% { box-shadow: 0 0 0 0 rgba(13, 110, 253, 0); }
}

#parlaySidebar.highlight {
    animation: sidebarPulse 0.6s ease-out;
}

/* Mobile bottom sheet for parlay */
@media (max-width: 991.98px) {
    #parlaySidebar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 1040;
        background: white;
        border-top: 2px solid #dee2e6;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
        max-height: 60vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        transform: translateY(calc(100% - 56px)); /* show only summary bar */
        transition: transform 0.3s ease;
        padding: 0;
        border-radius: 16px 16px 0 0;
    }
    #parlaySidebar.expanded {
        transform: translateY(0);
    }

    #parlaySidebar .sticky-top {
        position: static !important;
    }

    #parlaySidebar .card {
        border: none;
        border-radius: 0;
    }

    /* Summary bar (always visible at bottom) */
    .parlay-sheet-handle {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 14px 16px;
        cursor: pointer;
        background: linear-gradient(135deg, #374151 0%, #111827 100%);
        color: white;
        user-select: none;
    }

    .parlay-sheet-handle .handle-bar {
        width: 36px;
        height: 4px;
        background: rgba(255,255,255,0.4);
        border-radius: 2px;
        margin: 0 auto 8px;
    }

    /* Add bottom padding so content and footer aren't hidden behind the bottom sheet */
    #calculatorMain {
        padding-bottom: 70px;
    }

    body {
        padding-bottom: 65px !important;
    }
}

/* Desktop: hide the sheet handle, show sidebar normally */
@media (min-width: 992px) {
    .parlay-sheet-handle {
        display: none;
    }
}
