/* Reset CSS cơ bản */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Arial, sans-serif;
}

body {
    background-color: #f4f6f9;
    color: #333;
    line-height: 1.6;
}

header {
    color: #fff;
    padding: 1.5rem 0;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

header nav ul {
    list-style: none;
    margin-top: 15px;
}

header nav ul li {
    display: inline;
    margin: 0 15px;
}

header nav ul li a {
    color: #fff;
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 500;
}

header nav ul li a:hover {
    text-decoration: underline;
}

main {
    padding: 30px 20px;
    max-width: 1000px;
    margin: 0 auto;
    min-height: calc(100vh - 200px);
}

.product-list {
    background: #fff;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.product-list h2 {
    margin-bottom: 20px;
    color: #444;
    display: inline-block;
    padding-bottom: 5px;
}

#products-container {
    display: grid;
    grid-template-columns: repeat(4, minmax(250px, 1fr));
    gap: 20px;
}

.product-item {
    border: 1px solid #eaeaea;
    padding: 20px;
    border-radius: 8px;
    transition: transform 0.2s, box-shadow 0.2s;
    background-color: #fcfcfc;
}

.product-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
}

.product-item h3 {
    color: #007bff;
    margin-bottom: 10px;
}

.product-item button {
    margin-top: 15px;
    padding: 8px 15px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    width: 100%;
}

.product-item button:hover {
    background-color: #0056b3;
}

footer {
    text-align: center;
    padding: 20px;
    background: #343a40;
    color: #fff;
    margin-top: 20px;
}

.header-chinh {
    background: #ffffff;
    height: 70px;
    width: 100%;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

body {
    padding-top: 70px;
}

.header-container {
    width: 100%;
    max-width: 1280px;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Logo */
.logo-area img {
    height: 40px;
}

/* Search Area */
.search-area {
    flex: 1;
    max-width: 500px;
    margin: 0 40px;
}

.form-tim-kiem {
    position: relative;
    width: 100%;
}

.form-tim-kiem input {
    width: 100%;
    height: 40px;
    padding: 0 50px 0 20px;
    border-radius: 99px;
    border: 1px solid #e2e8f0;
    background-color: #f8fafc;
    outline: none;
    transition: all 0.2s;
    font-size: 14px;
}

.form-tim-kiem input:focus {
    background-color: #fff;
    border-color: #cbd5e1;
    box-shadow: 0 0 0 3px rgba(100, 116, 139, 0.1);
}

.form-tim-kiem button {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.form-tim-kiem button:hover {
    color: #4f46e5;
    background-color: #eef2ff;
}

/* User Area & Dropdown */
.user-area {
    position: relative;
    display: flex;
    align-items: center;
}

.tai-khoan-wrap {
    position: relative;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    transition: background 0.2s;
}

.tai-khoan-wrap:hover {
    background-color: #f1f5f9;
}

.avatar-nho {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    border: 2px solid #e2e8f0;
}

/* Dropdown Menu Styles */
.dropdown-menu-user {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: 280px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    border: 1px solid #f1f5f9;
    padding: 8px 0;

    /* Mặc định ẩn */
    display: none;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.dropdown-menu-user.hien-thi {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

/* User Header inside dropdown */
.user-info-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    border-bottom: 1px solid #f1f5f9;
    background-color: #fcfcfc;
    border-radius: 12px 12px 0 0;
    margin-bottom: 4px;
    text-decoration: none;
    transition: background-color 0.2s;
}

.user-info-header:hover {
    background-color: #f8fafc;
}

.avatar-lon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.user-text {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ten-user {
    font-weight: 700;
    color: #1e293b;
    font-size: 15px;
}

.ten-day-du {
    font-size: 13px;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Menu List */
.danh-sach-menu {
    list-style: none;
    padding: 0 8px;
    margin: 0;
}

.danh-sach-menu li {
    margin-bottom: 2px;
}

.danh-sach-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    color: #334155;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s;
}

.danh-sach-menu a:hover {
    background-color: #f1f5f9;
    color: #4f46e5;
}

.icon-ke {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    transition: color 0.2s;
}

.danh-sach-menu a:hover .icon-ke {
    color: #4f46e5;
}

.danh-sach-menu a:hover .fas.fa-location-dot,
.danh-sach-menu a:hover .fas.fa-heart,
.danh-sach-menu a:hover .fas.fa-shopping-cart {
    color: #4f46e5;
}

.danh-sach-menu .dang-xuat {
    color: #ef4444;
}

.danh-sach-menu a:hover .fas.fa-sign-out-alt {
    color: #ef4444;
}

.danh-sach-menu li.border-top {
    border-top: 1px solid #f1f5f9;
    margin-top: 4px;
    padding-top: 4px;
}

.auth-links {
    display: flex;
    gap: 12px;
}

.btn-login,
.btn-register {
    padding: 8px 16px;
    border-radius: 99px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-login {
    color: #334155;
}

.btn-login:hover {
    color: #4f46e5;
    background-color: #f1f5f9;
}

.btn-register {
    background-color: #4f46e5;
    color: white;
}

.btn-register:hover {
    background-color: #4338ca;
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.2);
}

@media (max-width: 768px) {
    .search-area {
        display: none;
    }
}

.search-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    max-height: 480px;
    overflow-y: auto;
    z-index: 1000;
}

.search-loading {
    padding: 20px;
    text-align: center;
    color: #667eea;
    font-size: 14px;
}

.search-items {
    padding: 8px;
}

.search-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
    text-decoration: none;
    color: #333;
    transition: all 0.2s ease;
    align-items: center;
}

.search-item:hover {
    background: #f6f8ff;
}

.search-item-image {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    background: #f5f5f5;
}

.search-item-info {
    flex: 1;
    min-width: 0;
}

.search-item-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-item-price {
    display: flex;
    gap: 8px;
    align-items: center;
    font-size: 14px;
}

.search-item-price-sale {
    color: #f97316;
    font-weight: 600;
}

.search-item-price-original {
    color: #999;
    text-decoration: line-through;
    font-size: 12px;
}

.search-empty {
    padding: 40px 20px;
    text-align: center;
    color: #999;
}

.search-empty i {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.3;
}

.search-empty p {
    margin: 0;
    font-size: 14px;
}

.search-highlight {
    background: #fef3c7;
    font-weight: 600;
}

/* ========== Footer ========== */
.site-footer {
    background: var(--gray-900, #111827);
    color: var(--gray-300, #d1d5db);
    margin-top: 80px;
}

.footer-bottom {
    border-top: 1px solid var(--gray-800, #1f2937);
    padding: 24px;
    text-align: center;
    font-size: 0.9rem;
    color: var(--gray-500, #6b7280);
}