/* ==========================================================================
   MODERN LOTTO THEME (iAm Lotto Style)
   High-fidelity, responsive, premium lottery gaming interface
   ========================================================================== */

/* Theme Colors & Tokens */
:root {
    --ml-primary: #0a3d54;
    --ml-primary-dark: #072a3a;
    --ml-primary-light: #0e5473;
    --ml-accent-cyan: #00a2cc;
    --ml-accent-cyan-hover: #008eb3;
    --ml-accent-gold: #e2b442;
    --ml-accent-gold-light: #f5cf6d;
    --ml-bg-app: #f0f4f8;
    --ml-card-bg: #ffffff;
    --ml-text-dark: #1e293b;
    --ml-text-muted: #64748b;
    --ml-border-gold: #e2b442;
    --ml-success-green: #10b981;
    --ml-danger-red: #ef4444;
}

/* Full container for modern view */
#tab-m-bet-modern {
    width: 100%;
    min-height: 100%;
    background-color: var(--ml-bg-app);
    color: var(--ml-text-dark);
    display: none;
    flex-direction: column;
    position: relative;
    font-family: 'Outfit', 'Sarabun', -apple-system, sans-serif;
    overflow-y: auto;
    overflow-x: hidden;
}

#tab-m-bet-modern.active {
    display: flex;
}

/* When in modern mode, content frame should allow full width */
body.mode-modern .content-frame {
    padding: 0 !important;
    background: var(--ml-bg-app);
}

body.mode-modern.is-member .sidebar,
body.mode-modern.is-member .mobile-header,
body.mode-modern.is-member .sidebar-overlay,
body.mode-modern.is-member .mobile-bottom-nav {
    display: none !important;
}

body.mode-modern.is-member .content-frame {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    height: 100vh;
    overflow-y: auto;
}

/* Header Bar (Modern Style) */
.ml-header {
    background: linear-gradient(135deg, #09374c 0%, #0d5475 100%);
    border-bottom: 3px solid var(--ml-accent-gold);
    padding: 10px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    position: sticky;
    top: 0;
    z-index: 50;
}

.ml-header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.ml-logo-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.ml-logo-badge {
    height: 44px;
    width: auto;
    max-width: 140px;
    object-fit: contain;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    padding: 2px;
}

.ml-site-title {
    color: #ffffff;
    font-weight: 700;
    font-size: 18px;
    letter-spacing: 0.5px;
    display: flex;
    flex-direction: column;
}

.ml-site-subtitle {
    font-size: 11px;
    color: var(--ml-accent-gold);
    font-weight: 400;
}

.ml-header-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.ml-icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.ml-icon-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    border-color: var(--ml-accent-gold);
}

.ml-icon-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 10px;
}

.ml-user-profile-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 4px 12px 4px 8px;
    border-radius: 20px;
    color: #ffffff;
}

.ml-user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--ml-accent-cyan);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.ml-user-info {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.ml-user-name {
    font-size: 12px;
    font-weight: 600;
    color: #e2e8f0;
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ml-user-balance {
    font-size: 12px;
    font-weight: 700;
    color: #facc15;
    display: flex;
    align-items: center;
    gap: 4px;
}

.ml-flag-badge {
    font-size: 20px;
    cursor: pointer;
}

/* Quick Mode Switcher in Header */
.ml-mode-switch-btn {
    background: rgba(226, 180, 66, 0.2);
    border: 1px solid var(--ml-accent-gold);
    color: var(--ml-accent-gold-light);
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ml-mode-switch-btn:hover {
    background: var(--ml-accent-gold);
    color: #000;
}

/* ==========================================================================
   LOBBY VIEW (หน้ารวมหวย)
   ========================================================================== */

.ml-lobby-container {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 16px 40px;
    width: 100%;
}

/* Category Filter Tabs (หวยยอดฮิต, หวยใกล้ปิด, หวยทั้งหมด) */
.ml-category-tabs {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.ml-cat-tab-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 24px;
    border-radius: 30px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: #475569;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.ml-cat-tab-btn img,
.ml-cat-tab-btn .ml-tab-icon {
    font-size: 22px;
}

.ml-cat-tab-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.08);
}

.ml-cat-tab-btn.active {
    background: linear-gradient(135deg, #0099cc 0%, #00b4d8 100%);
    color: #ffffff;
    border-color: #0099cc;
    box-shadow: 0 4px 15px rgba(0, 153, 204, 0.35);
}

/* Category Banner Ribbon */
.ml-category-banner {
    background: linear-gradient(135deg, #0088b3 0%, #00a2cc 100%);
    color: #ffffff;
    font-size: 16px;
    font-weight: 700;
    padding: 8px 24px;
    border-radius: 12px 12px 0 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(0, 136, 179, 0.25);
    margin-bottom: -1px;
}

/* Cards Wrapper Box */
.ml-cards-wrapper {
    background: #ffffff;
    border: 2px solid var(--ml-accent-gold);
    border-radius: 0 16px 16px 16px;
    padding: 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
}

/* Lottery Cards Grid */
.ml-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

/* Single Lottery Card */
.ml-card {
    border-radius: 14px;
    overflow: hidden;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    position: relative;
    transition: all 0.25s ease;
    cursor: pointer;
}

.ml-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
    border-color: var(--ml-accent-cyan);
}

/* Card Header with stylized Flag & Background */
.ml-card-header {
    height: 110px;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 10px 6px;
    color: #ffffff;
    text-align: center;
}

/* Background Gradients by Lottery Type */
.ml-card-header.bg-thai {
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 50%, #dc2626 100%);
}
.ml-card-header.bg-lao {
    background: linear-gradient(135deg, #1e3a8a 0%, #0284c7 60%, #dc2626 100%);
}
.ml-card-header.bg-hanoi {
    background: linear-gradient(135deg, #b91c1c 0%, #dc2626 50%, #f59e0b 100%);
}
.ml-card-header.bg-hanoi-vip {
    background: linear-gradient(135deg, #991b1b 0%, #dc2626 60%, #d97706 100%);
}
.ml-card-header.bg-us {
    background: linear-gradient(135deg, #ea580c 0%, #f97316 60%, #1e3a8a 100%);
}
.ml-card-header.bg-jp {
    background: linear-gradient(135deg, #334155 0%, #475569 100%);
}
.ml-card-header.bg-default {
    background: linear-gradient(135deg, #0f766e 0%, #0d9488 100%);
}

/* Circular Flag on Top */
.ml-flag-circle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 3px solid #ffffff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    margin-bottom: 4px;
}

.ml-card-fav-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 14px;
    cursor: pointer;
    backdrop-filter: blur(4px);
    transition: all 0.2s;
}

.ml-card-fav-btn:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(1.1);
}

.ml-card-fav-btn.favorited {
    color: #ef4444;
}

.ml-card-title {
    font-size: 16px;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
    margin-bottom: 2px;
}

.ml-card-date {
    background: #000000;
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 12px;
    display: inline-block;
    letter-spacing: 0.5px;
}

/* Card Body / Info Row */
.ml-card-body {
    padding: 10px 12px;
    display: flex;
    gap: 8px;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
}

.ml-pill-close-time {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #334155;
    font-size: 11.5px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    flex: 1;
    text-align: center;
}

.ml-pill-rules-btn {
    background: var(--ml-accent-cyan);
    color: #ffffff;
    border: none;
    font-size: 11.5px;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.ml-pill-rules-btn:hover {
    background: var(--ml-accent-cyan-hover);
}

/* Card Footer / Status & Countdown Bar */
.ml-card-footer {
    padding: 8px 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 13.5px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.ml-card-footer.open {
    background: linear-gradient(90deg, #10b981 0%, #059669 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.ml-card-footer.closed {
    background: linear-gradient(90deg, #64748b 0%, #475569 100%);
    color: #cbd5e1;
}

.ml-footer-version {
    text-align: right;
    font-size: 11px;
    color: #94a3b8;
    margin-top: 14px;
    font-family: monospace;
}

/* ==========================================================================
   BETTING ROOM VIEW (ห้องแทงหวย)
   ========================================================================== */

.ml-room-container {
    max-width: 1200px;
    margin: 16px auto;
    padding: 0 16px 40px;
    width: 100%;
}

/* Room Header Bar */
.ml-room-header {
    background: linear-gradient(135deg, #0088b3 0%, #00a2cc 100%);
    border-radius: 14px 14px 0 0;
    padding: 10px 20px;
    color: #ffffff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0, 136, 179, 0.25);
}

.ml-room-back-btn {
    background: none;
    border: none;
    color: #ffffff;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px;
    border-radius: 8px;
    transition: background 0.2s;
}

.ml-room-back-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.ml-room-countdown {
    font-size: 15px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 0, 0, 0.2);
    padding: 4px 14px;
    border-radius: 20px;
}

/* Main Two-Column Layout */
.ml-room-layout {
    background: #ffffff;
    border: 2px solid var(--ml-accent-gold);
    border-top: none;
    border-radius: 0 0 16px 16px;
    padding: 20px;
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
}

@media (max-width: 900px) {
    .ml-room-layout {
        grid-template-columns: 1fr;
    }
}

/* Left Sidebar: Selected Bet List & Action Buttons */
.ml-room-sidebar {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: fit-content;
}

.ml-sidebar-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ml-btn-pull-bill {
    background: #00a2cc;
    color: #ffffff;
    border: none;
    padding: 10px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s;
}

.ml-btn-pull-bill:hover {
    background: #008eb3;
}

.ml-btn-open-price {
    background: #94a3b8;
    color: #ffffff;
    border: none;
    padding: 10px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s;
}

.ml-btn-open-price.active,
.ml-btn-open-price:hover {
    background: #00a2cc;
    box-shadow: 0 4px 10px rgba(0, 162, 204, 0.3);
}

.ml-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 8px;
    font-size: 13.5px;
    font-weight: 700;
    color: #334155;
}

.ml-sidebar-badge {
    color: var(--ml-accent-cyan);
    font-weight: 700;
}

.ml-sidebar-list {
    max-height: 480px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ml-sidebar-item {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    transition: background 0.15s;
}

.ml-sidebar-item:hover {
    background: #f1f5f9;
}

.ml-item-del-btn {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 14px;
    padding: 2px 6px;
    border-radius: 4px;
}

.ml-item-del-btn:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

/* Right Main Area: Tabs, Bet Types, Numpad / Board */
.ml-room-main {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Method Tabs: กดเลขเอง / เลือกจากแผง / จับวิน / ทำนายฝัน */
.ml-method-tabs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    background: #f1f5f9;
    padding: 4px;
    border-radius: 10px;
}

.ml-method-btn {
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: transparent;
    font-size: 14px;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.ml-method-btn.active {
    background: #00a2cc;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 162, 204, 0.3);
}

/* Bet Type Selector Pills Grid */
.ml-section-label {
    font-size: 14px;
    font-weight: 700;
    color: #334155;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ml-types-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 8px;
}

.ml-type-pill {
    background: #ffffff;
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: all 0.2s;
}

.ml-type-pill:hover {
    border-color: #00a2cc;
    transform: translateY(-1px);
}

.ml-type-pill.active {
    background: #00a2cc;
    border-color: #00a2cc;
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(0, 162, 204, 0.3);
}

.ml-type-name {
    font-size: 13px;
    font-weight: 600;
}

.ml-type-payout {
    background: #0f172a;
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 12px;
}

.ml-type-pill.active .ml-type-payout {
    background: #ffffff;
    color: #00a2cc;
}

/* Lao Set Layout in Betting Room */
.ml-types-grid.ml-lao-mode {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    width: 100% !important;
    grid-template-columns: none !important;
}

.ml-lao-header-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    background: #ffffff;
    border: 1.5px solid #00a2cc;
    border-radius: 10px;
    padding: 10px 16px;
    box-shadow: 0 2px 8px rgba(0, 162, 204, 0.08);
}

.ml-lao-pill-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: #00a2cc;
    color: #ffffff;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
    box-shadow: 0 2px 6px rgba(0, 162, 204, 0.25);
    cursor: default;
}

.ml-lao-pill-price-badge {
    background: rgba(0, 0, 0, 0.2);
    color: #fef08a;
    font-size: 13px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 6px;
}

.ml-lao-fixed-notice {
    font-size: 13px;
    color: #0284c7;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 6px;
    padding: 6px 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.ml-lao-prizes-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px 16px;
    width: 100%;
    box-sizing: border-box;
}

.ml-lao-prizes-title {
    font-size: 13px;
    font-weight: 700;
    color: #00a2cc;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ml-lao-prizes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 8px;
    width: 100%;
}

.ml-lao-prize-item {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 7px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.ml-lao-prize-name {
    font-size: 12.5px;
    font-weight: 600;
    color: #334155;
}

.ml-lao-prize-val {
    font-size: 12.5px;
    font-weight: 700;
    color: #0284c7;
    background: #e0f2fe;
    padding: 3px 8px;
    border-radius: 6px;
}

/* Numpad Section: Digits Input Box & Controls */
.ml-input-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    margin-bottom: 8px;
}

.ml-btn-reverse {
    background: #ffffff;
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.ml-btn-reverse:hover,
.ml-btn-reverse.active {
    border-color: #00a2cc;
    color: #00a2cc;
    background: rgba(0, 162, 204, 0.08);
}

/* Digit Input Boxes */
.ml-digit-boxes-wrap {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 14px 0;
}

.ml-digit-box {
    width: 50px;
    height: 58px;
    border: 2px solid #cbd5e1;
    border-radius: 10px;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    font-weight: 700;
    color: #0f172a;
    transition: all 0.2s;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.04);
}

.ml-digit-box.active {
    border-color: #00a2cc;
    box-shadow: 0 0 0 3px rgba(0, 162, 204, 0.2);
    position: relative;
}

.ml-digit-box.active::after {
    content: '';
    position: absolute;
    bottom: 8px;
    width: 20px;
    height: 3px;
    background: #00a2cc;
    animation: mlBlink 1s infinite;
}

@keyframes mlBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* Virtual Numpad Grid */
.ml-numpad-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    max-width: 480px;
    margin: 0 auto 16px;
    width: 100%;
}

.ml-pad-btn {
    height: 56px;
    background: #00a2cc;
    color: #ffffff;
    border: none;
    border-radius: 10px;
    font-size: 22px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px rgba(0, 162, 204, 0.25);
    transition: all 0.15s ease;
}

.ml-pad-btn:hover {
    background: #008eb3;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 162, 204, 0.35);
}

.ml-pad-btn:active {
    transform: translateY(1px);
    box-shadow: 0 2px 4px rgba(0, 162, 204, 0.2);
}

.ml-pad-btn.btn-empty {
    background: #e2e8f0;
    box-shadow: none;
    cursor: default;
}

.ml-pad-btn.btn-backspace {
    background: #008eb3;
    font-size: 20px;
}

/* Number Board Grid (เลือกจากแผง) */
.ml-board-range-tabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.ml-board-range-btn {
    padding: 6px 14px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    cursor: pointer;
    transition: all 0.2s;
}

.ml-board-range-btn.active {
    background: #00a2cc;
    border-color: #00a2cc;
    color: #ffffff;
}

.ml-board-sub-header {
    background: #0d5475;
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
    padding: 8px 16px;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 12px;
}

.ml-board-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 6px;
    max-height: 480px;
    overflow-y: auto;
    padding: 4px;
}

@media (max-width: 600px) {
    .ml-board-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

.ml-board-cell {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 8px 4px;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
}

.ml-board-cell:hover {
    border-color: #00a2cc;
    background: #f0fdf4;
}

.ml-board-cell.selected {
    background: #00a2cc;
    border-color: #00a2cc;
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(0, 162, 204, 0.3);
}

/* ==========================================================================
   PRICING MODAL (หน้าต่างใส่ราคา & ยืนยันโพย)
   ========================================================================== */

.ml-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 100000 !important;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
}

.ml-modal-overlay.active {
    display: flex;
}

.ml-price-modal {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
    width: 100%;
    max-width: 680px;
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin: auto;
    animation: mlModalSlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    box-sizing: border-box;
}

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

.ml-modal-header {
    background: #09374c;
    color: #ffffff;
    padding: 14px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.ml-modal-title {
    font-size: 17px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.ml-modal-badge {
    background: #ffffff;
    color: #09374c;
    font-size: 12px;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 12px;
}

.ml-modal-close-btn {
    background: none;
    border: none;
    color: #ffffff;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
}

.ml-modal-body {
    padding: 18px 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Modal Table */
.ml-price-table-wrap {
    max-height: 240px;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.ml-price-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.ml-price-table th {
    background: #f8fafc;
    color: #475569;
    font-weight: 600;
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 2;
}

.ml-price-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #f1f5f9;
    color: #1e293b;
    vertical-align: middle;
}

.ml-num-pill {
    background: #10b981;
    color: #ffffff;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 6px;
    display: inline-block;
    font-family: monospace;
    font-size: 13.5px;
}

.ml-price-inp {
    width: 80px;
    padding: 4px 8px;
    border: 1.5px solid #cbd5e1;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
}

.ml-price-inp:focus {
    border-color: #00a2cc;
    outline: none;
}

.ml-win-rate-pill {
    background: #f1f5f9;
    border-radius: 6px;
    padding: 4px 8px;
    font-weight: 600;
    color: #475569;
    display: inline-block;
}

/* Deduplication Buttons */
.ml-dedup-bar {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.ml-dedup-btn {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 6px 14px;
    font-size: 12.5px;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.ml-dedup-btn:hover {
    background: #e2e8f0;
}

/* Bulk Pricing Bar */
.ml-bulk-pricing-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ml-bulk-input-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.ml-bulk-label {
    font-size: 13px;
    font-weight: 700;
    color: #334155;
    white-space: nowrap;
}

.ml-bulk-input {
    width: 110px;
    padding: 6px 10px;
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 600;
    text-align: center;
}

.ml-btn-copy-price {
    background: #ffffff;
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    cursor: pointer;
    transition: all 0.2s;
}

.ml-btn-copy-price:hover {
    background: #00a2cc;
    color: #ffffff;
    border-color: #00a2cc;
}

/* Quick Amount Chips: 5฿, 10฿, 20฿, 50฿, 100฿, 500฿ */
.ml-quick-chips-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
}

.ml-chip-btn {
    border: none;
    border-radius: 8px;
    padding: 8px 4px;
    font-size: 13px;
    font-weight: 700;
    color: #ffffff;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.15s;
    text-align: center;
}

.ml-chip-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.ml-chip-5 { background: #a855f7; }
.ml-chip-10 { background: #f97316; }
.ml-chip-20 { background: #10b981; }
.ml-chip-50 { background: #06b6d4; }
.ml-chip-100 { background: #ef4444; }
.ml-chip-500 { background: #6366f1; }

/* Summary Balance vs Total Bet Amount Cards */
.ml-summary-cards-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.ml-summary-card {
    border-radius: 10px;
    padding: 12px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ml-summary-card.credit {
    background: #00a2cc;
    color: #ffffff;
}

.ml-summary-card.total {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #0f172a;
}

.ml-summary-title {
    font-size: 12px;
    font-weight: 600;
    opacity: 0.9;
}

.ml-summary-val {
    font-size: 20px;
    font-weight: 800;
}

/* Modal Actions Footer */
.ml-modal-footer {
    border-top: 1px solid #e2e8f0;
    padding: 14px 20px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    background: #f8fafc;
    flex-shrink: 0;
    position: sticky;
    bottom: 0;
    z-index: 5;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.ml-btn-cancel-all {
    background: #ffffff;
    border: 1.5px solid #cbd5e1;
    color: #475569;
    font-size: 14px;
    font-weight: 600;
    padding: 8px 18px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.ml-btn-cancel-all:hover {
    background: #fee2e2;
    border-color: #ef4444;
    color: #ef4444;
}

.ml-btn-submit-bill {
    background: #09374c;
    border: none;
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
    padding: 8px 24px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 10px rgba(9, 55, 76, 0.3);
    transition: all 0.2s;
}

.ml-btn-submit-bill:hover {
    background: #0d4b65;
    transform: translateY(-1px);
}

/* ==========================================================================
   FLOATING TOAST NOTIFICATIONS (Screenshot 4)
   ========================================================================== */

.ml-toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 1000200;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.ml-toast {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
    width: 260px;
    overflow: hidden;
    pointer-events: auto;
    position: relative;
    animation: mlToastSlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes mlToastSlideIn {
    from {
        transform: translateX(50px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.ml-toast-content {
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13.5px;
    font-weight: 600;
    color: #1e293b;
}

.ml-toast-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ml-toast-close {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
}

.ml-toast-progress {
    height: 3px;
    background: #10b981;
    width: 100%;
    animation: mlToastProgress 2s linear forwards;
}

@keyframes mlToastProgress {
    from { width: 100%; }
    to { width: 0%; }
}

/* Modal Open Body Helper */
body.ml-modal-open {
    overflow: hidden !important;
}

body.ml-modal-open .mobile-member-bottom-nav {
    display: none !important;
}

/* ==========================================================================
   MOBILE RESPONSIVENESS
   ========================================================================== */
@media (max-width: 768px) {
    .ml-header {
        padding: 8px 12px;
    }
    .ml-site-title {
        font-size: 15px;
    }
    .ml-logo-badge {
        height: 36px;
    }
    .ml-user-profile-pill {
        padding: 2px 8px;
    }
    .ml-user-name {
        max-width: 80px;
    }
    .ml-cat-tab-btn {
        padding: 8px 16px;
        font-size: 13.5px;
    }
    .ml-cards-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 14px;
    }
    .ml-cards-wrapper {
        padding: 14px;
    }
    .ml-room-layout {
        padding: 12px;
        gap: 14px;
    }
    .ml-method-tabs {
        grid-template-columns: repeat(2, 1fr);
    }
    .ml-digit-box {
        width: 44px;
        height: 52px;
        font-size: 22px;
    }
    .ml-pad-btn {
        height: 50px;
        font-size: 20px;
    }
    .ml-quick-chips-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .ml-toast-container {
        top: 12px;
        right: 12px;
        left: 12px;
    }
    .ml-toast {
        width: 100%;
    }

    /* Modal Mobile Adjustments: Always Visible Footer with Large Touch Buttons */
    .ml-modal-overlay {
        padding: 6px 6px max(10px, env(safe-area-inset-bottom, 10px)) 6px !important;
        align-items: center;
    }
    .ml-price-modal {
        max-height: calc(100vh - 12px);
        max-height: calc(100dvh - 12px);
        border-radius: 14px;
        margin: auto;
        width: 100%;
    }
    .ml-modal-header {
        padding: 10px 14px;
    }
    .ml-modal-title {
        font-size: 15.5px;
    }
    .ml-modal-body {
        padding: 12px 14px;
        gap: 12px;
    }
    .ml-price-table-wrap {
        max-height: 180px;
    }
    .ml-bulk-pricing-box {
        padding: 10px;
        gap: 8px;
    }
    .ml-bulk-input-row {
        gap: 8px;
    }
    .ml-modal-footer {
        padding: 10px 14px;
        padding-bottom: max(12px, env(safe-area-inset-bottom, 12px));
        gap: 8px;
        display: flex;
        background: #f8fafc;
    }
    .ml-btn-cancel-all,
    .ml-btn-submit-bill {
        flex: 1;
        justify-content: center;
        padding: 12px 8px;
        font-size: 15px;
        font-weight: 700;
        border-radius: 8px;
        min-height: 46px;
    }
}
