/* ═══════════════════════════════════════
   Купон ставок — mobile first, BK-style
   ═══════════════════════════════════════ */

/* —— Floating toggle —— */
.betslip-toggle {
    position: fixed;
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
    right: 14px;
    z-index: 900;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 11px 16px 11px 13px;
    background: linear-gradient(135deg, var(--accent, #e63946) 0%, #c1121f 100%);
    color: #fff;
    border: none;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.88rem;
    cursor: pointer;
    box-shadow: 0 4px 24px var(--accent-glow, rgba(230, 57, 70, 0.45));
    transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
}

.betslip-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px var(--accent-glow, rgba(230, 57, 70, 0.55));
}

.betslip-toggle--has-items {
    padding-right: 12px;
}

.betslip-toggle--pulse {
    animation: betslipPulse 0.45s ease;
}

@keyframes betslipPulse {
    0%, 100% { transform: scale(1); }
    40% { transform: scale(1.08); }
}

.betslip-toggle__icon {
    display: flex;
    opacity: 0.95;
}

.betslip-toggle__badge {
    background: #fff;
    color: var(--accent, #e63946);
    font-size: 0.72rem;
    font-weight: 800;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
}

.betslip-toggle__badge[hidden] {
    display: none;
}

/* When panel open on mobile — hide toggle to avoid overlap */
@media (max-width: 767px) {
    .betslip-open .betslip-toggle {
        opacity: 0;
        pointer-events: none;
        transform: translateY(12px);
    }
}

/* —— Backdrop —— */
.betslip-backdrop {
    position: fixed;
    inset: 0;
    z-index: 940;
    background: rgba(0, 0, 0, 0.55);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(2px);
}

.betslip-backdrop--visible {
    opacity: 1;
    pointer-events: auto;
}

body.betslip-open {
    overflow: hidden;
}

/* —— Panel —— */
.betslip-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 92vh;
    z-index: 950;
    background: var(--bg-card, #1a1d24);
    border: 1px solid var(--border, #2a2f3a);
    border-bottom: none;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -12px 48px rgba(0, 0, 0, 0.45);
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.betslip-panel.betslip--open {
    transform: translateY(0);
}

.betslip__handle {
    flex-shrink: 0;
    width: 40px;
    height: 4px;
    background: var(--border, #3a4050);
    border-radius: 999px;
    margin: 10px auto 0;
}

/* —— Header —— */
.betslip__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px 10px;
    border-bottom: 1px solid var(--border, #2a2f3a);
    background: var(--bg-elevated, #22262e);
}

.betslip__head-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.betslip__head h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
}

.betslip__count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--accent, #e63946);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 800;
}

.betslip__count-badge[hidden] {
    display: none;
}

.betslip__type {
    font-size: 0.72rem;
    color: var(--accent, #e63946);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 2px;
}

.betslip__type--express {
    color: #eab308;
}

.betslip__head-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.betslip__clear {
    background: none;
    border: none;
    color: var(--text-tertiary, #888);
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 6px;
}

.betslip__clear:hover:not(:disabled) {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.betslip__clear:disabled {
    opacity: 0.35;
    cursor: default;
}

.betslip__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 10px;
    background: var(--bg-input, #252932);
    color: var(--text-secondary, #aaa);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.betslip__close:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

/* —— Balance bar —— */
.betslip__balance {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(230, 57, 70, 0.08);
    border-bottom: 1px solid var(--border, #2a2f3a);
    font-size: 0.82rem;
}

.betslip__balance span {
    color: var(--text-tertiary, #888);
}

.betslip__balance strong {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-weight: 700;
    color: var(--accent, #e63946);
    flex: 1;
}

.betslip__balance-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 8px;
    background: var(--accent, #e63946);
    color: #fff;
    font-weight: 800;
    font-size: 1rem;
    text-decoration: none;
    line-height: 1;
}

.betslip__balance-link:hover {
    filter: brightness(1.1);
}

/* —— Selections list —— */
.betslip__list {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 10px 12px;
    min-height: 60px;
    max-height: 38vh;
}

.betslip__empty {
    text-align: center;
    padding: 28px 20px;
    color: var(--text-tertiary, #888);
}

.betslip__empty-icon {
    font-size: 2rem;
    margin-bottom: 8px;
    opacity: 0.7;
}

.betslip__empty strong {
    display: block;
    font-size: 0.95rem;
    color: var(--text-secondary, #aaa);
    margin-bottom: 6px;
}

.betslip__empty p {
    margin: 0;
    font-size: 0.82rem;
    line-height: 1.45;
}

.betslip__item {
    display: grid;
    grid-template-columns: 28px 1fr auto;
    gap: 10px;
    align-items: start;
    padding: 10px 10px 10px 8px;
    margin-bottom: 8px;
    background: var(--bg-input, #252932);
    border-radius: 12px;
    border: 1px solid var(--border, #2a2f3a);
    animation: betslipItemIn 0.25s ease;
}

@keyframes betslipItemIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.betslip__item-num {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--bg-card, #1a1d24);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--text-tertiary, #888);
    flex-shrink: 0;
}

.betslip__item-body {
    min-width: 0;
}

.betslip__item-market {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-tertiary, #888);
    margin-bottom: 2px;
}

.betslip__item-teams {
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.betslip__item-outcome {
    font-size: 0.78rem;
    color: var(--accent, #e63946);
    font-weight: 600;
}

.betslip__item-side {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    flex-shrink: 0;
}

.betslip__item-odds {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-weight: 800;
    font-size: 1rem;
    color: var(--text-primary, #fff);
    padding: 2px 6px;
    border-radius: 6px;
    transition: background 0.3s, color 0.3s;
}

.betslip__item-odds--up {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

.betslip__item-odds--down {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.betslip__remove {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--text-tertiary, #888);
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.betslip__remove:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

/* —— Footer —— */
.betslip__footer {
    padding: 12px 16px calc(16px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--border, #2a2f3a);
    background: var(--bg-elevated, #22262e);
    flex-shrink: 0;
}

.betslip__summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
}

.betslip__row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    background: var(--bg-input, #252932);
    border-radius: 8px;
    font-size: 0.78rem;
    color: var(--text-secondary, #aaa);
}

.betslip__row strong {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.92rem;
    color: var(--text-primary, #fff);
}

.betslip__stake-block {
    margin-bottom: 12px;
}

.betslip__stake-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-tertiary, #888);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 6px;
}

.betslip__stake-wrap {
    display: flex;
    gap: 8px;
    margin-bottom: 4px;
}

.betslip__stake-input {
    flex: 1;
    min-width: 0;
    padding: 12px 14px;
    background: var(--bg-input, #252932);
    border: 2px solid var(--border, #2a2f3a);
    border-radius: 10px;
    color: var(--text-primary, #fff);
    font-size: 1.05rem;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-weight: 700;
    transition: border-color 0.2s;
}

.betslip__stake-input:focus {
    outline: none;
    border-color: var(--accent, #e63946);
}

.betslip__stake-max {
    flex-shrink: 0;
    padding: 0 14px;
    background: rgba(230, 57, 70, 0.15);
    border: 1px solid rgba(230, 57, 70, 0.35);
    border-radius: 10px;
    color: var(--accent, #e63946);
    font-size: 0.78rem;
    font-weight: 800;
    cursor: pointer;
    letter-spacing: 0.04em;
}

.betslip__stake-max:hover {
    background: rgba(230, 57, 70, 0.25);
}

.betslip__stake-hint {
    font-size: 0.68rem;
    color: var(--text-tertiary, #888);
    margin-bottom: 8px;
}

.betslip__quick-stakes {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.betslip__quick-stake {
    padding: 8px 4px;
    background: var(--bg-input, #252932);
    border: 1px solid var(--border, #2a2f3a);
    border-radius: 8px;
    color: var(--text-secondary, #aaa);
    font-size: 0.78rem;
    font-weight: 600;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.betslip__quick-stake:hover {
    border-color: var(--accent, #e63946);
    color: var(--accent, #e63946);
    background: rgba(230, 57, 70, 0.08);
}

.betslip__win-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    margin-bottom: 10px;
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.12) 0%, rgba(230, 57, 70, 0.08) 100%);
    border: 1px solid rgba(34, 197, 94, 0.25);
    border-radius: 12px;
}

.betslip__win-box span {
    font-size: 0.82rem;
    color: var(--text-secondary, #aaa);
}

.betslip__win-box .betslip__potential-win {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 1.15rem;
    font-weight: 800;
    color: #22c55e;
}

.betslip__error {
    padding: 8px 12px;
    margin-bottom: 10px;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    font-size: 0.78rem;
    color: #ef4444;
    text-align: center;
}

.betslip__error[hidden] {
    display: none;
}

.betslip__place-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, var(--accent, #e63946) 0%, #c1121f 100%);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-weight: 800;
    font-size: 1rem;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.15s;
    letter-spacing: 0.02em;
}

.betslip__place-btn--express {
    background: linear-gradient(135deg, #eab308 0%, #ca8a04 100%);
    box-shadow: 0 4px 16px rgba(234, 179, 8, 0.3);
}

.betslip__place-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.betslip__place-btn:not(:disabled):hover {
    filter: brightness(1.06);
    transform: translateY(-1px);
}

.betslip__place-btn:not(:disabled):active {
    transform: translateY(0);
}

.betslip__mybets-link {
    display: block;
    text-align: center;
    margin-top: 10px;
    font-size: 0.78rem;
    color: var(--text-tertiary, #888);
    text-decoration: none;
}

.betslip__mybets-link:hover {
    color: var(--accent, #e63946);
}

/* —— Picked odds on line —— */
.odds-btn.betslip-picked,
.odds-bk-cell.betslip-picked {
    outline: 2px solid var(--accent, #e63946);
    outline-offset: -1px;
    background: rgba(230, 57, 70, 0.18) !important;
    position: relative;
}

.odds-btn.betslip-picked::after,
.odds-bk-cell.betslip-picked::after {
    content: '✓';
    position: absolute;
    top: 2px;
    right: 3px;
    font-size: 0.55rem;
    font-weight: 800;
    color: var(--accent, #e63946);
    line-height: 1;
}

/* —— Live odds flash —— */
.odds-flash-up {
    animation: oddsFlashUp 0.3s ease;
    background: rgba(34, 197, 94, 0.35) !important;
    box-shadow: inset 0 0 0 2px rgba(34, 197, 94, 0.6);
}

.odds-flash-down {
    animation: oddsFlashDown 0.3s ease;
    background: rgba(239, 68, 68, 0.35) !important;
    box-shadow: inset 0 0 0 2px rgba(239, 68, 68, 0.6);
}

@keyframes oddsFlashUp {
    0% { background: rgba(34, 197, 94, 0.6); }
    100% { background: rgba(34, 197, 94, 0.35); }
}

@keyframes oddsFlashDown {
    0% { background: rgba(239, 68, 68, 0.6); }
    100% { background: rgba(239, 68, 68, 0.35); }
}

/* —— Toast —— */
.betslip-toast {
    position: fixed;
    bottom: calc(100px + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: 12px 20px;
    background: #222;
    color: #fff;
    border-radius: 12px;
    font-size: 0.88rem;
    font-weight: 600;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s;
    max-width: 90vw;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.betslip-toast--show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.betslip-toast--success {
    background: #14532d;
    border: 1px solid #22c55e;
}

.betslip-toast--error {
    background: #7f1d1d;
    border: 1px solid #ef4444;
}

/* —— Header balance —— */
.header-balance {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(230, 57, 70, 0.12);
    border: 1px solid rgba(230, 57, 70, 0.3);
    border-radius: 8px;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--accent, #e63946);
    text-decoration: none;
    white-space: nowrap;
}

.header-balance:hover {
    background: rgba(230, 57, 70, 0.2);
}

/* —— Desktop —— */
@media (min-width: 768px) {
    .betslip-toggle {
        bottom: 24px;
        right: 24px;
    }

    .betslip-backdrop {
        background: rgba(0, 0, 0, 0.35);
    }

    .betslip-panel {
        left: auto;
        right: 24px;
        bottom: 24px;
        width: 400px;
        max-width: calc(100vw - 48px);
        max-height: calc(100vh - 48px);
        border-radius: 18px;
        border-bottom: 1px solid var(--border, #2a2f3a);
        transform: translateY(calc(100% + 40px));
        opacity: 0;
        transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.25s;
    }

    .betslip-panel.betslip--open {
        transform: translateY(0);
        opacity: 1;
    }

    .betslip__handle {
        display: none;
    }

    .betslip__list {
        max-height: 42vh;
    }

    body.betslip-open {
        overflow: auto;
    }
}

@media (max-width: 767px) {
    .betslip-toggle__label {
        display: none;
    }

    .betslip-toggle {
        padding: 12px 14px;
        border-radius: 50%;
        width: 52px;
        height: 52px;
        justify-content: center;
    }

    .betslip-toggle--has-items {
        width: auto;
        border-radius: 999px;
        padding: 11px 14px;
    }

    .betslip-toggle--has-items .betslip-toggle__label {
        display: inline;
    }
}
