/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: "Montserrat", sans-serif;
    background-color: #f5f5f5;
    color: #333;
    overflow-x: hidden;
}

/* Loading Spinner */
.page-loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.3s ease;
}

.page-loading.hidden {
    opacity: 0;
    pointer-events: none;
}

.spinner-container {
    display: flex;
    justify-content: center;
    align-items: center;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Header */
.header {
    background: linear-gradient(to right, #0c6eff, #ea8cde);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    border-radius: 0 0 8px 8px;
    z-index: 1000;
}

.navbar {
    padding: 0.8rem 0;
}

.navbar-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: white !important;
    transition: transform 0.3s ease;
}

.navbar-brand:hover {
    transform: scale(1.05);
}

/* Search Form */
.search-group {
    width: 400px;
    display: flex;
    align-items: center;
}

.search-icon-button {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    background: none;
    border: none;
    padding: 0 15px;
    cursor: pointer;
    z-index: 10;
    transition: opacity 0.3s ease;
}

.search-icon-button:hover {
    opacity: 0.7;
}

.search-icon {
    width: 20px;
    height: 20px;
}

.search-input {
    width: 100%;
    padding: 10px 50px 10px 45px;
    border: none;
    border-radius: 25px;
    background-color: white;
    outline: none;
    transition: all 0.3s ease;
}

.search-input:focus {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3);
}

.search-icon-mobile {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    transition: transform 0.3s ease;
}

.search-icon-mobile:hover {
    transform: scale(1.1);
}

.mobile-search-form {
    background: white;
    padding: 10px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: none;
}

.mobile-search-form.active {
    display: block;
}

/* Main Content */
.main-content {
    margin-top: 90px;
    padding: 20px 0;
    min-height: calc(100vh - 90px);
}

/* Sidebar - Categories */
.left-col {
    position: sticky;
    top: 100px;
    z-index: 100;
    height: fit-content;
}

.left-col-container {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    max-height: 85vh;
    overflow-y: auto;
    scrollbar-width: thin;
}

.left-col-container::-webkit-scrollbar {
    width: 6px;
}

.left-col-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.left-col-container::-webkit-scrollbar-thumb {
    background: #aaa;
    border-radius: 10px;
}

.left-col-container::-webkit-scrollbar-thumb:hover {
    background: #888;
}

.category-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 15px;
    color: #333;
    border-bottom: 2px solid #007bff;
    padding-bottom: 10px;
}

.category-item {
    position: relative;
    padding: 12px 10px;
    margin-bottom: 5px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.category-item:hover {
    background-color: #f0f8ff;
}

.category-item.active {
    background-color: #e6f2ff;
    font-weight: 600;
}

.category-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.category-item a {
    color: #333;
    text-decoration: none;
    font-size: 14px;
    flex: 1;
}

.category-item:hover a,
.category-item.active a {
    color: #007bff;
}

.category-submenu {
    display: none;
    position: absolute;
    left: 100%;
    top: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 15px;
    min-width: 200px;
    z-index: 1001;
    margin-left: 10px;
}

.category-item:hover .category-submenu {
    display: block;
}

.submenu-item {
    padding: 8px 10px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.submenu-item:hover {
    background-color: #f5f5f5;
}

.submenu-item a {
    color: #555;
    text-decoration: none;
    font-size: 13px;
    display: block;
}

.submenu-item:hover a {
    color: #007bff;
}

/* Filter Navbar */
.filter-navbar {
    display: flex;
    gap: 20px;
    padding: 15px 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.filter-navbar::-webkit-scrollbar {
    height: 5px;
}

.filter-navbar::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.filter-navbar::-webkit-scrollbar-thumb {
    background: #aaa;
    border-radius: 10px;
}

.filter-link {
    text-decoration: none;
    color: #666;
    padding: 8px 16px;
    border-radius: 20px;
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 14px;
}

.filter-link:hover {
    color: #007bff;
    background-color: #f0f8ff;
}

.filter-link.active {
    color: white;
    background-color: #007bff;
    font-weight: 600;
}

/* Products Grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    padding: 10px 0;
}

.product-item {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    cursor: pointer;
}

.product-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.product-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.product-image {
    position: relative;
    width: 100%;
    padding-top: 100%;
    overflow: hidden;
    background-color: #f9f9f9;
}

.product-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.product-item:hover .product-image img {
    transform: scale(1.05);
}

.product-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: linear-gradient(135deg, #ff6b6b, #ee5a6f);
    color: white;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 600;
    z-index: 10;
}

.product-info {
    padding: 15px;
}

.product-title {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin-bottom: 10px;
    height: 40px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.4;
}

.product-price {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.current-price {
    font-size: 16px;
    font-weight: 700;
    color: #ee5a6f;
}

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

.product-platform {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 15;
}

.platform-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.platform-shopee {
    background: linear-gradient(to right, #fff3cd, #ff8752);
    color: #d63031;
}

.platform-lazada {
    background: #d7d5fd;
    color: #5945d5;
}

.platform-tiki {
    background: #d1e7ff;
    color: #0b74e5;
}

/* Voucher Image Background */
.product-item.voucher-item .product-image {
    background: linear-gradient(135deg, #ff9966 0%, #ff5e62 100%);
}

/* Voucher Info */
.voucher-info {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #f0f0f0;
}

.voucher-code {
    display: none;
}

.voucher-expiry {
    display: block;
    font-size: 11px;
    color: #999;
    margin-top: 4px;
}

/* Product Inventory */
.product-inventory {
    margin-top: 6px;
}

.inventory-text {
    font-size: 12px;
    color: #666;
    background: #f8f9fa;
    padding: 3px 8px;
    border-radius: 4px;
}

/* Product Actions */
.product-actions {
    position: absolute;
    bottom: 10px;
    left: 10px;
    right: 10px;
    display: flex;
    gap: 8px;
    z-index: 20;
}

.claim-btn,
.share-btn {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    text-decoration: none;
}

.claim-btn {
    flex: 1;
    color: #28a745;
    border-color: #28a745;
}

.claim-btn:hover {
    background: #28a745;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.share-btn {
    color: #007bff;
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    flex-shrink: 0;
}

.share-btn:hover {
    background: #007bff;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.claim-btn:active,
.share-btn:active {
    transform: translateY(0);
}

.claim-btn svg,
.share-btn svg {
    flex-shrink: 0;
}

.product-item {
    position: relative;
}

/* Empty State */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 8px;
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.empty-state h3 {
    font-size: 1.5rem;
    color: #555;
    margin-bottom: 10px;
}

.empty-state p {
    color: #888;
    font-size: 14px;
}

/* Mobile Category Button */
.category-bottom-mobile {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999;
}

.btn-category-mobile {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 25px;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.btn-category-mobile:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 123, 255, 0.5);
}

.btn-category-mobile span {
    font-size: 1.2rem;
}

/* Category Popup */
.category-popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    overflow-y: auto;
}

.category-popup.active {
    display: block;
}

.category-popup-content {
    position: relative;
    background-color: #fff;
    margin: 5% auto;
    padding: 25px;
    width: 90%;
    max-width: 400px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close-popup {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    color: #333;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close-popup:hover {
    color: #ff0000;
}

.category-list-mobile {
    margin-top: 15px;
}

.category-item-mobile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.category-item-mobile:hover {
    background-color: #f5f5f5;
}

.category-item-mobile .arrow {
    margin-left: auto;
    font-size: 1.5rem;
    color: #999;
}

.submenu-mobile {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    padding: 25px;
    border-radius: 12px;
}

.btn-back {
    background: none;
    border: none;
    color: #007bff;
    font-size: 16px;
    cursor: pointer;
    margin-bottom: 15px;
    padding: 5px 0;
}

.submenu-title {
    font-weight: 600;
    margin-bottom: 15px;
    color: #333;
}

.submenu-item-mobile {
    padding: 12px 10px;
    border-bottom: 1px solid #f0f0f0;
}

.submenu-item-mobile a {
    color: #555;
    text-decoration: none;
    font-size: 14px;
}

.submenu-item-mobile:hover {
    background-color: #f9f9f9;
}

.submenu-item-mobile:hover a {
    color: #007bff;
}

/* Toast Notification */
.custom-toast {
    position: fixed;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 500;
    z-index: 10000;
    transition: bottom 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 8px;
}

.custom-toast.show {
    bottom: 30px;
}

.custom-toast-success {
    background: linear-gradient(135deg, #4caf50, #45a049);
}

.custom-toast-error {
    background: linear-gradient(135deg, #f44336, #e53935);
}

.custom-toast-info {
    background: linear-gradient(135deg, #2196f3, #1976d2);
}

/* Notification Permission Button in Header */
.notification-btn-header {
    display: none;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #FF6B6B, #FF8E53);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    margin-left: 12px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.4);
    transition: all 0.3s ease;
    position: relative;
    animation: pulseNotification 2s ease-in-out infinite;
}

/* Hiệu ứng nhấp nháy to nhỏ */
@keyframes pulseNotification {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 2px 8px rgba(255, 107, 107, 0.4);
    }
    50% {
        transform: scale(1.15);
        box-shadow: 0 4px 15px rgba(255, 107, 107, 0.7);
    }
}

.notification-btn-header:hover {
    animation: none;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.6);
}

.notification-btn-header:active {
    transform: scale(0.95);
}

.notification-btn-header:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    animation: none;
}

.notification-btn-header svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Trạng thái đã subscribe - màu xanh */
.notification-btn-header.subscribed {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.4);
    animation: none;
}

.notification-btn-header.subscribed:hover {
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.6);
}

/* Trạng thái bị chặn - màu xám, vẫn clickable */
.notification-btn-header.denied {
    background: linear-gradient(135deg, #9E9E9E, #757575);
    box-shadow: 0 2px 8px rgba(158, 158, 158, 0.4);
    animation: none;
    cursor: pointer; /* Vẫn cho phép click để xem hướng dẫn */
}

.notification-btn-header.denied:hover {
    box-shadow: 0 4px 12px rgba(158, 158, 158, 0.6);
    transform: scale(1.05);
}

/* Badge chấm đỏ thông báo mới */
.notification-btn-header::after {
    content: '';
    position: absolute;
    top: 2px;
    right: 2px;
    width: 10px;
    height: 10px;
    background: #ff0000;
    border-radius: 50%;
    border: 2px solid white;
    animation: blink 1.5s ease-in-out infinite;
}

/* Hiệu ứng nhấp nháy cho badge */
@keyframes blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.3;
    }
}

/* Ẩn badge khi đã subscribe */
.notification-btn-header.subscribed::after,
.notification-btn-header.denied::after {
    display: none;
}

@media (max-width: 768px) {
    .notification-btn-header {
        width: 36px;
        height: 36px;
        margin-left: 8px;
    }

    .notification-btn-header svg {
        width: 18px;
        height: 18px;
    }

    .notification-btn-header::after {
        width: 8px;
        height: 8px;
    }
}

/* Facebook Button in Header */
.facebook-btn-header {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    margin-left: 8px;
    transition: all 0.3s ease;
    text-decoration: none;
    padding: 0;
    box-shadow: 0 2px 8px rgba(24, 119, 242, 0.4);
}

.facebook-btn-header:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(24, 119, 242, 0.6);
}

.facebook-btn-header:active {
    transform: scale(0.95);
}

.facebook-btn-header img {
    width: 44px;
    height: 44px;
    object-fit: cover;
    border-radius: 50%;
}

@media (max-width: 768px) {
    .facebook-btn-header {
        width: 40px;
        height: 40px;
        margin-left: 6px;
    }

    .facebook-btn-header img {
        width: 40px;
        height: 40px;
    }
}
