:root {
    --primary: #00ff88;      
    --emerald: #006644;      
    --dark-bg: #050a07;      
    --sidebar-bg: #0b140e;   
    --card-bg: #121f18;      
    --gold: #deb887;         
    --text: #e0e0e0;
    --text-muted: #8da696;
    --sidebar-width: 260px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Prompt', sans-serif;
    text-decoration: none;
}

body {
    background-color: var(--dark-bg);
    color: var(--text);
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    border-right: 1px solid rgba(0, 255, 136, 0.1);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    box-shadow: 5px 0 30px rgba(0,0,0,0.5);
}

/* --- ปรับแต่ง Logo รูปภาพ --- */
.brand {
    padding: 20px;
    display: flex;
    justify-content: center; /* จัดให้อยู่กึ่งกลางเมนู */
    align-items: center;
    background: transparent; /* เอาพื้นหลังไล่สีออก (หรือจะเก็บไว้ก็ได้) */
}

.logo-link {
    display: block;
    width: 100%;
    text-align: center;
}

.logo-link img {
    max-width: 80%;   /* ให้กว้างไม่เกิน 80% ของเมนู (เหลือขอบซ้ายขวานิดหน่อย) */
    height: auto;     /* ให้สูงตามสัดส่วน */
    max-height: 70px; /* จำกัดความสูงสูงสุดไม่ให้ดันเนื้อหาอื่นตก (ปรับเลขนี้ได้ตามชอบ) */
    object-fit: contain;
    display: inline-block;
}

.text-green { color: var(--primary); }
.text-gold { color: var(--gold); }

.user-mini-profile {
    padding: 15px 25px;
    display: flex;
    align-items: center;
    gap: 15px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.avatar { position: relative; width: 40px; height: 40px; }
.avatar img { width: 100%; height: 100%; border-radius: 50%; border: 2px solid var(--emerald); }
.status-dot { width: 10px; height: 10px; background: var(--primary); border-radius: 50%; position: absolute; bottom: 0; right: 0; border: 2px solid var(--sidebar-bg); }
.info .username { display: block; font-size: 14px; font-weight: 500; }
.info .balance { display: block; font-size: 12px; color: var(--primary); font-weight: bold; }

.side-menu {
    flex: 1;
    overflow-y: auto;
    padding: 20px 0;
}

.side-menu a {
    display: flex;
    align-items: center;
    padding: 12px 25px;
    color: var(--text-muted);
    font-size: 14px;
    transition: 0.3s;
    border-left: 3px solid transparent;
}

.side-menu a i { width: 25px; font-size: 16px; }

.side-menu a:hover, .side-menu a.active {
    background: linear-gradient(90deg, rgba(0,255,136,0.1), transparent);
    color: #fff;
    border-left-color: var(--primary);
}

.side-menu .badge {
    margin-left: auto;
    background: #ff0040;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
}

.side-menu .separator {
    font-size: 11px;
    text-transform: uppercase;
    color: #4a5e53;
    padding: 15px 25px 5px;
    font-weight: 600;
}

.side-menu .vip-link { color: var(--gold); }
.side-menu .vip-link:hover { text-shadow: 0 0 10px var(--gold); }
.side-footer { padding: 20px; }
.deposit-btn {
    display: block; /* บังคับให้เป็นก้อนเต็มบรรทัด */
    text-align: center; /* จัดตัวหนังสือให้อยู่ตรงกลาง */
    text-decoration: none; /* เอาขีดเส้นใต้ลิ้งค์ออก */
    
    /* สไตล์เดิม (คงไว้) */
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, var(--emerald), #004d33);
    border: 1px solid var(--primary);
    color: #fff;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    box-shadow: 0 0 15px rgba(0,255,136,0.2);
    transition: 0.3s;
}

.deposit-btn:hover { 
    box-shadow: 0 0 25px rgba(0,255,136,0.4); 
    transform: translateY(-2px); 
    color: #fff; /* ย้ำสีตัวหนังสือตอนเอาเมาส์จ่อ */
}

.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 20px 30px;
    width: calc(100% - var(--sidebar-width));
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}
.page-title { font-size: 20px; font-weight: 600; color: #fff; }
.top-actions { display: flex; gap: 10px; }
.top-actions button {
    padding: 8px 20px;
    border-radius: 30px;
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
}
/* --- ปุ่มเข้าสู่ระบบ (Premium Gold Style) --- */
.login-btn {
    position: relative;
    /* ไล่สีทอง 3 เฉด เพื่อมิติที่สวยงาม */
    background: linear-gradient(45deg, #b8860b, #ffd700, #b8860b);
    background-size: 200% auto; /* เตรียมพื้นที่สำหรับอนิเมชั่น */
    color: #000; /* ตัวหนังสือสีดำ ตัดกับสีทอง */
    border: none; /* เอาขอบเดิมออก */
    padding: 8px 25px; /* เพิ่มความกว้างให้ดูเต็มตา */
    border-radius: 50px; /* ทำมุมโค้งมน */
    font-weight: 700;
    font-size: 14px;
    text-transform: uppercase; /* ตัวพิมพ์ใหญ่ทั้งหมด */
    letter-spacing: 0.5px; /* ระยะห่างตัวอักษรนิดนึงให้ดูโปร */
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3); /* เงาปกติ */
    transition: all 0.4s ease; /* ความลื่นไหล */
    overflow: hidden;
    z-index: 1;
}

/* เอฟเฟกต์ตอนเอาเมาส์ไปจ่อ (Hover) */
.login-btn:hover {
    background-position: right center; /* เลื่อนสีพื้นหลังให้เหมือนไฟวิ่ง */
    transform: translateY(-3px) scale(1.05); /* ลอยขึ้นนิดนึง + ขยายใหญ่ขึ้น */
    color: #000;
}

/* แถม! เอฟเฟกต์แสงเงาวิ่งผ่าน (Shine Effect) */
.login-btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    transition: 0.5s;
    z-index: -1;
}

.login-btn:hover::after {
    left: 100%; /* แสงวิ่งจากซ้ายไปขวาเมื่อเอาเมาส์แตะ */
}
/* --- ปุ่มติดต่อ LINE (Neon Shake Style) --- */
.line-btn {
    position: relative;
    display: inline-flex; /* จัดไอคอนกับตัวหนังสือให้อยู่กึ่งกลาง */
    align-items: center;
    gap: 8px; /* ระยะห่างระหว่างไอคอนกับตัวหนังสือ */
    
    /* สีเขียว Line แบบไล่เฉด */
    background: linear-gradient(135deg, #06c755, #00d65b);
    color: #fff;
    border: none;
    padding: 8px 25px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    
    /* เงาสีเขียวจางๆ */
    box-shadow: 0 5px 15px rgba(6, 199, 85, 0.3);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); /* เด้งดึ๋ง */
    z-index: 1;
    overflow: hidden;
}

/* เอฟเฟกต์ตอนเอาเมาส์ไปจ่อ (Hover) */
.line-btn:hover {
    transform: scale(1.05) translateY(-3px); /* ขยายและลอยขึ้น */
    background: linear-gradient(135deg, #00d65b, #06c755); /* สลับสีให้ดูมีการเคลื่อนไหว */
}

/* สั่งให้ไอคอนข้างใน (ตัว i) ขยับ */
.line-btn i {
    font-size: 18px; /* ขยายไอคอนให้ชัด */
    transition: 0.3s;
}

/* ตอนเอาเมาส์จ่อปุ่ม ให้ไอคอนเขย่า (Shake) */
.line-btn:hover i {
    animation: shake 0.5s ease-in-out both;
}

/* คีย์เฟรมการเขย่า */
@keyframes shake {
    0% { transform: rotate(0); }
    25% { transform: rotate(-20deg) scale(1.2); }
    50% { transform: rotate(20deg) scale(1.2); }
    75% { transform: rotate(-10deg) scale(1.2); }
    100% { transform: rotate(0) scale(1); }
}
.mobile-toggle { display: none; font-size: 24px; cursor: pointer; }

.hero-section {
    border-radius: 20px;
    overflow: hidden;
    margin-bottom: 30px;
    border: 1px solid rgba(255,255,255,0.1);
    position: relative;
    background: url('https://via.placeholder.com/1200x400/003300/fff') center/cover;
    height: 300px;
}

.bg-overlay {
    position: absolute; inset: 0;
    background: linear-gradient(90deg, #000 0%, rgba(0,0,0,0.5) 50%, transparent 100%);
    z-index: 1;
}

.match-info {
    position: relative; z-index: 2;
    padding: 40px;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    max-width: 500px;
}

.league-tag {
    color: var(--primary);
    font-size: 14px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.teams { display: flex; align-items: center; gap: 20px; margin: 20px 0; }
.team { display: flex; flex-direction: column; align-items: center; color: #fff; }
.team img { width: 60px; margin-bottom: 5px; }
.vs-badge { text-align: center; }
.vs-badge span { font-size: 24px; font-weight: bold; color: #555; }
.live-indicator { background: #ff0040; color: white; padding: 2px 8px; font-size: 10px; border-radius: 4px; animation: pulse 1.5s infinite; }

.watch-now-btn {
    background: var(--primary);
    color: #000;
    border: none;
    padding: 10px 25px;
    border-radius: 5px;
    font-weight: bold;
    width: fit-content;
    cursor: pointer;
}

.quick-menu {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}
.q-card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    border: 1px solid rgba(255,255,255,0.05);
    transition: 0.3s;
    cursor: pointer;
    height: 85px;
}
.q-card:hover, .q-card.active {
    background: linear-gradient(135deg, var(--emerald), #004d33);
    border-color: var(--primary);
}
.q-card i { font-size: 24px; margin-bottom: 10px; color: var(--primary); }
.q-card.active i { color: #fff; }
.q-card span { display: block; font-size: 14px; color: var(--text-muted); }
.q-card.active span { color: #fff; }


.section-header { display: flex; justify-content: space-between; margin-bottom: 20px; align-items: center; }
.section-header h3 { font-size: 18px; color: #fff; }
.view-all { font-size: 13px; color: var(--text-muted); transition: 0.3s; }
.view-all:hover { color: var(--primary); }

.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.video-card {
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    transition: 0.3s;
}
.video-card:hover { transform: translateY(-5px); box-shadow: 0 10px 20px rgba(0,0,0,0.5); }

.thumb { position: relative; height: 160px; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.live-tag { position: absolute; top: 10px; left: 10px; background: #ff0040; color: #fff; font-size: 10px; padding: 2px 6px; border-radius: 4px; }
.vip-tag { position: absolute; top: 10px; left: 10px; background: var(--gold); color: #000; font-size: 10px; padding: 2px 6px; border-radius: 4px; font-weight: bold; }
.play-overlay, .lock-overlay {
    position: absolute; inset: 0; background: rgba(0,0,0,0.4);
    display: flex; justify-content: center; align-items: center;
    opacity: 0; transition: 0.3s;
}
.video-card:hover .play-overlay { opacity: 1; }
.video-card:hover .lock-overlay { opacity: 1; }
.play-overlay i { font-size: 40px; color: #fff; filter: drop-shadow(0 0 10px rgba(0,0,0,0.5)); }
.lock-overlay i { font-size: 40px; color: var(--gold); }

.video-card .meta { padding: 15px; }
.video-card h4 { font-size: 15px; margin-bottom: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.video-card p { font-size: 12px; color: var(--text-muted); }


.bottom-nav { display: none; }

@media (max-width: 992px) {
    .sidebar { display: none; } 
    .main-content { margin-left: 0; width: 100%; padding: 15px; padding-bottom: 80px; }
    .mobile-toggle { display: block; color: var(--text); }
    .page-title { display: none; } 
    .hero-section { height: auto; }
    .match-info { padding: 20px; }
    .quick-menu { grid-template-columns: repeat(2, 1fr); }
    .bottom-nav {
        position: fixed; bottom: 0; left: 0; width: 100%;
        background: #0f1a14;
        border-top: 1px solid rgba(0,255,136,0.2);
        display: flex; justify-content: space-around;
        padding: 10px 0; z-index: 999;
        backdrop-filter: blur(10px);
    }
    
    .b-item {
        display: flex; flex-direction: column; align-items: center;
        color: #666; font-size: 10px; flex: 1;
    }
    .b-item i { font-size: 20px; margin-bottom: 4px; }
    .b-item.active { color: var(--primary); }
    
    .b-item.center { position: relative; }
    .float-btn {
        width: 50px; height: 50px;
        background: linear-gradient(135deg, var(--primary), var(--emerald));
        border-radius: 50%;
        display: flex; justify-content: center; align-items: center;
        position: absolute; top: -30px;
        border: 4px solid var(--dark-bg);
        box-shadow: 0 0 15px rgba(0,255,136,0.4);
    }
    .float-btn i { color: #000; font-size: 20px; margin: 0; }
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.slider-wrapper {
    position: relative;
    width: 100%;
    height: auto;
    overflow: hidden;
    border-radius: 15px;
    border: 1px solid rgba(0, 255, 136, 0.2);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    margin-bottom: 30px;
}

.slider-track {
    display: flex;
    transition: transform 0.5s ease-in-out;
    align-items: flex-start;
    height: auto;
}

.slide-item {
    min-width: 100%;
    height: auto;
    position: relative;
    display: flex; 
}

.slide-item img {
    width: 100%;
    height: auto;      
    object-fit: unset; 
    display: block;
}

.slide-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.3) 60%, transparent 100%);
    display: flex;
    align-items: center;
    padding-left: 50px;
}

.slider-btn {
    padding: 10px 25px;
    background: var(--primary);
    color: #000;
    border: none;
    border-radius: 30px;
    font-weight: bold;
    cursor: pointer;
    font-size: 14px;
    transition: 0.3s;
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.3);
}
.slider-btn:hover { transform: scale(1.05); box-shadow: 0 0 25px rgba(0, 255, 136, 0.6); }

.slider-btn.gold-btn {
    background: linear-gradient(45deg, var(--gold), #b8860b);
    box-shadow: 0 0 15px rgba(218, 165, 32, 0.3);
}

.nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.5);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.2);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    transition: 0.3s;
}
.nav-btn:hover { background: var(--primary); color: #000; }
.prev { left: 15px; }
.next { right: 15px; }

.dots-container {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
}

.dot {
    width: 10px;
    height: 10px;
    background: rgba(255,255,255,0.3);
    border-radius: 50%;
    cursor: pointer;
    transition: 0.3s;
}
.dot.active { background: var(--primary); width: 25px; border-radius: 10px; }

@media (max-width: 768px) {
    .slider-wrapper { height: auto; } 
    .slider-btn { padding: 8px 16px; font-size: 12px; }
    .nav-btn { width: 30px; height: 30px; font-size: 12px; }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}


.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    
    /* เพิ่มบรรทัดนี้: เรียกใช้เอฟเฟกต์ Fade In พื้นหลัง */
    animation: fadeIn 0.3s ease-out forwards;
}

.modal-content {
    background: #111;
    border: 1px solid var(--primary);
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 400px;
    position: relative;
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.2);
    text-align: center;

    /* เพิ่มบรรทัดนี้: เรียกใช้เอฟเฟกต์เด้งดึ๋ง (Popup Zoom) */
    animation: popupZoom 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* เมื่อ Modal กำลังจะปิด ให้เล่น Animation ขาออก */
.modal-overlay.closing {
    animation: fadeOut 0.3s ease-in forwards; /* พื้นหลังค่อยๆ จาง */
    pointer-events: none; /* ป้องกันการกดซ้ำระหว่างกำลังปิด */
}

.modal-overlay.closing .modal-content {
    animation: popupZoomOut 0.3s ease-in forwards; /* ตัวกล่องค่อยๆ หุบ */
}

.close-modal {
    position: absolute;
    top: 10px;
    right: 15px;
    color: #fff;
    font-size: 28px;
    cursor: pointer;
}

.modal-header h2 {
    color: #fff;
    margin-bottom: 20px;
}

.input-group {
    position: relative;
    margin-bottom: 15px;
}

.input-group i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary);
}

.input-group input {
    width: 100%;
    padding: 12px 12px 12px 40px;
    background: #222;
    border: 1px solid #444;
    color: #fff;
    border-radius: 8px;
    outline: none;
}

.input-group input:focus {
    border-color: var(--primary);
}

.modal-login-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(45deg, #b8860b, #ffd700);
    border: none;
    border-radius: 8px;
    color: #000;
    font-weight: bold;
    cursor: pointer;
    margin-top: 10px;
    transition: 0.3s;
}

.modal-login-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
}

.status-text {
    margin-top: 15px;
    font-size: 14px;
    min-height: 20px;
}

/* --- Animation Keyframes --- */

/* 1. เฟดพื้นหลัง (จากจางไปเข้ม) */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* 2. เด้งกล่องเนื้อหา (จากเล็กไปใหญ่ + ลอยขึ้นมา) */
@keyframes popupZoom {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(-20px); /* เริ่มต้น: เล็กกว่าปกติ และลอยอยู่สูงนิดนึง */
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0); /* จบ: ขนาดปกติ เข้าที่เดิม */
    }
}

/* --- Exit Animations (ขาออก) --- */

/* 1. เฟดพื้นหลังออก (จากเข้มไปจาง) */
@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* 2. หุบกล่องเนื้อหา (จากใหญ่ไปเล็ก + จางหายไป) */
@keyframes popupZoomOut {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(0.8) translateY(-20px); /* หดเล็กลงนิดนึงแล้วลอยขึ้น */
    }
}

/* --- Logout Modal Buttons --- */
.modal-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.modal-btn {
    flex: 1; /* ให้ปุ่มกว้างเท่ากัน */
    padding: 12px;
    border-radius: 8px;
    border: none;
    font-weight: bold;
    cursor: pointer;
    font-size: 14px;
    transition: 0.3s;
}

/* ปุ่มยกเลิก (สีเทา) */
.modal-btn.cancel {
    background: #333;
    color: #fff;
    border: 1px solid #555;
}
.modal-btn.cancel:hover {
    background: #444;
}

/* ปุ่มยืนยัน (สีแดง หรือ ทองตามธีม) */
.modal-btn.confirm {
    background: linear-gradient(45deg, #ff0040, #ff4d4d); /* สีแดงให้รู้ว่าออกจากระบบ */
    color: #fff;
    box-shadow: 0 5px 15px rgba(255, 0, 64, 0.3);
}
.modal-btn.confirm:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(255, 0, 64, 0.5);
}

/* --- FOOTBALL FEED STYLES (Emerald Theme) --- */

.loading-state {
    text-align: center;
    padding: 50px;
    color: var(--text-muted);
    font-size: 16px;
}

/* League Header */
.league-section {
    margin-bottom: 25px;
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.league-header {
    background: linear-gradient(90deg, #0f1a14, #1a2e24);
    padding: 10px 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(0, 255, 136, 0.2);
}

.league-header img { height: 25px; width: auto; }
.league-header span { font-weight: bold; color: var(--primary); font-size: 14px; text-transform: uppercase; }

/* Match List */
.match-item {
    display: flex;
    align-items: center;
    justify-content: space-between; /* กระจายซ้ายขวา */
    padding: 12px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    background: var(--card-bg);
    gap: 5px; /* ระยะห่างระหว่างก้อน (เวลา, ทีม, ปุ่ม) */
}

.match-item:last-child { border-bottom: none; }
.match-item:hover { background: rgba(0, 255, 136, 0.02); }

/* Live Status */
.match-item.live-now {
    background: rgba(255, 0, 64, 0.05); /* พื้นหลังแดงจางๆ */
    border-left: 3px solid #ff0040;
}

.m-time {
    width: 50px; /* ฟิกซ์ความกว้าง */
    text-align: center;
    font-size: 13px;
    flex-shrink: 0; /* ห้ามหด */
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.status-live { 
    background: #ff0040; color: #fff; padding: 2px 6px; 
    border-radius: 4px; font-weight: bold; font-size: 10px; 
    animation: blink 1.5s infinite; 
}
.status-time { color: var(--text-muted); }

/* Teams & Score */
.m-teams {
    flex: 1; /* กินพื้นที่ที่เหลือทั้งหมด */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px; /* ระยะห่างระหว่าง เหย้า-VS-เยือน */
    overflow: hidden; /* กันทะลุ */
}

.m-team {
    display: flex;
    align-items: center;
    width: 40%; /* แบ่งพื้นที่ทีมละ 40% */
    gap: 6px;   /* ระยะห่างระหว่าง ชื่อ-โลโก้ (ปรับเลขนี้ถ้าอยากให้ชิด/ห่าง) */
    overflow: hidden;
}
.m-team img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    flex-shrink: 0; /* ห้ามโลโก้หด */
}

.m-team:first-child {
    justify-content: flex-end; /* ดันเนื้อหาไปทางขวาสุด */
    text-align: right;
}


.m-team:last-child {
    justify-content: flex-start; /* ดันเนื้อหาไปทางซ้ายสุด (เพื่อให้โลโก้ติด VS และชื่อติดโลโก้) */
    text-align: left;
}
/* ปรับชื่อทีมให้อ่านง่าย */
.t-name {
    font-size: 14px;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    
    /* สำคัญ! แก้ตรงนี้เพื่อให้ชื่อไม่ดันตัวออกไป */
    flex: 0 1 auto; /* flex-grow: 0 (ห้ามขยาย), flex-shrink: 1 (หดได้), auto (กว้างตามตัวอักษร) */
    max-width: 100%; /* กันชื่อยาวทะลุ */
}
.text-right { text-align: right; }

.m-score {
    width: 40px; /* ฟิกซ์ความกว้าง */
    text-align: center;
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    align-items: center;
}
.score-num {
    color: var(--primary);
    font-weight: bold;
    font-size: 16px;
}
.vs {
    font-size: 12px;
    color: #666;
    font-weight: bold;
}

/* Action Button */
.m-action {
    width: auto;
    flex-shrink: 0; /* ห้ามหด */
    padding-left: 5px;
}
.watch-btn-sm {
    background: #222;
    color: #aaa;
    border: 1px solid #444;
    padding: 6px 15px;
    border-radius: 20px;
    font-size: 12px;
    white-space: nowrap;
    cursor: pointer;
}
.watch-btn-sm.active {
    background: linear-gradient(135deg, var(--emerald), #004d33);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 0 5px rgba(0,255,136,0.2);
}
.watch-btn-sm.active:hover { transform: scale(1.05); }

/* --- VIDEO MODAL STYLES --- */
.modal-content.video-mode {
    max-width: 800px; /* ขยายให้กว้างขึ้นสำหรับดูบอล */
    padding: 0;
    overflow: hidden;
    background: #000;
}

.video-header {
    padding: 15px;
    background: #111;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #333;
}
.video-header h3 { margin: 0; font-size: 16px; }
.live-indicator-blink { color: #ff0040; font-weight: bold; font-size: 12px; animation: blink 1s infinite; }

.player-wrapper {
    width: 100%;
    /* ใช้ padding-top แทน aspect-ratio เพื่อความชัวร์ในทุก Browser */
    padding-top: 56.25%; /* สัดส่วน 16:9 */
    background: #000;
    position: relative; /* สำคัญมาก */
    overflow: hidden;
}

#clapprPlayer {
    position: absolute; /* ลอยขึ้นมา */
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    z-index: 10;
}

/* บังคับ iframe หรือ video ข้างในให้เต็มด้วย */
#clapprPlayer > div,
#clapprPlayer video,
#clapprPlayer iframe {
    width: 100% !important;
    height: 100% !important;
    position: absolute;
    top: 0;
    left: 0;
}

.video-actions {
    padding: 15px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: #111;
}

.close-modal-video {
    position: absolute;
    top: -40px; right: 0;
    color: #fff; font-size: 30px; cursor: pointer;
}

/* --- Responsive มือถือ (สำคัญ: บีบให้ลงล็อคบรรทัดเดียว) --- */
@media (max-width: 768px) {
    .match-item { padding: 8px 5px; gap: 2px; }
    
    /* เวลา */
    .m-time { width: 40px; font-size: 11px; }
    
    /* โลโก้ */
    .m-team img { width: 28px; height: 28px; }
    
    /* ชื่อทีม (ลดขนาดและยอมให้ตัดคำง่ายขึ้น) */
    .t-name { font-size: 11px; }
    
    /* ระยะห่างระหว่าง ชื่อ-โลโก้ */
    .m-team { gap: 4px; } 

    /* ปุ่ม */
    .watch-btn-sm { 
        padding: 5px 10px; 
        font-size: 10px; 
    }
    .watch-btn-sm i { display: none; } /* ซ่อนไอคอนในปุ่ม เพื่อประหยัดที่ */
    
    /* ซ่อนคำว่า LIVE ในปุ่ม ให้เหลือแค่ไอคอน Play หรือคำสั้นๆ ก็ได้ ถ้าต้องการ */
    /* แต่โค้ดนี้จะยังโชว์ข้อความปกติ แค่ตัวเล็ก */
}

/* สำหรับมือถือจอเล็กมาก (iPhone SE / Fold) */
@media (max-width: 360px) {
    .m-time { width: 35px; font-size: 10px; }
    .t-name { max-width: 60px; } /* บังคับตัดคำเร็วขึ้น */
}

@keyframes blink { 0% {opacity:1;} 50% {opacity:0.5;} 100% {opacity:1;} }

/* ค้นหา @media (max-width: 992px) แล้วปรับแก้ดังนี้ */
@media (max-width: 992px) {
    /* 1. แก้ไขตรงนี้: ห้ามสั่ง display: none; ให้ใช้การดันออกไปข้างนอกแทน */
    .sidebar { 
        display: flex !important; /* เปลี่ยนจาก none เป็น flex */
        position: fixed !important;
        left: -260px; /* ดันเมนูไปเก็บไว้ทางซ้าย */
        top: 0;
        width: 260px;
        height: 100vh;
        z-index: 10000 !important;
        transition: 0.3s;
    }

    /* 2. เมื่อมี class active ให้เลื่อนกลับมาที่ 0 */
    .sidebar.active {
        left: 0 !important;
    }

    /* 3. ตรวจสอบให้แน่ใจว่า mobile-toggle แสดงผล */
    .mobile-toggle { 
        display: block !important; 
        color: var(--text); 
        font-size: 28px;
        z-index: 1001;
    }
}