/* Thiết lập chung và font */
body {
    font-family: 'sans-serif', Arial, sans-serif;
    margin: 0;
    background-color: #f8f8f8;
    color: #333;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-top: 60px;
}

/* --- Navigation Bar --- */
.navbar {
    background-color: #0F172B;
    padding: 15px 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed; 
    top: 0; /* Corresponds to 'top-0' */
    left: 0; /* Corresponds to 'left-0' */
    width: 100%; /* Corresponds to 'w-full' */
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05); /* Corresponds to 'shadow-lg'. This is a common box-shadow value for 'shadow-lg' in Tailwind. */
    z-index: 30; /* Corresponds to 'z-30' */
}
#mobile-menu {
    transition: transform 0.3s ease-in-out;
}
#mobile-menu-backdrop {
    transition: opacity 0.3s ease-in-out;
}
.logo {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

/* Style cho GỢI Ý MÓN ĂN trong navbar */
.logo-main-h1 {
    color: #FEA116; 
    font-size: 1.8em;
    font-weight: 800;
    font-family: 'Nunito', sans-serif; 
    margin: 0; 
}

/* --- Main Content --- */
.container {
    max-width: 1200px;
    width: 90%;
    margin: 30px auto;
    padding: 20px;
    flex-grow: 1;
}

/* Style cho Tiêu đề phụ (Pacifico Style) */
.pacific-title {
    font-family: 'Pacifico', cursive; 
    color: #f07b13; 
    font-weight: 400; 
    margin-top: 0;
}

/* Style cho tiêu đề chính H2 "Tủ lạnh nhà bạn còn gì?" */
h2.main-title {
    font-size: 1.5em;
    margin-bottom: 20px;
    border-bottom: 2px solid #FEA116; 
    padding-bottom: 5px;
}

/* --- Khu vực hiển thị Prompt để kiểm tra --- */
.prompt-display {
    margin-bottom: 20px; 
    padding: 15px; 
    border: 1px dashed #FEA116; 
    background-color: #fff3e0; /* Màu nền nhạt */
    font-size: 0.9em;
    word-wrap: break-word; /* Đảm bảo prompt dài không làm vỡ layout */
    font-family: monospace; /* Dùng font monospace để dễ đọc code/text */
    color: #333;
}
.prompt-display strong {
    color: #FEA116;
}
/* ------------------------------------------- */

/* --- Tag Pickers --- */
.tag-picker-group {
    display: grid;
    gap: 20px;
    margin-bottom: 30px;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); 
}

.picker-section {
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background-color: #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.picker-label {
    font-size: 1em;
    color: #f07b13;
    font-family: 'Pacifico', cursive;
    display: block;
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px dashed #eee;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}


.tag:hover {
    background-color: #81d8d0;
}

/* Màu và dấu check khi được chọn */
.tag.selected {
    background-color: #FEA116;
    color: #fff;
    border: 1px solid #f07b13;
    padding-right: 25px; 
}

.tag.selected::after {
    content: '\2713'; 
    font-weight: bold;
    font-size: 0.8em;
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
}

/* --- Textbox Thực phẩm khác --- */
.other-food-section {
            background-color: white;
            padding: 1rem;
            border-radius: 0.75rem;
            box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
            margin-bottom: 1.5rem;
}
.other-food-section:hover {
            box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}
#other-food {
    width: 100%;
    padding: 15px;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-sizing: border-box;
    font-size: 1rem;
    resize: vertical;
    font-family: 'Nunito';
    transition: border-color 0.3s;
}

/* --- Button Gợi Ý --- */
.suggest-button {
    width: auto;
    display: block; 
    margin: 0 auto 30px auto; 
    padding: 10px 20px;
    background-color: #FEA116;
    color: #fff;
    border: none;
    border-radius: 0;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease;
    min-width: 200px;
    position: relative;
    font-family: 'Nunito', sans-serif;
}

.suggest-button:hover {
    background-color: #e09012;
}

.suggest-button:disabled {
    background-color: #ccc;
    cursor: wait !important;
}

/* Loader cho button (spin) */
.loader {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #FEA116;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    animation: spin 1s linear infinite;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* --- Results Display --- */
.results-container {
    margin-top: 40px;
    border-top: 2px solid #FEA116;
    padding-top: 20px;
}

/* Áp dụng .pacific-title cho H3 Món Ăn Gợi Ý */
.results-container h3 {
    font-family: 'Pacifico', cursive; 
    color: #f07b13;
    font-weight: 400;
    font-size: 1.3em;
}

.dish-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px dotted #ccc;
    font-size: 1.1rem;
}

.dish-item:last-child {
    border-bottom: none;
}

.recipe-button {
    background-color: #597dde;
    color: #fff;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 0.9rem;
}

.recipe-button:hover {
    background-color: #4a6ac9;
}

/* --- Thanh tiến độ trong lúc chờ đợi --- */
#loading-bar-container {
    text-align: center;
    margin-bottom: 20px;
}

.progress-bar {
    width: 100%;
    background-color: #e0e0e0;
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress {
    height: 20px;
    width: 0%;
    background-color: #FEA116;
    transition: width 0.5s ease;
}

/* --- Popup Modal --- */

        .modal {
            display: none;
            position: fixed;
            z-index: 1000;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            overflow-y: auto;
            background-color: rgba(0,0,0,0.6);
            display: flex; /* Sử dụng flex để căn giữa */
            align-items: center;
            justify-content: center;
        }

        .auth-modal-content {
            max-width: 450px; 
        }
        .food-modal-content {
            max-width: 800px;
        }
        /* Thiết kế nút Đăng nhập xã hội mới (bo tròn toàn bộ) */
        .auth-button {
            transition: all 0.2s ease-in-out;
            padding: 12px 20px;
            /* Bo tròn toàn bộ (rounded-full) */
            border-radius: 9999px; 
            font-weight: 600;
            display: flex;
            align-items: center;
            justify-content: center;
            width: 100%;
            margin-bottom: 1rem;
            color: white; 
        }
        /* Căn chỉnh lại icon */
        .auth-button i {
            margin-right: 12px;
            font-size: 1.25rem;
        }
        /* Căn chỉnh lại icon Google SVG */
        .auth-button svg {
            margin-right: 12px;
        }

        .modal-content {
            background-color: #fff;
            padding: 30px;
            border-radius: 1rem;
            width: 95%; /* Responsive width */
            box-shadow: 0 10px 20px rgba(0,0,0,0.3);
            position: relative;
            margin: auto;
        }
        /* Tiêu đề nhóm */
        .category-manager-group h3 {
            font-size: 1.125rem;
            font-weight: 600;
            margin-top: 1.5rem;
            margin-bottom: 0.75rem;
            color: #374151;
            border-bottom: 2px solid #f3f4f6;
            padding-bottom: 4px;
        }

        /* Container cho Input và Button */
        .input-container {
            display: flex;
            gap: 8px;
            margin-bottom: 1rem;
        }

        .new-tag-input {
            flex-grow: 1;
            padding: 8px 12px;
            border: 1px solid #d1d5db;
            border-radius: 0.5rem;
            outline: none;
            transition: border-color 0.2s;
        }
        /* Focus input: Màu Tím */
        .new-tag-input:focus {
            border-color: #7c3aed; /* Violet 600 */
        }

        /* Nút Thêm Tag: Màu Tím */
        .btn-add-tag {
            padding: 8px 12px; /* Giảm padding ngang để trông vuông hơn */
            background-color: #7c3aed; /* Violet 600 */
            color: white;
            font-weight: 500;
            border-radius: 0.5rem;
            transition: background-color 0.2s;
            flex-shrink: 0;
            /* Căn giữa icon */
            display: flex;
            align-items: center;
            justify-content: center;
        }
        .btn-add-tag:hover {
            background-color: #6d28d9; /* Violet 700 */
        }

        /* VÙNG HIỂN THỊ TAGS */
        .tag-display-area {
            display: flex;
            flex-wrap: wrap; 
            gap: 8px;
            padding: 8px;
            border: 1px dashed #e5e7eb;
            border-radius: 0.5rem;
            min-height: 40px;
            margin-bottom: 15px;
        }

        /* Tag cơ bản (Áp dụng cho cả removable tags): Màu Tím Nhạt */
        .tag {
            display: inline-flex;
            align-items: center;
            background-color: #41cfa1; /* Violet 100 */
            color: #f5f3ff; /* Violet 600 */
            padding: 4px 10px;
            border-radius: 9999px;
            font-size: 0.875rem;
            cursor: pointer;
            transition: all 0.2s;
            white-space: nowrap; 
            font-weight: 500;
            box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
        }
        .tag:hover:not(.removable-tag) {
            background-color: #81d8d0; /* Violet 200 */
        }

        /* Tag có thể xóa (Giờ đây dùng màu Tím như tag bình thường) */
        .removable-tag {
            /* Kế thừa màu từ .tag (Violet 100/600) */
            /* Thêm hover để phân biệt */
            border: 1px solid #c4b5fd; /* Violet 300 */
        }
        .removable-tag:hover {
             background-color: #ff3333; /* Violet 200 */
        }
        
        /* Nút Xóa: Dùng màu Tím đậm để đồng nhất */
        .remove-tag-btn {
            margin-left: 8px;
            font-weight: bold;
            font-size: 1rem;
            cursor: pointer;
            line-height: 1;
            padding: 0 4px;
            color: #7c3aed; /* Violet 600 */
            opacity: 0.8;
            transition: opacity 0.2s;
        }
        .remove-tag-btn:hover {
            opacity: 1;
            color: #6d28d9; /* Violet 700 */
        }
        .tag-wrapper {
            display: flex;
            flex-wrap: wrap; 
            gap: 5px;
            padding: 8px;
            border: 1px dashed #e5e7eb;
            border-radius: 0.5rem;
            min-height: 40px;
            margin-bottom: 15px;

        }

        .close-button {
            position: absolute;
            top: 15px;
            right: 25px;
            font-size: 30px;
            font-weight: bold;
            color: #9ca3af;
            cursor: pointer;
            transition: color 0.2s;
        }
        .close-button:hover,
        .close-button:focus {
            color: #1f2937;
            text-decoration: none;
        }

        /* Nút Lưu: Giữ màu Xanh lá cho hành động chính */
        .btn-save-all {
            width: 100%;
            margin-top: 1.5rem;
            padding: 12px;
            background-color: #10b981;
            color: white;
            font-weight: bold;
            border-radius: 0.75rem;
            transition: background-color 0.2s;
        }
        .btn-save-all:hover {
            background-color: #059669;
        }
@keyframes animatetop {
    from {top: -300px; opacity: 0}
    to {top: 0; opacity: 1}
}


.modal-content h3 {
    color: #FEA116;
    margin-top: 0;
    font-family: 'Nunito', sans-serif;
    border-bottom: 2px solid #FEA116;
    padding-bottom: 10px;
    margin-bottom: 10px;
}

#modal-body {
    min-height: 100px; 
    margin-top: 0;
}

#modal-body h3 {
    color: #0F172B;
    border-left: 5px solid #FEA116;
    padding-left: 10px;
    margin-top: 20px;
}

#modal-body ul {
    list-style: disc inside;
    padding-left: 0;
}

#modal-body li {
    margin-bottom: 5px;
}

/* --- Footer --- */
.footer {
    background-color: #0F172B;
    color: #ccc;
    text-align: center;
    padding: 15px 0;
    font-size: 0.9em;
    width: 100%;
    box-sizing: border-box;
    margin-top: auto; 
}

.footer a {
    color: #FEA116;
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

/* --- Responsive Design (Ví dụ đơn giản) --- */
@media (max-width: 768px) {
    .navbar {
        padding: 10px 5%;
    }

    .logo {
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
    }
    .auth-controls { 
        display: flex; 
        align-items: center; 
        gap: 10px;
        margin-left: auto; /* Đẩy sang phải */
    }
    .logo-main-h1 {
        font-size: 1.5em;
    }

    .container {
        width: 95%;
        padding: 10px;
    }

    .tag-picker-group {
        grid-template-columns: 1fr; 
    }

    .suggest-button {
        font-size: 16px;
        padding: 8px 15px;
        min-width: 150px;
    }
    
    .prompt-display {
        font-size: 0.8em;
        padding: 10px;
    }
}
/* --- KENCHON Section --- */
.kenchon-section {
    width: 100%;
    text-align: center; /* Căn giữa văn bản */
    padding: 30px 0;
    margin-top: 40px; /* Tạo khoảng cách với nội dung chính */
    background-color: #ffffff; /* Màu nền trắng để nổi bật */
    border-top: 1px solid #eee;
}

.kenchon-section p {
    margin: 5px 0;
    line-height: 1.2;
    font-family: 'Coiny', cursive
}

/* Dòng 1: In đậm và màu cam */
.kenchon-line-1 {
    font-size: 1.8em;
    font-weight: normal; 
    color: #333;
}

/* Dòng 2: Kích thước nhỏ hơn, màu phụ */
.kenchon-line-2 {
    font-size: 1.1em;
    color: #333;
    font-weight: normal;
}
/* --- Định dạng màu cho các từ khóa "KEN", "CHON", "kenchon" --- */
.kenchon-section .color-word {
    color: #f07b13; /* Màu cam đậm */
}
/* Sửa đổi để chứa các nút trên cùng một dòng */
.dish-item .button-container {
    display: flex; /* Bật Flexbox để các nút nằm ngang hàng */
    gap: 10px; /* Khoảng cách giữa các nút */
    margin-left: auto; /* Đẩy button-container sang phải */
}

/* Định dạng chung cho nút Công thức (đã có) và nút Video (mới) */
.recipe-button, .video-button {
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s, opacity 0.2s;
    font-size: 0.9rem;
    text-decoration: none; /* Quan trọng cho thẻ <a> */
    display: inline-block; /* Quan trọng cho thẻ <a> để hoạt động như nút */
    text-align: center;
}

/* Định dạng nút Công thức (Màu #597dde) */
.recipe-button {
    background-color: #597dde; 
    color: #fff;
}

.recipe-button:hover {
    background-color: #4a6ac9; 
}

/* --- ĐỊNH DẠNG NÚT MỚI: Video Hướng Dẫn --- */
.video-button {
    background-color: #E62117; /* Màu đỏ YouTube */
    color: #fff;
}

.video-button:hover {
    background-color: #c41e15; /* Màu đỏ đậm hơn khi hover */
}

/* --- CSS CHO MODAL QUẢN LÝ THỰC PHẨM (manage-food-modal) --- */

/* Các quy tắc .modal và .modal-content đã có, nhưng tôi sẽ thêm 
   một số quy tắc chi tiết hơn cho nội dung modal mới */

.input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}
.input-group input {
    flex-grow: 1;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
}
.input-group button {
    padding: 10px 15px;
    background-color: #FEA116; /* Dùng màu cam chủ đạo */
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    /* Cố định chiều cao để khớp với input */
    height: 40px; 
    transition: background-color 0.2s;
}
.input-group button:hover {
    background-color: #e09012;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    min-height: 50px;
    background-color: #f9f9f9;
}

/* Định dạng cho Tags tùy chỉnh của người dùng */
.custom-tag {
    display: flex;
    align-items: center;
    background-color: #d1e7dd; /* Màu xanh nhạt để phân biệt */
    color: #0f5132;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.9em;
    border: 1px solid #badbcc;
    line-height: 1.2;
}

/* Nút Xóa (X) trên tags tùy chỉnh */
.status-message {
    margin-top: -10px;
    margin-bottom: 10px;
    padding: 5px 0;
    font-size: 0.9em;
    color: #dc3545; /* Mặc định là màu lỗi */
}

.status-message.success {
    color: #28a745; /* Màu xanh lá khi thành công */
}
/* Trong file CSS của bạn */
.recipe-text-pre {
    white-space: pre-wrap; /* Quan trọng: Đảm bảo văn bản ngắt dòng khi tràn */
    font-family: inherit;  /* Sử dụng font chữ chính của website */
    word-break: break-word; /* Đảm bảo từ dài không làm tràn */
}

/* Thêm vào file style.css của bạn */

/* Thêm vào file style.css của bạn */

header {
    display: flex;
    justify-content: space-between; 
    align-items: center;
    padding: 10px 20px;
    /* Đảm bảo header có chiều cao và căn chỉnh phù hợp */
}

/* --- Cấu Trúc Menu Chính --- */
.header-menu ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex; 
    gap: 20px; 
}

.header-menu ul li {
    position: relative; 
}

.header-menu ul li a {
    text-decoration: none;
    color: #333; 
    padding: 5px 10px;
    display: block;
}

/* --- Dropdown Menu --- */
.dropdown-menu {
    position: absolute;
    top: 100%; 
    right: 0; 
    background: #fff;
    border: 1px solid #ccc;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    min-width: 180px;
    z-index: 1000; /* Tăng z-index để chắc chắn hiển thị trên các thành phần khác */
    border-radius: 4px; /* Thêm bo góc cho đẹp mắt */
    
    /* ẨN MẶC ĐỊNH */
    /* display: none;   */
    opacity: 0;
    transition: opacity 0.2s ease;
    
    /* Điều chỉnh padding để phù hợp với nội dung là <div> và <a> */
    padding: 5px 0; 
}

.dropdown-menu.active {
    /* HIỂN THỊ KHI CLICK */
    display: block; /* Hiện menu */
    opacity: 1;
}

/* 🛑 SỬA LỖI: Dùng .dropdown-item (thẻ <a>) thay vì li a 🛑 */
/* Nếu HTML của bạn là <a> có class="dropdown-item" bên trong .dropdown-menu */
.dropdown-item {
    display: block; /* Bắt buộc để nó chiếm hết chiều rộng */
    padding: 10px 15px;
    color: #555;
    text-decoration: none; /* Xóa gạch chân */
    white-space: nowrap; 
    cursor: pointer;
}

.dropdown-item:hover {
    background-color: #f1f1f1;
}

/* Thêm style cho Header nếu có */
.dropdown-header {
    padding: 10px 15px;
    font-weight: bold;
    color: #333;
    border-bottom: 1px solid #eee; /* Đường kẻ phân cách */
    margin-bottom: 5px;
}
/* style.css */

/* --- Container cho Avatar và Tên (nếu có) --- */
#user-avatar {
    /* Đảm bảo container này hiển thị linh hoạt */
    display: flex;
    align-items: center;
    gap: 8px; /* Khoảng cách giữa ảnh và tên/menu */
}

/* --- Ảnh đại diện người dùng --- */
#user-photo {
    /* Xóa !important trừ khi có xung đột bắt buộc */
    width: 32px; 
    height: 32px;
    
    /* Làm cho ảnh tròn */
    border-radius: 50%; 
    object-fit: cover; 
    border: 2px solid #ccc; 
    transition: all 0.2s ease-in-out; /* Thêm hiệu ứng hover */
}

/* Định nghĩa kích cỡ chung cho Avatar (Giả định) */
.user-avatar {
    width: 40px;
    height: 40px;
    cursor: pointer;
}
#auth-dropdown-menu:hover #user-photo {
    border-color: #007bff; /* Thay đổi màu viền khi hover */
}

/* Định nghĩa style cho icon Đăng xuất trong menu */
.dropdown-item i.fa-sign-out-alt {
    font-size: 1.1rem; /* Kích cỡ icon */
    color: #dc3545;   /* Màu đỏ cho action Đăng xuất */
}

/* Nếu bạn chọn Tùy chọn 2 (Icon nổi bên ngoài) */
.logout-icon-floating {
    cursor: pointer;
    margin-left: 10px;
    padding: 5px;
    border-radius: 50%;
    /* Căn chỉnh kích thước để gần bằng avatar */
    width: 30px; 
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Có thể thêm background: #f8d7da; để nổi bật */
}
.logout-icon-floating i {
    font-size: 1.2rem;
    color: #dc3545; 
}
#auth-dropdown-menu {
    /* Đảm bảo container này hiển thị linh hoạt */
    display: flex;
    align-items: center;
    gap: 8px; /* Khoảng cách giữa ảnh và tên/menu */
    /* Quan trọng: Cho phép click để mở modal */
    cursor: pointer; 
}
.login_welcome {
    font-size: 1em;
    color: #9C27B0;
    font-family: 'Pacifico', cursive;
    display: block;
    margin-bottom: 10px;
    padding-bottom: 5px;

}
.login_header {
    font-size: 1.0rem;
    color: #9C27B0;
    font-family: 'Nunito', Arial;
    display: block;
    margin-bottom: 10px;
    padding-bottom: 5px;
}
        /* Tùy chỉnh màu sắc thương hiệu */
        .bg-facebook { background-color: #1877F2; }
        .hover\:bg-facebook-dark:hover { background-color: #1669D9; }
        /* 🛑 ĐÃ CẬP NHẬT: Màu Cam cho Google 🛑 */
        .bg-google-orange { background-color: #f7931e; } /* Màu cam nổi bật gần với mẫu */
        .hover\:bg-google-orange-dark:hover { background-color: #e6851b; } 

        /* Loading Overlay Styling (NEW) */
        .loading-overlay {
            position: absolute; top: 0; left: 0; width: 100%; height: 100%;
            background-color: rgba(255, 255, 255, 0.95);
            display: flex; flex-direction: column; justify-content: center; align-items: center;
            border-radius: 12px;
            text-align: center;
        }