/* ============================================================
   FAIRPLAY13 — MOBILE RESPONSIVE STYLES
   Breakpoints: 992px (tablet) | 768px (mid) | 576px (phone)
   ============================================================ */

/* ── 1. GLOBAL TOUCH IMPROVEMENTS ── */
* {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

body {
    overflow-x: hidden;
}

/* ── 2. HEADER ── */
@media (max-width: 992px) {
    .main-header {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        padding: 8px 12px;
        gap: 6px;
        min-height: unset;
    }

    /* Logo stays left */
    .logo {
        flex: 0 0 auto;
        display: flex !important;
        flex-direction: row !important;
        align-items: center;
        gap: 8px;
    }

    .logo h1 { font-size: 20px; margin-bottom: 0; }
    .logo .tagline { display: none !important; }

    /* Header-right pushes to the right */
    .header-right {
        flex: 1;
        display: flex !important;
        flex-direction: row !important;
        align-items: center;
        justify-content: flex-end;
        gap: 8px;
        flex-wrap: nowrap;
    }

    .search-bar { display: none !important; }
    .time-display { display: none !important; }
    #last-sync-time { display: none !important; }

    /* LIVE badge stays visible */
    .header-status-box { display: flex; align-items: center; }
    .header-live-btn { font-size: 11px; padding: 3px 10px; }

    /* Logged-out: just login button */
    .btn-login { font-size: 12px; padding: 6px 14px; }

    /* Logged-in: user info compact row */
    .user-info {
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-end !important;
        background: transparent !important;
        border: none !important;
        padding: 0 !important;
        font-size: 11px;
        gap: 1px;
        color: white;
    }

    .user-info > span { font-size: 10px; opacity: 0.85; }

    .balance-info {
        display: flex !important;
        flex-direction: column !important;
        gap: 1px !important;
        font-size: 10px;
        text-align: right;
        line-height: 1.4;
    }

    /* Hide action buttons — use bottom nav instead */
    .action-buttons { display: none !important; }
}

@media (max-width: 576px) {
    .account-drawer {
        position: fixed;
        bottom: -100%;
        left: 0;
        width: 100%;
        height: 80%; /* Height for better interaction */
        background: #fff;
        border-top: 3px solid var(--yellow);
        z-index: 1000;
        transition: bottom 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        padding-bottom: env(safe-area-inset-bottom, 0px);
        box-shadow: 0 -10px 25px rgba(0,0,0,0.3);
        border-radius: 15px 15px 0 0;
        overflow-y: auto;
    }

    .account-drawer.active {
        bottom: 56px;
    }

    .account-drawer-header {
        padding: 16px 20px;
        background: #fff;
        color: #333;
        font-size: 18px;
        font-weight: 700;
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-bottom: 1px solid #eee;
        position: sticky;
        top: 0;
        z-index: 10;
    }

    .account-drawer-header .user-name-box {
        display: flex;
        align-items: center;
        gap: 12px;
    }

    .balance-info-card {
        padding: 20px;
        margin: 15px;
        background: #fff;
        border: 1px solid #eee;
        border-radius: 12px;
        box-shadow: 0 4px 10px rgba(0,0,0,0.03);
    }

    .balance-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 15px;
        color: #666;
        font-size: 13px;
    }

    .balance-main {
        font-size: 24px;
        font-weight: 800;
        color: #1a1a1a;
        margin-bottom: 15px;
    }

    .balance-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 20px;
        margin-bottom: 20px;
    }

    .balance-small-box .label {
        font-size: 10px;
        color: #888;
        text-transform: uppercase;
        margin-bottom: 4px;
    }

    .balance-small-box .value {
        font-size: 16px;
        font-weight: 700;
        color: #333;
    }

    .drawer-action-btns {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .drawer-btn {
        padding: 12px;
        border-radius: 8px;
        border: none;
        color: #fff;
        font-weight: 700;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        font-size: 14px;
        text-decoration: none;
    }

    .drawer-btn.deposit { background: #28a745; }
    .drawer-btn.withdraw { background: #dc3545; }

    .drawer-section-title {
        padding: 10px 20px;
        font-size: 11px;
        color: #999;
        font-weight: 700;
        text-transform: uppercase;
        background: #fdfdfd;
        letter-spacing: 0.5px;
    }

    .account-drawer-item {
        padding: 14px 20px;
        display: flex;
        align-items: center;
        gap: 15px;
        color: #444;
        text-decoration: none;
        font-size: 14px;
        font-weight: 500;
        border-bottom: 1px solid #f9f9f9;
        transition: all 0.2s;
    }

    .account-drawer-item i {
        font-size: 18px;
        width: 24px;
        color: #555;
    }

    .account-drawer-item:active {
        background: #f0f0f0;
        padding-left: 25px;
    }

    .drawer-overlay {
        position: fixed;
        top: 0; left: 0; width: 100%; height: 100%;
        background: rgba(0,0,0,0.6);
        backdrop-filter: blur(4px);
        display: none;
        z-index: 999;
    }

    .drawer-overlay.active { display: block; }
}

/* ── 3. SUB-NAV ── */
@media (max-width: 992px) {
    .sub-nav ul {
        justify-content: flex-start;
        gap: 0;
        padding: 0;
        overflow-x: auto;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .sub-nav ul::-webkit-scrollbar {
        display: none;
    }

    .sub-nav li a {
        padding: 10px 12px;
        font-size: 11px;
        white-space: nowrap;
        border-bottom: 2px solid transparent;
    }

    .sub-nav li.active a {
        border-bottom-color: var(--primary-green);
        color: var(--primary-green);
    }
}

/* ── 4. INDEX / HOME PAGE LAYOUT ── */
@media (max-width: 992px) {
    .main-container {
        flex-direction: column !important;
        padding: 8px !important;
        gap: 8px !important;
    }

    .left-sidebar {
        width: 100% !important;
        /* Convert sport list to horizontal scroll on mobile */
    }

    .sport-list {
        display: flex !important;
        overflow-x: auto;
        scrollbar-width: none;
        gap: 0;
        padding: 0;
    }

    .sport-list::-webkit-scrollbar {
        display: none;
    }

    .sport-list li {
        flex-shrink: 0;
    }

    .sport-list li a {
        padding: 10px 14px;
        font-size: 12px;
        border-left: none !important;
        border-bottom: 2px solid transparent;
        white-space: nowrap;
    }

    .sport-list li a:hover,
    .sport-list li a.active {
        border-bottom-color: var(--primary-green);
        background: transparent;
    }

    .content-area {
        width: 100% !important;
    }

    .banners-wrapper {
        height: 160px !important;
        margin-bottom: 10px;
        border-radius: 6px;
    }

    .banner-content h2 {
        font-size: 2.2rem;
        transform: skew(-6deg);
    }
}

@media (max-width: 576px) {
    .banners-wrapper {
        height: 120px !important;
    }

    .banner-content h2 {
        font-size: 1.7rem;
    }

    .section-header {
        padding: 8px 12px;
    }

    .section-header h3 {
        font-size: 14px;
    }

    .sport-header {
        padding: 8px 10px;
        flex-wrap: wrap;
        gap: 6px;
    }

    .filters .badge {
        padding: 3px 6px;
        font-size: 10px;
        margin-left: 3px;
    }

    /* Odds table on index page - Switch to Cards on mobile */
    .odds-table-container {
        padding: 5px;
    }

    .odds-table {
        display: none !important; /* Hide old table on mobile */
    }

    .mobile-match-cards {
        display: flex;
        flex-direction: column;
        gap: 12px;
        padding: 10px;
    }

    .match-card {
        background: #fff;
        border-radius: 10px;
        padding: 12px;
        box-shadow: 0 4px 15px rgba(0,0,0,0.05);
        border: 1px solid #f0f0f0;
    }

    .match-card-top {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 10px;
        padding-bottom: 8px;
        border-bottom: 1px solid #f9f9f9;
    }

    .match-card-status {
        display: flex;
        align-items: center;
        gap: 6px;
    }

    .live-pulse {
        color: #dc3545;
        font-weight: 800;
        font-size: 10px;
        display: flex;
        align-items: center;
        gap: 4px;
        text-transform: uppercase;
    }

    .live-pulse::before {
        content: '';
        width: 5px;
        height: 5px;
        background: #dc3545;
        border-radius: 50%;
        animation: pulse-red 1.5s infinite;
    }

    .match-card-time {
        font-size: 10px;
        color: #999;
    }

    .match-card-teams {
        display: flex;
        flex-direction: column;
        gap: 6px;
        margin-bottom: 12px;
    }

    .match-card-team {
        font-size: 15px;
        font-weight: 700;
        color: #1a1a1a;
    }

    .match-card-odds {
        display: grid;
        grid-template-columns: 1fr 1fr 1fr;
        gap: 8px;
    }

    .mobile-odds-btn {
        height: 44px;
        border-radius: 6px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        font-weight: 800;
        transition: transform 0.1s;
    }

    .mobile-odds-btn:active {
        transform: scale(0.95);
    }

    .mobile-odds-btn .val { font-size: 14px; }
    .mobile-odds-btn .label { font-size: 8px; opacity: 0.6; text-transform: uppercase; }

    .mobile-odds-btn.back { background: #72bbef; color: #1a1a1a; }
    .mobile-odds-btn.lay { background: #faa9ba; color: #1a1a1a; }
}

@keyframes pulse-red {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(220, 53, 69, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(220, 53, 69, 0); }
}

/* ── 5. MATCH PAGE SPECIFIC ── */
@media (max-width: 992px) {
    .match-layout {
        flex-direction: column !important;
        gap: 10px;
    }

    .left-sidebar {
        display: none !important;
    }

    .center-content {
        order: 1;
        width: 100% !important;
        border-radius: 6px;
        overflow: hidden;
    }

    .right-sidebar {
        order: 2;
        width: 100% !important;
        margin-top: 0;
        border-radius: 6px;
        overflow: hidden;
    }

    /* Right sidebar: make credit grid more compact */
    .credit-grid {
        grid-template-columns: 1fr 1fr 1fr !important;
    }

    .balance-box {
        grid-column: 1 / 4 !important;
    }

    /* Betslip tabs horizontal scroll */
    .betslip-tabs {
        overflow-x: auto;
        scrollbar-width: none;
    }

    .betslip-tab {
        padding: 9px 14px;
        white-space: nowrap;
        flex-shrink: 0;
    }
}

@media (max-width: 768px) {

    /* Match title bar */
    .match-title-bar {
        padding: 8px 10px;
        flex-wrap: wrap;
        gap: 6px;
    }

    .match-title-left {
        font-size: 12px;
        gap: 6px;
    }

    .match-title-right {
        font-size: 10px;
    }

    /* Scorecard */
    .scorecard-bar {
        font-size: 10px;
        padding: 6px 10px;
        flex-wrap: wrap;
        gap: 4px;
    }

    /* Odds header */
    .odds-header {
        height: auto;
        flex-wrap: wrap;
        padding: 6px 8px;
        gap: 4px;
    }

    .odds-header-right {
        display: none;
        /* hide min/max on small screens */
    }

    .match-odds-title {
        padding: 0 12px 0 8px;
        font-size: 11px;
        clip-path: none;
    }

    /* Match odds table */
    .match-odds-table tr {
        display: flex !important;
        align-items: center !important;
        padding: 6px 8px !important;
        gap: 6px;
    }

    .match-odds-table td {
        display: block !important;
        padding: 0 !important;
        border: none !important;
    }

    .team-name {
        flex: 1;
        font-size: 12px !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        min-width: 0;
    }

    .odds-boxes {
        gap: 3px;
        flex-shrink: 0;
    }

    .odds-box-lg {
        width: 50px !important;
        height: 40px !important;
    }

    .odds-box-lg .val {
        font-size: 12px !important;
    }

    .odds-box-lg .size {
        font-size: 9px !important;
    }

    /* Bookmaker section */
    .bookmaker-subheader-right {
        width: 160px !important;
        gap: 30px !important;
        justify-content: center !important;
    }

    .bookmaker-odds-area {
        width: 160px !important;
    }

    .bm-box {
        font-size: 12px !important;
        height: 40px;
    }

    .bookmaker-team-name {
        font-size: 12px;
        padding: 8px;
    }

    /* Fancy section */
    .fancy-table-header-right {
        width: 160px !important;
    }

    .fancy-table-header-right>div {
        width: 53px !important;
        font-size: 10px;
    }

    .fancy-odds-group {
        width: 160px !important;
    }

    .fancy-box {
        width: 53px !important;
        height: 38px !important;
    }

    .fancy-val {
        font-size: 12px !important;
    }

    .fancy-vol {
        font-size: 9px !important;
    }

    .fancy-title {
        font-size: 12px;
        padding: 8px 8px;
    }

    .fancy-limits {
        display: none;
    }

    /* Market header */
    .market-header-dark {
        padding: 6px 8px;
        font-size: 11px;
    }

    /* Fancy category tabs */
    .fancy-category-tabs {
        overflow-x: auto;
        scrollbar-width: none;
        padding: 2px 4px;
        gap: 2px;
    }

    .fancy-category-tabs::-webkit-scrollbar {
        display: none;
    }

    .fancy-cat-tab {
        padding: 6px 10px;
        font-size: 11px;
        flex-shrink: 0;
    }

    /* Fancy main tabs */
    .fancy-tabs-container {
        overflow-x: auto;
        scrollbar-width: none;
    }

    .fancy-tab-main {
        padding: 7px 14px 7px 14px;
        font-size: 11px;
        clip-path: none !important;
        border-radius: 4px 4px 0 0;
        margin-left: 0 !important;
    }

    .fancy-tab-main.active {
        padding-right: 14px;
    }

    .fancy-tab-main.inactive {
        padding-left: 14px;
    }

    .fancy-subnav {
        padding: 4px 10px;
        gap: 10px;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .fancy-subnav::-webkit-scrollbar {
        display: none;
    }

    .fancy-subnav-btn {
        font-size: 11px;
        white-space: nowrap;
    }
}

@media (max-width: 576px) {

    /* Inline bet slip in match page */
    .inline-betslip-container {
        padding: 8px !important;
    }

    .bs-layout-row {
        flex-direction: row !important;
        gap: 6px !important;
    }

    .bs-quick-stakes {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 4px !important;
    }

    .bs-quick-stakes button {
        font-size: 10px !important;
        padding: 5px 2px !important;
    }

    /* Numpad */
    .bs-numpad-btn {
        padding: 10px 0 !important;
        font-size: 15px !important;
    }

    /* Right sidebar credit panel */
    .credit-info {
        padding: 10px;
    }

    .credit-box .label {
        font-size: 9px;
    }

    .credit-box .value {
        font-size: 12px;
    }

    .one-click-bet {
        padding: 8px 10px;
        font-size: 12px;
        gap: 8px;
    }

    /* My Bets table in sidebar */
    .betslip-content .my-bets-container table {
        font-size: 10px !important;
    }

    .betslip-content .my-bets-container th,
    .betslip-content .my-bets-container td {
        padding: 4px !important;
    }

    /* Number game */
    .ng-number-grid {
        grid-template-columns: repeat(5, 1fr) !important;
        gap: 4px !important;
    }

    .ng-num-btn {
        height: 44px !important;
        font-size: 18px !important;
    }

    /* Live over history balls */
    .ball {
        width: 18px;
        height: 18px;
        font-size: 9px;
    }

    .over-label {
        font-size: 10px;
    }
}

/* ── 6. LOGIN MODAL ── */
@media (max-width: 576px) {
    .modal-content {
        margin: 5% auto !important;
        padding: 24px 20px !important;
        width: 90% !important;
        max-width: 360px;
    }

    .modal-header-logo h2 {
        font-size: 26px;
    }

    .modal-header-logo {
        margin-bottom: 20px;
    }

    .form-group {
        margin-bottom: 12px;
    }

    .form-group input {
        padding: 11px 12px;
        font-size: 14px;
    }

    .btn-block {
        padding: 11px;
        font-size: 15px;
    }
}

/* ── 7. ACCOUNT SIDEBAR ── */
@media (max-width: 576px) {
    .account-sidebar {
        width: 288px !important;
    }
}

/* ── 8. ODDS FLASH ANIMATIONS (keep visible on mobile) ── */
@media (max-width: 768px) {

    .flash-up,
    .flash-down {
        animation-duration: 0.6s;
    }
}

/* ── 9. UTILITY: BOTTOM SAFE AREA (iOS notch) ── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .main-header {
        padding-top: max(8px, env(safe-area-inset-top));
    }
}

/* ── 10. STICKY MOBILE BOTTOM NAV BAR (index + match pages) ── */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #000;
    border-top: 1px solid #333;
    z-index: 900;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.mobile-bottom-nav-items {
    display: flex;
    align-items: stretch;
}

.mobile-bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 4px;
    color: #aaa;
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    gap: 4px;
    cursor: pointer;
    border-right: 1px solid #222;
    transition: color 0.2s, background 0.2s;
    text-decoration: none;
}

.mobile-bottom-nav-item:last-child {
    border-right: none;
}

.mobile-bottom-nav-item i {
    font-size: 18px;
}

.mobile-bottom-nav-item.active {
    color: var(--yellow);
}

.mobile-bottom-nav-item:hover {
    background: #111;
    color: #fff;
}

@media (max-width: 768px) {
    .mobile-bottom-nav {
        display: block;
    }

    /* Push body content above the nav bar */
    body {
        padding-bottom: 56px;
    }
}

/* ── 11. SCROLLABLE SUB-NAV INDICATOR ── */
.sub-nav ul {
    scrollbar-width: none;
}

.sub-nav ul::-webkit-scrollbar {
    display: none;
}

/* ── 12. IMPROVED TOUCH TARGETS ── */
@media (max-width: 768px) {

    .odds-box-lg,
    .bm-box,
    .fancy-box {
        min-height: 40px;
    }

    /* Betslip action buttons */
    .inline-betslip-container button[onclick="placeBet()"],
    .inline-betslip-container button[onclick="closeInlineBetSlip()"],
    #inline-fancy-betslip-row button[onclick="placeFancyBet()"] {
        min-height: 44px;
    }
}