/* ========================================= */
/* 1. GLOBAL STYLES (CƠ BẢN) */
/* ========================================= */
body {
    margin: 0;
    font-family: 'Poppins', 'Roboto', sans-serif;
    background-color: #dad3ca;
    color: #333;
    line-height: 1.6;
}

/* ========================================= */
/* 2. HEADER & NAVBAR LAYOUT */
/* ========================================= */
header {
    background-color: #ff9800 !important;
    padding: 10px 20px; /* Giảm padding một chút cho gọn */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    max-width: 1200px;
    margin: 0 auto;
    flex-wrap: nowrap; /* Mặc định PC không xuống dòng */
}

/* Các khối chính của Navbar */
.navbar-left,
.navbar-right {
    flex: 0 0 auto;
}

.navbar-center {
    flex: 1 1 auto; /* Co giãn linh hoạt */
    display: flex;
    justify-content: center;
    padding: 0 20px;
}

/* ========================================= */
/* 3. LOGO */
/* ========================================= */
.logo-link {
    text-decoration: none !important;
    color: inherit !important;
    display: flex;
    align-items: center;
}

.logo {
    font-size: 24px; /* Chỉnh lại size cho vừa vặn */
    font-weight: bold;
    color: #fff;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease;
    white-space: nowrap;
}

.logo:hover {
    transform: scale(1.05);
}

/* ========================================= */
/* 4. SEARCH BAR */
/* ========================================= */
/* 1. Container: Bỏ max-width cứng để nó linh hoạt theo input */
.search-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center; /* Căn giữa */
    width: auto; /* Để tự co giãn theo nội dung bên trong */
}

/* 2. Ô nhập liệu: Mặc định NGẮN */
.search-box {
    padding: 10px 20px;
    padding-right: 45px;
    border-radius: 50px;
    border: none;
    
    /* --- KHÔI PHỤC HIỆU ỨNG --- */
    width: 220px; /* Kích thước ban đầu nhỏ gọn */
    /* Thêm transition width để nó trượt ra từ từ */
    transition: width 0.4s ease-in-out, box-shadow 0.3s ease; 
    
    font-size: 14px;
    background-color: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* 3. Ô nhập liệu khi bấm vào: DÀI RA */
.search-box:focus {
    outline: none;
    width: 400px; /* Kích thước khi mở rộng hết cỡ */
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

/* Nút tìm kiếm (Giữ nguyên) */
.search-btn {
    position: absolute;
    right: 5px;
    background: linear-gradient(135deg, #ff9800, #ff5722);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.search-btn:hover {
    transform: scale(1.05);
    background: linear-gradient(135deg, #f57c00, #e64a19);
}

/* --- QUAN TRỌNG: MOBILE KHÔNG ĐƯỢC CO GIÃN --- */
/* Trên điện thoại, thanh tìm kiếm phải luôn full màn hình */
@media screen and (max-width: 768px) {
    .search-container {
        width: 100%; /* Container full */
    }
    
    .search-box {
        width: 100% !important; /* Input luôn full, không co nhỏ */
    }
    
    .search-box:focus {
        width: 100% !important; /* Khi focus vẫn giữ nguyên 100% */
    }
}
/* ========================================= */
/* 5. ICONS & USER MENU (ĐÃ CHUẨN HÓA) */
/* ========================================= */

/* Container chứa icon bên phải (User + Language) */
.navbar-right .icons {
    display: flex;
    align-items: center;    /* Căn giữa trục dọc */
    justify-content: flex-end;
    gap: 15px;              /* Khoảng cách đều */
    height: 100%;
}

/* Khung bao quanh từng nút (User, Lang, Menu trái) */
.user-menu, 
.language-menu,
.mini-menu-wrapper {
    position: relative !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    height: 40px;
    width: 40px;
    margin: 0 !important;
}

/* Bản thân cái Icon tròn */
.nav-icon {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    font-size: 1.1rem;
    color: white;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transition: all 0.3s ease;
    text-decoration: none;
    margin: 0 !important;
    cursor: pointer;
}

.nav-icon:hover {
    background-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
}

/* Buttons Login/Register */
.auth-buttons {
    display: flex;
    gap: 10px;
}

.auth-buttons button {
    padding: 8px 16px;
    border-radius: 50px;
    border: none;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 13px;
}

.auth-buttons button.login {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid white;
}

.auth-buttons button.register {
    background-color: white;
    color: #ff9800;
}

/* ========================================= */
/* 6. DROPDOWN MENUS (CHUNG VÀ RIÊNG) */
/* ========================================= */
.dropdown-menu {
    display: none; /* Ẩn mặc định */
    position: absolute;
    top: 100% !important;
    margin-top: 10px; /* Cách icon ra 1 chút */
    background-color: white;
    min-width: 200px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    border-radius: 8px;
    padding: 10px 0;
    z-index: 9999;
}

/* Class hiển thị (JS thêm vào) */
.dropdown-menu.show {
    display: block !important;
    animation: slideUp 0.2s ease;
}

/* Dropdown bên TRÁI (Menu 3 gạch) */
.dropdown-menu.right-dropdown {
    left: 0 !important;
    right: auto !important;
}
/* Mũi tên chỉ lên cho bên trái */
.dropdown-menu.right-dropdown::before {
    content: "";
    position: absolute;
    top: -6px;
    left: 15px;
    width: 12px; height: 12px;
    background: white;
    transform: rotate(45deg);
}

/* Dropdown bên PHẢI (User, Language) */
.dropdown-menu.left-dropdown,
.dropdown-menu.lang-dropdown {
    right: 0 !important;
    left: auto !important;
}
/* Mũi tên chỉ lên cho bên phải */
.dropdown-menu.left-dropdown::before,
.dropdown-menu.lang-dropdown::before {
    content: "";
    position: absolute;
    top: -6px;
    right: 15px;
    width: 12px; height: 12px;
    background: white;
    transform: rotate(45deg);
}

/* Style cho item bên trong menu */
.dropdown-menu a, 
.dropdown-menu button,
.mini-menu-item {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 10px 20px;
    text-decoration: none;
    color: #333;
    font-size: 14px;
    transition: background 0.2s;
    border: none;
    background: none;
    text-align: left;
    box-sizing: border-box;
}

.dropdown-menu a:hover, 
.dropdown-menu button:hover,
.mini-menu-item:hover {
    background-color: #f5f5f5;
    color: #ff9800;
}

.dropdown-menu i {
    width: 25px;
    text-align: center;
    margin-right: 5px;
    color: #666;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ========================================= */
/* 7. RESPONSIVE MOBILE (QUAN TRỌNG NHẤT) */
/* ========================================= */
@media screen and (max-width: 768px) {
    .navbar {
        flex-wrap: wrap; /* Cho phép rớt dòng */
        padding: 10px 5px !important;
    }

    /* 1. Nút Menu trái */
    .navbar-left {
        order: 1;
        flex: 0 0 auto;
    }

    /* 2. Logo (Căn giữa) */
    .logo-link {
        order: 2;
        flex-grow: 1;
        justify-content: center;
    }
    
    /* 3. Icon User/Cart (Phải) */
    .navbar-right {
        order: 3;
        flex: 0 0 auto;
    }

    /* 4. Thanh tìm kiếm (Xuống dòng dưới cùng) */
    .navbar-center {
        order: 4;
        width: 100%;
        margin-top: 15px;
        padding: 0;
    }
    
    .search-container {
        max-width: 100%; /* Full màn hình */
    }

    /* Dropdown trên mobile cố định giữa màn hình cho dễ bấm */
    .dropdown-menu {
        position: fixed !important;
        top: 60px !important;
        left: 5% !important;
        right: 5% !important;
        width: 90% !important;
        max-height: 70vh;
        overflow-y: auto;
    }
    
    /* Ẩn mũi tên trên mobile vì menu fixed */
    .dropdown-menu::before {
        display: none;
    }
}

/* ========================================= */
/* 8. FOOTER & OTHER SECTIONS */
/* ========================================= */
.section {
    padding: 50px 20px;
    background-color: #fff;
    margin: 40px auto;
    border-radius: 15px;
    max-width: 1200px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

.section h3 {
    margin-bottom: 40px;
    text-align: center;
    font-size: 32px;
    color: #333;
    position: relative;
    padding-bottom: 15px;
    font-weight: 700;
}

.section h3::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 4px;
    background: linear-gradient(90deg, #ff9800, #ff5722);
    border-radius: 4px;
}

footer {
    background-color: #333;
    color: #fff;
    padding: 50px 20px 20px;
    margin-top: 50px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto;
}

.footer-section h4 {
    font-size: 18px;
    margin-bottom: 20px;
    position: relative;
    padding-bottom: 10px;
}

.footer-section h4::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 50px;
    height: 3px;
    background-color: #ff9800;
    border-radius: 2px;
}

.footer-section p, .footer-section ul li a {
    color: #ccc;
    text-decoration: none;
    transition: all 0.3s ease;
}

.footer-section ul { list-style: none; padding: 0; }
.footer-section ul li { margin-bottom: 10px; }
.footer-section ul li a:hover { color: #ff9800; padding-left: 5px; }

.social-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-radius: 50%;
    margin-right: 10px;
    transition: all 0.3s ease;
    text-decoration: none;
}
.social-links a:hover {
    background-color: #ff9800;
    transform: translateY(-3px);
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 20px;
    margin-top: 40px;
    text-align: center;
    font-size: 14px;
}

/* ========================================= */
/* 9. UTILITIES (PROFILE, BANNER, IMG) */
/* ========================================= */
img, video { max-width: 100%; height: auto; }

.banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff3e0;
    padding: 40px 20px;
    border-radius: 12px;
    margin: 20px auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}
.banner button {
    background-color: #ff9800;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    color: white;
}
@media (max-width: 768px) {
    .banner { flex-direction: column; text-align: center; }
    .banner .text, .banner img { max-width: 100%; }
    .banner img { margin-top: 20px; }
}

.login-box {
    max-width: 400px;
    margin: 100px auto;
    padding: 30px;
    background-color: #fff3e0;
    border-radius: 10px;
    text-align: center;
}
.login-box input { width: 100%; padding: 10px; margin: 10px 0; box-sizing: border-box; }
.login-box button { width: 100%; padding: 10px; background-color: #4CAF50; color: white; border: none; border-radius: 6px; }

/* Django Messages */
.messages { text-align: center; margin-bottom: 15px; }
.messages .success { color: green; }
.messages .error { color: red; }