/* ==========================================================
   MENU.CSS — Sweet Oven Bakery
   Synchronized with Login/Register design system
   Palette & tokens mirror authPage/login.jsp :root vars
   ========================================================== */

/* ── CSS Variables (mirrored from login.jsp) ────────────── */
:root {
    --primary:        #3C2F27;   /* Dark warm brown — login sidebar bg */
    --primary-hover:  #6d360f;   /* Deeper brown on hover */
    --accent:         #D4A76A;   /* Golden tan — login focus ring, border */
    --bg-color:       #F9F6F0;   /* Warm off-white — login body bg */
    --white:          #ffffff;
    --text-main:      #333333;
    --text-muted:     #777777;
    --border-soft:    #eaeaea;
    --shadow-card:    0 10px 30px rgba(60, 47, 39, 0.08);
    --shadow-hover:   0 15px 40px rgba(60, 47, 39, 0.18);
    --radius-card:    16px;      /* matches login container inner elements */
    --radius-btn:     12px;      /* matches login .login-btn border-radius */
    --transition:     all 0.3s ease;
}

/* ── Base ───────────────────────────────────────────────── */
* {
    box-sizing: border-box;
    font-family: "Quicksand", sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
}

/* ── Page Layout ────────────────────────────────────────── */
.main-content {
    min-height: 80vh;
    padding-top: 24px;
    padding-bottom: 60px;
}

/* ── Sidebar ────────────────────────────────────────────── */
.sidebar {
    background: var(--white);
    border-radius: var(--radius-card);
    padding: 1.8rem;
    box-shadow: var(--shadow-card);
    height: fit-content;
    position: sticky;
    top: 100px;
    border: 1px solid rgba(212, 167, 106, 0.15);
}

.sidebar-category h3 {
    color: var(--primary);
    margin-bottom: 1.2rem;
    font-size: 0.85rem;
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    padding-bottom: 0.8rem;
    border-bottom: 2px solid var(--primary);
}

.category-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.category-list li {
    margin-bottom: 0.4rem;
}

.category-list a {
    text-decoration: none;
    color: var(--text-main);
    padding: 0.65rem 1rem;
    display: block;
    border-radius: var(--radius-btn);
    font-size: 0.9rem;
    font-weight: 600;
    transition: var(--transition);
    letter-spacing: 0.3px;
}

.category-list a:hover {
    background: rgba(212, 167, 106, 0.15);
    color: var(--primary);
    transform: translateX(4px);
}

.category-list a.active {
    background: var(--primary);
    color: var(--white);
    box-shadow: 0 4px 14px rgba(60, 47, 39, 0.25);
}

/* ── Products Area ──────────────────────────────────────── */
.products-area {
    padding-left: 1.5rem;
}

.products-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-soft);
}

.products-header h2 {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--primary);
    margin: 0;
    letter-spacing: 1px;
}

.results-count {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 1rem;
}

.section-title h2 {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 0;
    letter-spacing: 1px;
}

/* ── Sort Filter ────────────────────────────────────────── */
.filter-section {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.price-filter select,
.price-filter .form-select {
    padding: 0.6rem 1.2rem;
    border: 1.5px solid var(--border-soft);
    border-radius: var(--radius-btn);
    background: var(--white);
    color: var(--primary);
    font-family: "Quicksand", sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
    appearance: auto;
}

.price-filter select option,
.price-filter .form-select option {
    font-family: "Quicksand", sans-serif;
    font-weight: 600;
    color: var(--primary);
    background: var(--white);
}

.price-filter select:focus,
.price-filter .form-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(212, 167, 106, 0.15);
}

/* ── Products Grid ──────────────────────────────────────── */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.5rem;
    min-height: 400px;
}

/* ── Product Card ───────────────────────────────────────── */
.product-card {
    background: #FFFFFF;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(60, 47, 39, 0.07);
    transition: border-color 0.22s ease, box-shadow 0.22s ease;
    display: flex;
    flex-direction: column;
    border: 1px solid #ECE5DD;
    cursor: pointer;
    position: relative;
}

.product-card:hover {
    border-color: #D9C4AC;
    box-shadow: 0 4px 18px rgba(60, 47, 39, 0.11);
}

/* Product Image */
.product-img {
    position: relative;
    width: 100%;
    padding-top: 65%;
    overflow: hidden;
    background: #FAF7F2;
    flex-shrink: 0;
}

.product-img a {
    position: absolute;
    inset: 0;
    display: block;
}

.product-img img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.product-card:hover .product-img img {
    transform: scale(1.04);
}

/* Out-of-stock badge */
.product-badge {
    position: absolute;
    top: 9px;
    left: 9px;
    background: #3C2F27;
    color: #F5E8D8;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    z-index: 2;
}

/* Product Content */
.product-content {
    padding: 13px 15px 15px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.product-content h3 {
    font-size: 0.9rem;
    margin: 0 0 auto;
    font-weight: 700;
    color: #3C2F27;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.35;
}

.product-price {
    display: flex;
    flex-direction: column;
    gap: 1px;
    margin-top: 12px;
    padding-top: 11px;
    border-top: 1px solid #ECE5DD;
}

/* Giá bình thường */
.price-normal {
    font-weight: 700;
    font-size: 1rem;
    color: #D9A273;
    line-height: 1.15;
}

/* Giá gốc bị gạch ngang */
.price-original {
    font-size: 0.68rem;
    font-weight: 400;
    color: #A89890;
    text-decoration: line-through;
}

/* Giá sau giảm */
.price-sale {
    font-size: 1rem;
    font-weight: 700;
    color: #D9A273;
    line-height: 1.15;
}

/* ── Add to Cart Button ──────── */
.btn-add-to-cart {
    background: #3C2F27;
    color: #FFF8F2;
    border: 2px solid #3C2F27;
    width: 100%;
    padding: 9px 0;
    border-radius: 9px;
    font-family: 'Quicksand', sans-serif;
    font-weight: 700;
    font-size: 0.82rem;
    letter-spacing: 0.2px;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 10px;
}

.btn-add-to-cart:hover:not(:disabled) {
    background: #FFF8F2;
    color: #3C2F27;
}

.btn-add-to-cart:disabled {
    background: #EDEBE8;
    color: #A89890;
    border-color: #EDEBE8;
    cursor: not-allowed;
}

/* Transparent click-through overlay for card link */
.product-link-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.product-template {
    display: none;
}

/* ── Pagination ─────────────────────────────────────────── */
.pagination {
    margin-top: 3rem;
    justify-content: center;
    gap: 4px;
}

.page-link {
    color: var(--primary);
    border: 1.5px solid var(--border-soft);
    border-radius: var(--radius-btn) !important;
    padding: 0.5rem 1rem;
    font-family: "Quicksand", sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    transition: var(--transition);
}

.page-link:hover {
    background: rgba(212, 167, 106, 0.15);
    color: var(--primary);
    border-color: var(--accent);
}

.page-item.active .page-link {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--white);
    box-shadow: 0 4px 12px rgba(60, 47, 39, 0.25);
}

.page-item.disabled .page-link {
    background: var(--bg-color);
    border-color: var(--border-soft);
    color: #bbb;
    cursor: not-allowed;
}

/* ── Loading / Empty States ─────────────────────────────── */
.loading {
    text-align: center;
    padding: 3rem;
    color: var(--primary);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-soft);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.no-results {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--primary);
}

.no-results i {
    font-size: 3rem;
    color: var(--accent);
    margin-bottom: 1rem;
    display: block;
}

.no-results p {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-muted);
}

/* ── Toast Notification ─────────────────────────────────── */
.toast-notification {
    position: fixed;
    top: 100px;
    right: 20px;
    background: var(--primary);
    color: var(--white);
    padding: 0.9rem 1.4rem;
    border-radius: var(--radius-card);
    box-shadow: 0 8px 24px rgba(60, 47, 39, 0.25);
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 600;
    font-size: 0.9rem;
    transform: translateX(calc(100% + 30px));
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.toast-notification.show {
    transform: translateX(0);
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 992px) {
    .sidebar {
        position: relative;
        top: auto;
        margin-bottom: 1.5rem;
    }
}

@media (max-width: 768px) {
    .products-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 1rem;
    }

    .products-area {
        padding-left: 0;
    }

    .section-title h2 {
        font-size: 1.3rem;
    }

    .toast-notification {
        top: 80px;
        right: 10px;
        left: 10px;
        transform: translateY(-120px);
    }

    .toast-notification.show {
        transform: translateY(0);
    }
}

@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }

    .product-card {
        height: auto;
    }

    .product-img {
        height: 150px;
    }
}
/* Đảm bảo product-card có position relative (đã có sẵn trong hầu hết card) */
.product-card {
    position: relative;
}

/* Nút trái tim */
.btn-favorite {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.25s ease, transform 0.2s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    padding: 0;
    line-height: 1;
}

.btn-favorite i {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.8);
    transition: color 0.25s ease, transform 0.2s ease;
    pointer-events: none;
}

/* Hover khi chưa yêu thích */
.btn-favorite:not(.active):hover {
    background: rgba(255, 255, 255, 0.55);
}

.btn-favorite:not(.active):hover i {
    color: #e53935;
    transform: scale(1.15);
}

/* Trạng thái đã yêu thích (active) */
.btn-favorite.active {
    background: rgba(255, 255, 255, 0.9);
}

.btn-favorite.active i {
    color: #e53935;
}

/* Animation khi click */
.btn-favorite.heart-pop i {
    animation: heartPop 0.35s ease;
}

@keyframes heartPop {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.4); }
    70%  { transform: scale(0.9); }
    100% { transform: scale(1); }
}

/* ================================================================
   FAVORITE HEART BUTTON
   ================================================================ */

.btn-favorite {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 10;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    padding: 0;
    line-height: 1;
    opacity: 1;
    transform: scale(1);
}

.btn-favorite i {
    font-size: 15px;
    color: #ccc;
    transition: color 0.2s ease, transform 0.15s ease;
    pointer-events: none;
}

.btn-favorite:not(.active):hover {
    background: #fff;
    box-shadow: 0 4px 14px rgba(229, 57, 53, 0.2);
    transform: scale(1.1);
}

.btn-favorite:not(.active):hover i {
    color: #e53935;
}

.btn-favorite.active {
    background: #fff1f1;
    box-shadow: 0 2px 10px rgba(229, 57, 53, 0.25);
}

.btn-favorite.active i {
    color: #e53935;
}

.btn-favorite:active {
    transform: scale(0.92) !important;
}

.btn-favorite.heart-pop i {
    animation: heartPop 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes heartPop {
    0%   { transform: scale(1); }
    20%  { transform: scale(0.8); }
    50%  { transform: scale(1.45); }
    75%  { transform: scale(0.9); }
    100% { transform: scale(1); }
}
