/* --- RESET & CẤU HÌNH CHUNG --- */
:root {
    --primary-color: #2b8cee;
    --bg-light: #f6f7f8;
    --bg-white: #ffffff;
    --text-dark: #101922;
    --text-gray: #6b7280;
    --danger-color: #ef4444;
    --border-color: #e5e7eb;
    --font-main: 'Manrope', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.5;
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; }

/* --- HEADER --- */
.main-header {
    background-color: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 1rem 2rem;
}

.header-wrapper {
    max-width: 100%;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-dark);
}

.logo-icon {
    width: 24px;
    color: var(--primary-color);
}

.main-nav {
    display: flex;
    gap: 1.5rem;
}

.main-nav a {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-gray);
    transition: color 0.2s;
}

.main-nav a:hover, .main-nav a.active {
    color: var(--primary-color);
}

/* Search Bar */
.search-container {
    flex: 1;
    max-width: 500px;
    display: flex;
    align-items: center;
    background-color: var(--bg-light);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
}

.search-container input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    margin-left: 0.5rem;
    font-size: 1rem;
}

/* Icons Action - ĐÃ SỬA ĐỂ CĂN CHỈNH THẺ A */
.user-actions {
    display: flex;
    gap: 0.75rem;
}

/* Áp dụng style chung cho cả button và thẻ a trong user-actions */
.user-actions button,
.user-actions a {
    background: transparent;
    border: none;
    cursor: pointer;
    width: 44px;
    height: 44px;
    border-radius: 0.5rem;
    
    /* Căn giữa icon */
    display: flex;
    align-items: center;
    justify-content: center;
    
    color: var(--text-dark); /* Đảm bảo màu icon đúng */
}

.user-actions button:hover,
.user-actions a:hover {
    background-color: var(--bg-light);
}
/*icon settings*/


/* --- MAIN LAYOUT (Grid) --- */
.container {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 2rem;
}

.main-layout {
    display: grid;
    grid-template-columns: 280px 1fr; /* Sidebar cố định 280px, còn lại là content */
    gap: 2rem;
}

/* --- SIDEBAR --- */
.sidebar-box {
    background: var(--bg-white);
    padding: 1rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
}

.sidebar-header {
    padding: 0 0.5rem 1rem;
}

.sidebar-header h3 { font-size: 1rem; font-weight: 700; }
.sidebar-header p { font-size: 0.875rem; color: var(--text-gray); }

.category-list li a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-dark);
    transition: background 0.2s;
}

.category-list li a:hover { background-color: var(--bg-light); }
.category-list li a.active {
    background-color: rgba(43, 140, 238, 0.1);
    color: var(--primary-color);
}

/* --- CONTENT AREA --- */
.hero-banner {
    background-image: linear-gradient(0deg, rgba(0,0,0,0.4) 0%, rgba(0,0,0,0) 40%), url('https://images.unsplash.com/photo-1483985988355-763728e1935b?q=80&w=2070&auto=format&fit=crop');
    background-size: cover;
    background-position: center;
    height: 320px;
    border-radius: 0.75rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 2rem;
    color: white;
    margin-bottom: 2rem;
}

.banner-content h1 { font-size: 2.5rem; margin-bottom: 0.5rem; }

/* Products Grid */
.section-title {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
}

.product-grid {
    display: grid;
    /* Tự động chia cột, mỗi cột tối thiểu 220px */
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.5rem;
}

.product-card {
    background: transparent;
    transition: transform 0.2s;
}

.product-card:hover .product-image img {
    transform: scale(1.05);
}

.product-image {
    position: relative;
    border-radius: 0.75rem;
    overflow: hidden;
    aspect-ratio: 3/4;
    margin-bottom: 0.75rem;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.badge {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: bold;
    color: white;
}

.badge.sale { background-color: var(--danger-color); }

.product-info h3 {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.price-box {
    display: flex;
    gap: 0.5rem;
    align-items: baseline;
}

.current-price {
    color: var(--primary-color);
    font-weight: 700;
}

.old-price {
    color: var(--text-gray);
    font-size: 0.875rem;
    text-decoration: line-through;
}

/* --- FOOTER --- */
.site-footer { background: var(--bg-white); border-top: 1px solid var(--border-color); margin-top: auto; padding-top: 3rem; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 2rem; margin-bottom: 2rem; }
.footer-col h4 { font-size: 0.875rem; font-weight: 600; margin-bottom: 1rem; }
.footer-col ul li { margin-bottom: 0.75rem; font-size: 0.875rem; color: var(--text-gray); }
.footer-bottom { border-top: 1px solid var(--border-color); padding: 1.5rem 0; font-size: 0.875rem; color: var(--text-gray); }

/* --- FIX FOOTER LOGO --- */
.footer-col .logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.footer-col .logo svg {
    width: 24px;
    height: 24px;
    color: var(--primary-color);
}
.footer-col .logo span {
    font-size: 1.25rem;
    font-weight: 700;
}

/* --- RESPONSIVE --- */
@media (max-width: 1024px) {
    .main-nav { display: none; }
}
@media (max-width: 768px) {
    .main-layout, .content-layout { grid-template-columns: 1fr; }
    .sidebar { display: none; }
    .search-container { display: none; }
    .filters-bar { flex-direction: column; align-items: stretch; }
    .header-wrapper { padding: 0 1rem; gap: 1rem; }
    .footer-grid { grid-template-columns: 1fr; gap: 1rem; }
}
/* =====================================================
   FIX LỖI MENU BỊ VỠ & LÀM ĐẸP (Final Version) và chỗ icon settings
   ===================================================== */

/* 1. KHUNG CHỨA */
.settings-dropdown {
    position: relative;
    display: inline-flex;
    align-items: center;
}

/* 2. NÚT CÀI ĐẶT TRÒN */
.settings-dropdown .settings-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dark);
    transition: all 0.3s ease;
}

.settings-dropdown:hover .settings-btn {
    background-color: #f3f4f6;
    color: var(--primary-color);
    transform: rotate(90deg);
}

/* 3. MENU ĐỔ XUỐNG */
.dropdown-menu {
    position: absolute;
    top: 140%;        /* Cách nút xa hơn chút cho thoáng */
    right: -10px;     /* Căn lùi lại chút */
    width: 260px;     /* Chiều rộng cố định */
    
    background: #ffffff;
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 16px; /* Bo góc to hơn cho sang */
    box-shadow: 0 20px 40px -5px rgba(0, 0, 0, 0.15);
    
    padding: 8px;
    z-index: 9999;
    
    /* Hiệu ứng */
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px) scale(0.95);
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1); /* Hiệu ứng nảy nhẹ */
}

/* Mũi tên */
.dropdown-menu::before {
    content: '';
    position: absolute;
    top: -6px;
    right: 24px;
    width: 12px;
    height: 12px;
    background: #ffffff;
    border-top: 1px solid rgba(0,0,0,0.08);
    border-left: 1px solid rgba(0,0,0,0.08);
    transform: rotate(45deg);
}

/* Hiện menu */
.settings-dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* 4. DÒNG MENU CON (FIX LỖI QUAN TRỌNG Ở ĐÂY) */
/* Dùng selector dài hơn để ghi đè cái width 44px cũ */
.user-actions .dropdown-menu .menu-item {
    width: 100% !important;   /* Bắt buộc rộng full menu */
    height: auto !important;  /* Chiều cao tự do */
    justify-content: flex-start !important; /* Căn trái */
    background: transparent;
    
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    
    color: var(--text-dark);
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s;
    white-space: nowrap; /* Không xuống dòng */
}

/* Icon trong menu */
.menu-item .material-symbols-outlined {
    font-size: 20px;
    color: #9ca3af;
    
    /* Box chứa icon */
    min-width: 32px; /* Cố định kích thước box icon */
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f3f4f6;
    border-radius: 8px;
    transition: all 0.2s;
}

/* Hover effect */
.menu-item:hover {
    background-color: #f0f9ff !important; /* Xanh nhạt */
    color: var(--primary-color);
    padding-left: 20px !important; /* Hiệu ứng trượt nhẹ sang phải */
}

.menu-item:hover .material-symbols-outlined {
    background-color: #ffffff;
    color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(43, 140, 238, 0.2);
}

/* Dòng kẻ */
.divider {
    height: 1px;
    background: #f3f4f6;
    margin: 6px 0;
}

/* Nút Đăng xuất */
.menu-item.logout {
    color: #6b7280;
    margin-top: 4px;
}
.menu-item.logout:hover {
    background-color: #fef2f2 !important;
    color: #ef4444;
}
.menu-item.logout .material-symbols-outlined {
    background-color: #fee2e2;
    color: #ef4444;
}
.menu-item.logout:hover .material-symbols-outlined {
    background-color: #ef4444;
    color: white;
}