﻿/* Basic Reset & Box-Sizing */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 14px;
    height: 100%; /* Đảm bảo thẻ html chiếm toàn bộ chiều cao */
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    line-height: 1.5;
    color: #333; /* Default text color */
    min-height: 100vh; /* Đảm bảo body chiếm ít nhất toàn bộ chiều cao viewport */
    display: flex; /* Kích hoạt Flexbox trên body */
    flex-direction: column; /* Sắp xếp các phần tử con theo chiều dọc (header, main, footer) */
    margin: 0; /* Xóa margin mặc định của body */
    padding: 0; /* Xóa padding mặc định của body */
    width: 100vw; /* Đảm bảo body chiếm toàn bộ chiều rộng viewport */
    overflow-x: hidden; /* Ngăn chặn thanh cuộn ngang không mong muốn */
}

/* Focus styles for interactive elements (from Bootstrap integration) */
.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

/* ==========================================================================
    HEADER STYLES
========================================================================== 
*/

.icon {
    width: 1.5rem; /* 24px */
    height: 1.5rem; /* 24px */
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.icon-sm {
    width: 1rem; /* 16px */
    height: 1rem; /* 16px */
}

/* Cài đặt chung cho Header */
.main-header {
    background-color: white;
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-container {
    max-width: 80rem; /* max-w-7xl */
    margin-left: auto;
    margin-right: auto;
    padding: 0 1rem; /* px-4 */
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 4rem; /* h-16 */
}

/* Logo */
.brand-link {
    display: flex;
    align-items: center;
    gap: 0.5rem; /* space-x-2 */
    text-decoration: none;
}

.brand-icon {
    height: 2rem; /* h-8 */
    width: 2rem; /* w-8 */
    color: #8b5cf6; /* text-purple-600 */
}

.brand-name {
    font-size: 1.5rem; /* text-2xl */
    font-weight: bold;
    color: #111827; /* text-gray-900 */
}


/* Điều hướng */
.main-nav {
    display: none; /* Ẩn mặc định, hiển thị trên màn hình lớn */
}

    .main-nav a {
        color: #374151; /* text-gray-700 */
        transition: color 0.2s;
        text-decoration: none;
    }

        .main-nav a:hover {
            color: #8b5cf6; /* hover:text-purple-600 */
        }

/* Các nút hành động bên phải */
.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem; /* space-x-4 */
}

.cart-link {
    position: relative;
    padding: 0.5rem;
    color: #374151; /* text-gray-700 */
}

    .cart-link:hover {
        color: #8b5cf6; /* hover:text-purple-600 */
    }

.cart-count {
    position: absolute;
    top: -0.25rem;
    right: -0.25rem;
    background-color: #8b5cf6; /* bg-purple-600 */
    color: white;
    font-size: 0.75rem; /* text-xs */
    border-radius: 9999px; /* rounded-full */
    height: 1.25rem; /* h-5 */
    width: 1.25rem; /* w-5 */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Menu người dùng */
.user-menu {
    position: relative;
}

.user-menu-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border-radius: 0.5rem; /* rounded-lg */
    background: none;
    border: none;
    cursor: pointer;
}

    .user-menu-button:hover {
        background-color: #f3f4f6; /* hover:bg-gray-100 */
    }

.user-avatar {
    height: 2rem;
    width: 2rem; /* h-8 w-8 */
    border-radius: 9999px; /* rounded-full */
    object-fit: cover;
}

.user-menu-dropdown {
    display: none; /* Ẩn mặc định */
    position: absolute;
    right: 0;
    margin-top: 0.5rem;
    width: 12rem; /* w-48 */
    background-color: white;
    border-radius: 0.5rem; /* rounded-lg */
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    border: 1px solid #e5e7eb; /* border-gray-200 */
    padding: 0.5rem 0;
}

    .user-menu-dropdown a,
    .user-menu-dropdown button {
        display: flex;
        align-items: center;
        gap: 0.5rem; /* space-x-2 */
        padding: 0.5rem 1rem;
        color: #374151; /* text-gray-700 */
        text-decoration: none;
        width: 100%;
        text-align: left;
        background: none;
        border: none;
        cursor: pointer;
    }

        .user-menu-dropdown a:hover,
        .user-menu-dropdown button:hover {
            background-color: #f3f4f6; /* hover:bg-gray-100 */
        }

.logout-btn {
    color: #dc2626; /* text-red-600 */
}

    .logout-btn:hover {
        background-color: #fef2f2; /* hover:bg-red-50 */
    }

.signin-btn {
    background-color: #8b5cf6;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    text-decoration: none;
}

    .signin-btn:hover {
        background-color: #7c3aed;
        color: white;
    }

/* Nút menu di động */
.mobile-menu-button {
    padding: 0.5rem;
    color: #374151;
    display: block; /* Hiển thị mặc định */
    cursor: pointer;
    background: none;
    border: none;
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(139, 92, 246, 0.1);
    transition: color 0.2s ease;
}

    .mobile-menu-button:hover,
    .mobile-menu-button:active {
        color: #8b5cf6;
    }

    .mobile-menu-button .icon {
        pointer-events: none;
    }

.mobile-menu {
    display: none; /* Ẩn mặc định */
    border-top: 1px solid #e5e7eb;
    padding: 1rem 0;
    background: white;
    width: 100%;
    position: relative;
    z-index: 50;
    left: 0;
    right: 0;
}

    .mobile-menu-content {
        padding: 0;
        max-height: calc(100vh - 80px);
        overflow-y: auto;
    }

    .mobile-menu-item {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        padding: 0.875rem 1.25rem;
        color: #374151;
        text-decoration: none;
        font-size: 0.95rem;
        font-weight: 500;
        transition: all 0.2s ease;
        cursor: pointer;
        user-select: none;
        -webkit-tap-highlight-color: rgba(139, 92, 246, 0.1);
        border: none;
        background: none;
        width: 100%;
        text-align: left;
    }

        .mobile-menu-item:hover,
        .mobile-menu-item:active {
            color: #8b5cf6;
            background-color: #f3f4f6;
        }

        .mobile-menu-item .icon-sm {
            flex-shrink: 0;
        }

    .mobile-menu-divider {
        margin: 0.5rem 0;
        border: 0;
        border-top: 1px solid #e5e7eb;
    }

    .mobile-menu-form {
        margin: 0;
    }

    .logout-btn-mobile {
        color: #dc2626;
    }

        .logout-btn-mobile:hover,
        .logout-btn-mobile:active {
            color: #991b1b;
            background-color: #fee2e2;
        }

/* Responsive cho Header */
.desktop-only {
    display: flex !important;
}

.mobile-only {
    display: none !important;
}

@media (max-width: 767px) {
    .desktop-only {
        display: none !important;
    }

    .mobile-only {
        display: flex !important;
    }
}

@media (min-width: 768px) { /* md breakpoint */
    .main-nav {
        display: flex;
        align-items: center;
        gap: 2rem; /* space-x-8 */
    }

    .search-container {
        display: block;
    }

    .mobile-menu-button {
        display: none;
    }

    .mobile-menu {
        display: none !important;
    }

    #user-name-desktop {
        display: block;
    }
}

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

    #user-name-desktop {
        display: none;
    }
}

/* ==========================================================================
    MAIN CONTENT & FOOTER STYLES
========================================================================== 
*/

.main-content-area {
    flex-grow: 1; /* Allow main content to fill available space */
    padding-bottom: 3rem; /* Add padding at the bottom of the main area */
}

.main-footer {
    background-color: #1f2937; /* gray-800 */
    color: #d1d5db; /* gray-300 */
    padding: 2rem 0 1rem; 
    width: 100%;
}

.max-width-container {
    max-width: 80rem;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Social Section */
.footer-social-section {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #374151;
    margin-bottom: 1.5rem;
}

.footer-social-label {
    color: #fff;
    font-weight: 600;
    font-size: 1rem;
}

.footer-social-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.footer-social-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: 1px solid #4b5563;
    border-radius: 0.375rem;
    color: #d1d5db;
    text-decoration: none;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.footer-social-btn:hover {
    border-color: #a78bfa;
    color: #a78bfa;
    background-color: rgba(167, 139, 250, 0.1);
}

.footer-social-btn svg {
    flex-shrink: 0;
}

/* Main Footer Content */
.footer-main-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #374151;
}

@media (min-width: 768px) {
    .footer-main-content {
        flex-direction: row;
        align-items: flex-start;
        gap: 1.5rem;
    }
}

.footer-brand-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex-shrink: 0;
}

.footer-brand-logo-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.footer-brand-icon {
    height: 2.5rem;
    width: 2.5rem;
    color: #a78bfa;
}

.footer-brand-name {
    font-size: 1.5rem;
    font-weight: bold;
    color: #fff;
}

.footer-description {
    color: #9ca3af;
    line-height: 1.5;
    max-width: 400px;
    font-size: 0.875rem;
}

/* Footer Info Section */
.footer-info-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.footer-info-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #d1d5db;
    font-size: 0.875rem;
}

.footer-info-item svg {
    flex-shrink: 0;
    color: #a78bfa;
}

/* Footer Bottom Bar */
.footer-bottom-bar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding-top: 1.5rem;
    text-align: center;
}

@media (min-width: 768px) {
    .footer-bottom-bar {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        text-align: left;
    }
}

.footer-copyright {
    color: #9ca3af;
    font-size: 0.875rem;
    margin: 0;
}

.footer-policy-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem 1.5rem;
}

@media (min-width: 768px) {
    .footer-policy-links {
        justify-content: flex-end;
    }
}

.footer-policy-link {
    color: #9ca3af;
    text-decoration: none;
    font-size: 0.8rem;
    transition: color 0.2s ease;
}

.footer-policy-link:hover {
    color: #a78bfa;
}

/* Footer Company Info */
.footer-company-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.footer-company-name {
    color: #fff;
    font-weight: 600;
    font-size: 1rem;
    margin: 0;
}

.footer-company-detail {
    color: #9ca3af;
    font-size: 0.8rem;
    line-height: 1.5;
    margin: 0;
}

.footer-company-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 2rem;
    margin: 0.25rem 0;
}

/* --- Notification Menu Styles --- */
.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem; /* Tạo khoảng cách giữa các icon */
}

.notification-menu {
    position: relative;
}

.notification-button {
    position: relative;
    background: none;
    border: none;
    cursor: pointer;
    color: #333; /* Màu icon */
    padding: 0;
    display: flex;
    align-items: center;
}

    .notification-button .icon {
        width: 24px;
        height: 24px;
    }

.notification-count {
    position: absolute;
    top: -5px;
    right: -8px;
    background-color: #ef4444; /* red-500 */
    color: white;
    border-radius: 9999px;
    padding: 0.1rem 0.4rem;
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 1;
    border: 2px solid white; /* Giúp nổi bật trên nền header */
}

.notification-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 360px;
    background-color: white;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    border: 1px solid #e5e7eb; /* gray-200 */
    z-index: 50;
    overflow: hidden;
}

.notification-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e5e7eb;
    font-weight: 600;
}

.mark-all-read-btn {
    background: none;
    border: none;
    color: #6366f1; /* indigo-500 */
    font-size: 0.8rem;
    cursor: pointer;
    font-weight: 500;
}

    .mark-all-read-btn:hover {
        text-decoration: underline;
    }

.notification-list {
    max-height: 400px;
    overflow-y: auto;
}

/* Apply styles directly to the .notification-item if it's an <a> tag */
.notification-item.unread,
.notification-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f3f4f6; /* gray-100 */
    cursor: pointer;
    transition: background-color 0.2s;
    text-decoration: none; /* Remove underline for all notification items */
    color: inherit; /* Inherit color from parent for all notification items */
}


    .notification-item:hover {
        background-color: #f9fafb; /* gray-50 */
    }

    .notification-item.unread {
        background-color: #eff6ff; /* blue-50 */
    }

.notification-content {
    flex-grow: 1;
}

.notification-message {
    margin: 0;
    font-size: 0.9rem;
    color: #111827; /* gray-900 */
}

.notification-time {
    font-size: 0.75rem;
    color: #6b7280; /* gray-500 */
}

.unread-dot {
    width: 8px;
    height: 8px;
    background-color: #3b82f6; /* blue-500 */
    border-radius: 50%;
    margin-left: 1rem;
    flex-shrink: 0;
}

.no-notifications {
    text-align: center;
    padding: 2rem 1rem;
    color: #6b7280;
}

.notification-footer {
    text-align: center;
    padding: 0.75rem;
    border-top: 1px solid #e5e7eb;
}

    .notification-footer a {
        color: #6366f1;
        font-weight: 600;
        text-decoration: none;
    }

        .notification-footer a:hover {
            text-decoration: underline;
        }

/* Product Grid Image Styles - Show full product without cropping */
.product-grid-image-container {
    position: relative;
    overflow: hidden;
}

.product-grid-image-wrapper {
    width: 100%;
    height: 380px; /* Increased height to show full product */
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f3f4f6;
    overflow: hidden;
}

.product-grid-image {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Always show full image without cropping */
    object-position: center;
    transition: transform 300ms ease-in-out;
}

.product-grid-image-container:hover .product-grid-image {
    transform: scale(1.05);
}

/* Desktop: Increase height for better proportions */
@media (min-width: 768px) {
    .product-grid-image-wrapper {
        height: 420px; /* Taller on desktop to accommodate full-body fashion images */
    }
}