/* =========================================
   1. CẤU HÌNH CHUNG (RESET CSS)
   ========================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f9f9f9; /* Màu nền xám nhẹ cho dịu mắt */
    color: #333;
    line-height: 1.6;
}

/* Biến màu sắc để dễ quản lý */
:root {
    --primary-color: #d32f2f; /* Màu đỏ Karate */
    --secondary-color: #222;  /* Màu đen */
    --text-color: #333;
    --white: #fff;
}

/* =========================================
   2. HEADER & MENU (THANH ĐIỀU HƯỚNG)
   ========================================= */
header {
    background-color: var(--white);
    padding: 15px 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky; /* Dính lên trên cùng khi cuộn */
    top: 0;
    z-index: 1000;
}

.logo {
    font-size: 26px;
    font-weight: 800;
    color: var(--primary-color);
    letter-spacing: 1px;
    text-transform: uppercase;
    padding-right: 15px;
    /* THÊM DÒNG NÀY ĐỂ LOGO KHÔNG BỊ NGẮT DÒNG */
    white-space: nowrap;
}

nav ul {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 25px;
}

nav a {
    text-decoration: none;
    color: var(--secondary-color);
    font-weight: 600;
    font-size: 16px;
    transition: color 0.3s;
    /* THÊM DÒNG NÀY ĐỂ CHỐNG XUỐNG DÒNG */
    white-space: nowrap;
}

nav a:hover {
    color: var(--primary-color);
}

/* Nút Đăng ký trên Menu */
.btn-register {
    background-color: var(--primary-color);
    color: var(--white) !important;
    padding: 10px 25px;
    border-radius: 50px; /* Bo tròn nút */
    border: none;
    cursor: pointer;
    font-weight: bold;
    transition: transform 0.2s, background 0.3s;
}

.btn-register:hover {
    background-color: #b71c1c;
    transform: translateY(-2px); /* Hiệu ứng nảy lên nhẹ */
}

/* Icon Menu Mobile (Mặc định ẩn trên PC) */
.menu-icon {
    display: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--secondary-color);
}

/* =========================================
   3. HERO SECTION (ẢNH BÌA LỚN)
   ========================================= */
.hero {
    /* Ảnh nền online chất lượng cao */
    background: linear-gradient(rgba(0,0,0,0.6), rgba(0,0,0,0.6)), 
                url('https://images.unsplash.com/photo-1555597673-b21d5c935865?q=80&w=2072&auto=format&fit=crop');
    background-size: cover;
    background-position: center;
    height: 500px; /* Chiều cao banner */
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--white);
    padding: 0 20px;
}

.hero h1 {
    font-size: 48px;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.hero button {
    padding: 12px 35px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
}

.hero button:hover {
    background-color: #b71c1c;
    letter-spacing: 1px; /* Dãn chữ ra khi hover */
}

/* =========================================
   4. LOCATION SECTION (DANH SÁCH ĐỊA ĐIỂM)
   ========================================= */
.container {
    max-width: 1200px;
    margin: 60px auto;
    padding: 0 20px;
}

.section-title {
    text-align: center;
    font-size: 32px;
    margin-bottom: 40px;
    color: var(--secondary-color);
    position: relative;
    padding-bottom: 10px;
}

/* Gạch chân đỏ dưới tiêu đề */
.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background-color: var(--primary-color);
    border-radius: 2px;
}

/* Lưới hiển thị thẻ (GRID SYSTEM) */
.location-grid {
    display: grid;
    /* Tự động chia cột: Tối thiểu 300px, tối đa 1 phần bằng nhau */
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 30px;
}

/* Thẻ từng địa điểm */
.location-card {
    background: var(--white);
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08); /* Đổ bóng nhẹ */
    border-top: 4px solid var(--primary-color); /* Viền trên màu đỏ */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.location-card:hover {
    transform: translateY(-10px); /* Bay lên khi hover */
    box-shadow: 0 15px 30px rgba(0,0,0,0.15);
}

.location-card h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 20px;
}

.location-card p {
    margin-bottom: 12px;
    color: #555;
    font-size: 15px;
    display: flex; /* Để icon thẳng hàng với chữ */
    align-items: flex-start;
    gap: 10px;
}

/* Màu icon trong thẻ */
.location-card i {
    color: var(--primary-color);
    margin-top: 4px;
}

/* Nút Hotline trong thẻ */
.hotline {
    display: block;
    margin-top: 20px;
    text-align: center;
    background: var(--secondary-color);
    color: var(--white);
    padding: 10px;
    text-decoration: none;
    border-radius: 6px;
    font-weight: bold;
    transition: 0.3s;
}

.hotline:hover {
    background: var(--primary-color);
}

/* =========================================
   5. MODAL (POPUP ĐĂNG KÝ)
   ========================================= */
.modal {
    display: none; /* Mặc định ẩn */
    position: fixed;
    z-index: 2000; /* Cao hơn header */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6); /* Nền đen mờ */
    backdrop-filter: blur(5px); /* Làm mờ hậu cảnh */
    animation: fadeIn 0.4s;
}

.modal-content {
    background-color: #fff;
    margin: 10vh auto; /* Cách trên 10% chiều cao màn hình */
    padding: 40px;
    border-radius: 15px;
    width: 90%;
    max-width: 450px;
    position: relative;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.modal-content h2 {
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 20px;
}

.close {
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 30px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
}

.close:hover {
    color: var(--primary-color);
}

/* Style cho các ô nhập liệu */
.modal input, 
.modal select {
    width: 100%;
    padding: 12px;
    margin: 10px 0;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    background-color: #fafafa;
}

.modal input:focus,
.modal select:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: #fff;
}

.modal button[type="submit"] {
    width: 100%;
    padding: 12px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 15px;
}

/* =========================================
   6. FOOTER
   ========================================= */
footer {
    background: #1a1a1a;
    color: #888;
    text-align: center;
    padding: 30px;
    margin-top: 50px;
    border-top: 5px solid var(--primary-color);
}

/* =========================================
   7. RESPONSIVE (MOBILE & TABLET)
   ========================================= */
@media (max-width: 768px) {
    /* Chỉnh Header cho Mobile */
    header {
        padding: 15px 20px;
    }

    .menu-icon {
        display: block; /* Hiện nút 3 gạch */
    }

    nav ul {
        display: none; /* Ẩn menu chính */
        flex-direction: column;
        position: absolute;
        top: 100%; /* Đẩy xuống dưới header */
        left: 0;
        width: 100%;
        background: white;
        padding: 20px 0;
        box-shadow: 0 5px 10px rgba(0,0,0,0.1);
        text-align: center;
    }

    /* Class này sẽ được JS thêm vào khi bấm nút */
    nav ul.active {
        display: flex;
        animation: slideDown 0.3s ease;
    }

    .hero h1 {
        font-size: 32px; /* Chữ nhỏ lại trên điện thoại */
    }

    .hero {
        height: 350px;
    }
}

/* Hiệu ứng chuyển động */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}
/* --- CSS CHO TRANG ADMIN --- */

.table-wrapper {
    overflow-x: auto; /* Cho phép cuộn ngang nếu bảng quá dài */
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    background: white;
}

.admin-table {
    width: 100%;
    border-collapse: collapse; /* Gộp đường viền ô */
    min-width: 600px;
}

.admin-table th, 
.admin-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.admin-table th {
    background-color: #d32f2f; /* Màu đỏ tiêu đề bảng */
    color: white;
    text-transform: uppercase;
    font-size: 14px;
}

.admin-table tr:hover {
    background-color: #f1f1f1; /* Đổi màu khi di chuột vào dòng */
}

.admin-table td strong {
    color: #d32f2f;
}
/* --- Thêm vào cuối file style.css --- */

/* Modal chọn vai trò */
.modal {
    display: none; 
    position: fixed; 
    z-index: 100; 
    left: 0; top: 0;
    width: 100%; height: 100%; 
    background-color: rgba(0,0,0,0.5); /* Nền tối */
}

.modal-content {
    background-color: white;
    margin: 15% auto;
    padding: 20px;
    border-radius: 8px;
    width: 300px;
    text-align: center;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    position: relative;
}

.close-btn {
    position: absolute;
    top: 5px; right: 15px;
    font-size: 24px;
    cursor: pointer;
    color: #aaa;
}
.close-btn:hover { color: black; }

/* Nút chọn vai trò */
.role-btn {
    display: block;
    width: 100%;
    padding: 12px;
    margin: 10px 0;
    cursor: pointer;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 5px;
    font-weight: bold;
}
.role-admin { border-left: 5px solid #d9534f; } /* Màu đỏ cho Admin */
.role-guest { border-left: 5px solid #0275d8; } /* Màu xanh cho Khách */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); /* Tự động chia cột */
    gap: 15px; /* Khoảng cách giữa các ảnh */
    padding: 20px 0;
}

/* Khung chứa từng ảnh */
.gallery-item {
    position: relative;
    overflow: hidden; /* Cắt phần ảnh thừa */
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    cursor: pointer;
    height: 250px; /* Chiều cao cố định để các ảnh bằng nhau */
}

/* Ảnh bên trong */
.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Đảm bảo ảnh không bị méo */
    transition: transform 0.5s ease; /* Hiệu ứng phóng to mượt mà */
}

/* Lớp phủ đen chứa chữ (Mặc định ẩn) */
.overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7); /* Màu đen mờ */
    overflow: hidden;
    width: 100%;
    height: 0; /* Mặc định chiều cao bằng 0 (ẩn) */
    transition: .5s ease; /* Thời gian hiện lên */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Nội dung chữ bên trong */
.text {
    color: white;
    font-size: 16px;
    text-align: center;
    padding: 0 20px;
}

.text h3 {
    margin: 0 0 10px 0;
    color: #ffcc00; /* Màu vàng nổi bật */
    text-transform: uppercase;
    font-size: 18px;
}

/* --- HIỆU ỨNG HOVER (DI CHUỘT VÀO) --- */
.gallery-item:hover img {
    transform: scale(1.1); /* Phóng to ảnh nhẹ */
}

.gallery-item:hover .overlay {
    height: 100%; /* Phủ đầy khung ảnh */
}
/* --- CSS CHO PHẦN GIẢI ĐẤU --- */
.tournament-btn {
    display: inline-block;
    padding: 15px 30px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: bold;
    font-size: 1.1rem;
    transition: 0.3s;
    border: 2px solid transparent;
}

/* Nút Xem bảng điểm */
.btn-view {
    background: #ffcc00;
    color: #000;
    box-shadow: 0 0 15px rgba(255, 204, 0, 0.4);
}
.btn-view:hover {
    background: #e6b800;
    transform: scale(1.05);
}

/* Nút Setup (Màu tối hơn) */
.btn-setup {
    background: transparent;
    color: #fff;
    border: 2px solid #fff;
}
.btn-setup:hover {
    background: #fff;
    color: #000;
}
/* --- CSS CHO MODAL GALLERY CHI TIẾT --- */
.gallery-modal-overlay {
    display: none; position: fixed; z-index: 9999; left: 0; top: 0; 
    width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(8px);
}

.gallery-close {
    position: absolute; top: 15px; right: 30px; color: white;
    font-size: 40px; font-weight: bold; cursor: pointer; z-index: 10000;
}
.gallery-close:hover { color: #d32f2f; }

.gallery-modal-content {
    display: flex; width: 90%; height: 85vh; margin: 40px auto 0;
    background: #fff; border-radius: 12px; overflow: hidden;
    box-shadow: 0 15px 50px rgba(0,0,0,0.5);
}

/* Khu vực ảnh */
.gallery-image-zone {
    flex: 2; background: #111; position: relative;
    display: flex; flex-direction: column;
}

.img-pan-container {
    flex: 1; overflow: auto; /* Tạo thanh cuộn khi ảnh zoom to */
    display: flex; align-items: center; justify-content: center;
}

#modalGalleryImg {
    max-width: 100%; max-height: 100%; object-fit: contain;
    transition: transform 0.2s ease-out; transform-origin: center center;
}

.zoom-controls {
    position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%);
    background: rgba(0,0,0,0.6); padding: 10px 20px; border-radius: 30px;
    display: flex; gap: 15px; z-index: 10;
}
.zoom-controls button {
    background: none; border: none; color: white; font-size: 20px; cursor: pointer; transition: 0.2s;
}
.zoom-controls button:hover { color: #ffcc00; transform: scale(1.2); }

/* Khu vực thông tin */
.gallery-info-zone {
    flex: 1; padding: 40px; background: #fff; overflow-y: auto;
}

/* Responsive cho Mobile: Gập cột trái và phải lại */
@media (max-width: 768px) {
    .gallery-modal-content { flex-direction: column; height: 90vh; width: 95%; margin-top: 20px; }
    .gallery-image-zone { flex: 1; min-height: 40vh; }
    .gallery-info-zone { flex: 1; padding: 20px; }
}
/* =========================================
   CSS MODAL GALLERY CHI TIẾT (FULLSCREEN)
   ========================================= */
.gallery-modal-overlay {
    display: none; position: fixed; z-index: 9999; left: 0; top: 0; 
    width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(8px);
}

.gallery-close {
    position: absolute; top: 15px; right: 30px; color: white;
    font-size: 45px; font-weight: bold; cursor: pointer; z-index: 10000;
    transition: 0.3s;
}
.gallery-close:hover { color: #d32f2f; transform: scale(1.1); }

.gallery-modal-content {
    display: flex; width: 90%; height: 85vh; margin: 40px auto 0;
    background: #fff; border-radius: 12px; overflow: hidden;
    box-shadow: 0 15px 50px rgba(0,0,0,0.5);
    animation: zoomIn 0.3s ease-out;
}

@keyframes zoomIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* Khu vực ảnh (Trái) */
.gallery-image-zone {
    flex: 2; background: #111; position: relative;
    display: flex; flex-direction: column;
}

.img-pan-container {
    flex: 1; overflow: auto; /* Tạo thanh cuộn khi ảnh zoom to */
    display: flex; align-items: center; justify-content: center;
}

#modalGalleryImg {
    max-width: 100%; max-height: 100%; object-fit: contain;
    transition: transform 0.2s ease-out; transform-origin: center center;
}

/* Bộ điều khiển Zoom */
.zoom-controls {
    position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%);
    background: rgba(0,0,0,0.6); padding: 10px 25px; border-radius: 30px;
    display: flex; gap: 20px; z-index: 10;
}
.zoom-controls button {
    background: none; border: none; color: white; font-size: 22px; cursor: pointer; transition: 0.2s;
}
.zoom-controls button:hover { color: #ffcc00; transform: scale(1.2); }

/* Khu vực thông tin (Phải) */
.gallery-info-zone {
    flex: 1; padding: 40px; background: #fff; overflow-y: auto;
}
.gallery-info-zone ul { margin-left: 20px; margin-top: 10px; }
.gallery-info-zone li { margin-bottom: 8px; }

/* Responsive cho Mobile/Tablet */
@media (max-width: 992px) {
    .gallery-modal-content { flex-direction: column; height: 90vh; width: 95%; margin-top: 25px; }
    .gallery-image-zone { flex: 1.5; min-height: 45vh; }
    .gallery-info-zone { flex: 1; padding: 25px; }
    .zoom-controls { bottom: 10px; padding: 8px 20px; }
}