/* ========================================
   Xanh Organic - Main Stylesheet
   ======================================== */

/* CSS Variables */
:root {
    --primary: #b6e633;
    --primary-dark: #9acc2a;
    --background-light: #FBFBF7;
    --background-dark: #1d2111;
    --text-light: #161811;
    --text-dark: #f7f8f6;
    --card-light: #ffffff;
    --card-dark: #2a2e1e;
    --border-light: #e3e5dc;
    --border-dark: #3c4031;
    --muted-light: #7e8863;
    --muted-dark: #a1a893;
    --danger: #ef4444;
    --success: #22c55e;
}

/* Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Be Vietnam Pro', sans-serif;
    background-color: var(--background-light) !important;
    color: var(--text-light);
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.3s ease;
}

img {
    max-width: 100%;
    height: auto;
}

/* ========================================
   Header Styles
   ======================================== */
.header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border-light);
}

.header-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 80px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo svg {
    width: 2rem;
    height: 2rem;
    color: var(--primary);
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-light);
}

/* Navigation */
.nav {
    display: none;
    align-items: center;
    gap: 2.25rem;
}

@media (min-width: 768px) {
    .nav {
        display: flex;
    }
}

.nav-link {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-light);
    transition: color 0.3s ease;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary);
}

.nav-link.active {
    font-weight: 700;
}

/* Header Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.search-box {
    display: none;
    align-items: center;
    background: var(--background-light);
    border-radius: 0.5rem;
    padding: 0 1rem;
    height: 40px;
}

@media (min-width: 640px) {
    .search-box {
        display: flex;
    }
}

.search-box input {
    border: none;
    background: transparent;
    outline: none;
    font-size: 0.875rem;
    width: 160px;
}

.icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 0.5rem;
    background: var(--background-light);
    border: none;
    cursor: pointer;
    transition: background 0.3s ease;
}

.icon-btn:hover {
    background: rgba(182, 230, 51, 0.2);
}

/* ========================================
   Product Grid
   ======================================== */
.products-section {
    padding: 2rem 1rem;
}

.section-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 640px) {
    .section-header {
        margin-bottom: 1rem;
    }
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-light);
}

@media (max-width: 640px) {
    .section-title {
        font-size: 1.25rem;
    }
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 1rem;
}

@media (min-width: 640px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
}
@media (min-width: 1024px) {
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1rem;
    }
}   


/* Product Card */
.product-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--card-light);
    border: 1px solid transparent;
    border-radius: 0.75rem;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.product-card:hover {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    transform: translateY(-4px);
    border-color: rgba(182, 230, 51, 0.3);
}

.product-image {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.product-card:hover .product-image img {
    transform: scale(1.05);
}

.product-badge {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    padding: 0.2rem 0.4rem;
    border-radius: 9999px;
    font-size: 0.65rem;
    font-weight: 700;
    color: white;
}

.badge-sale {
    background: #ef4444;
}

.badge-new {
    background: #3b82f6;
}

.badge-organic {
    background: #22c55e;
}

.product-favorite {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(4px);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}

.product-favorite:hover {
    background: rgba(182, 230, 51, 0.3);
}

.product-info {
    padding: 0.75rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

@media (max-width: 640px) {
    .product-info {
        padding: 0.5rem;
    }
}

.product-name {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-light);
    margin-bottom: 0.15rem;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.3;
}

@media (max-width: 640px) {
    .product-name {
        font-size: 0.75rem;
        -webkit-line-clamp: 2;
        line-clamp: 2;
    }
}
.product-unit {
    font-size: 0.75rem;
    color: var(--muted-light);
    margin-bottom: 0.5rem;
}

@media (max-width: 640px) {
    .product-unit {
        font-size: 0.7rem;
        margin-bottom: 0.25rem;
    }
}   


.product-price {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-top: auto;
    margin-bottom: 0.75rem;
}

@media (max-width: 640px) {
    .product-price {
        margin-bottom: 0.5rem;
    }
}

.price-current {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary-dark);
}

@media (max-width: 640px) {
    .price-current {
        font-size: 0.875rem;
    }
}

.price-original {
    font-size: 0.75rem;
    color: var(--muted-light);
    text-decoration: line-through;
}

@media (max-width: 640px) {
    .price-original {
        font-size: 0.65rem;
    }
}

.btn-add-cart {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border-radius: 0.4rem;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
}

@media (max-width: 640px) {
    .btn-add-cart {
        padding: 0.4rem 0.6rem;
        font-size: 0.7rem;
    }
}

.btn-add-cart.primary {
    background: rgba(182, 230, 51, 0.2);
    color: var(--text-light);
}

.btn-add-cart.primary:hover {
    background: var(--primary);
}

.btn-add-cart.added {
    background: var(--primary);
    color: var(--text-light);
}

/* ========================================
   Pagination
   ======================================== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-light);
}

.pagination a,
.pagination span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 1rem;
    border: 1px solid var(--border-light);
    background: var(--card-light);
    color: var(--muted-light);
    font-size: 0.875rem;
    transition: all 0.3s ease;
}

.pagination a:first-child {
    border-radius: 0.5rem 0 0 0.5rem;
}

.pagination a:last-child {
    border-radius: 0 0.5rem 0.5rem 0;
}

.pagination a:hover {
    background: rgba(182, 230, 51, 0.1);
}

.pagination .active {
    background: rgba(182, 230, 51, 0.3);
    color: var(--text-light);
    font-weight: 600;
}

.pagination .disabled {
    opacity: 0.5;
    cursor: not-allowed;
}


/* Button Styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.25rem;
    border-radius: 0.75rem;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
}

.btn-primary {
    background: var(--primary);
    color: var(--text-light);
}

.btn-primary:hover {
    opacity: 0.9;
}

.btn-secondary {
    background: var(--background-light);
    color: var(--text-light);
}

.btn-secondary:hover {
    background: var(--border-light);
}

/* ========================================
   Footer
   ======================================== */

/* Social Networks Cards */
.social-networks-section {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 1.5rem;
}

@media (min-width: 640px) {
    .social-networks-section {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }
}

@media (min-width: 1024px) {
    .social-networks-section {
        grid-template-columns: repeat(4, 1fr);
        gap: 2rem;
    }
}

.social-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    padding: 1.5rem;
    background: #fff;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.social-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.social-card-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.social-card h3 {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-light);
    margin: 0;
}

.social-card p {
    color: var(--muted-light);
    font-size: 0.875rem;
    margin-top: 0.5rem;
    text-align: center;
}

@media (max-width: 640px) {
    .social-card {
        padding: 1.25rem;
    }

    .social-card-icon {
        width: 50px;
        height: 50px;
        margin-bottom: 0.75rem;
    }

    .social-card h3 {
        font-size: 1rem;
    }

    .social-card p {
        font-size: 0.8rem;
    }
}

.footer {
    background: var(--card-light);
    border-top: 1px solid var(--border-light);
    margin-top: 4rem;
    padding: 3rem 1rem;
}

.footer-container {
    max-width: 1280px;
    margin: 0 auto;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 2rem;
}

@media (min-width: 768px) {
    .footer-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.footer-brand {
    grid-column: span 2;
}

.footer-brand p {
    margin-top: 1rem;
    font-size: 0.875rem;
    color: var(--muted-light);
    max-width: 320px;
}

.footer-title {
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
}

.footer-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.footer-links a {
    font-size: 0.875rem;
    color: var(--muted-light);
}

.footer-links a:hover {
    color: var(--primary);
}

.footer-bottom {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-light);
    text-align: center;
    font-size: 0.875rem;
    color: var(--muted-light);
}

/* ========================================
   Utilities
   ======================================== */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1rem;
}

.text-center {
    text-align: center;
}

.mt-4 {
    margin-top: 1rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.flex {
    display: flex;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-4 {
    gap: 1rem;
}

/* Alert Messages */
.alert {
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

.alert-success {
    background: rgba(34, 197, 94, 0.1);
    color: #166534;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    color: #991b1b;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Layout */
.main-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    padding: 2rem 1rem;
    max-width: 1280px;
    margin: 0 auto;
}

@media (min-width: 1024px) {
    .main-layout {
        grid-template-columns: 280px 1fr;
    }
}

/* Breadcrumb */
.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem;
    padding: 1rem;
    font-size: 0.875rem;
}

.breadcrumb a {
    color: var(--muted-light);
}

.breadcrumb a:hover {
    color: var(--primary);
}

.breadcrumb span {
    color: var(--muted-light);
}

.breadcrumb .current {
    color: var(--text-light);
    font-weight: 500;
}

/* Sort Select */
.sort-select {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-light);
    border-radius: 0.5rem;
    background: var(--card-light);
    font-size: 0.875rem;
    cursor: pointer;
}

.sort-select:focus {
    outline: none;
    border-color: var(--primary);
}

/* ========================================
   ADMIN STYLES (merged back from admin.css)
   ======================================== */
.admin-products-table img {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
    background: #f3f4f6;
}
.admin-products-table .product-name {
    font-weight: 600;
    font-size: 1rem;
    color: #222;
    margin-bottom: 2px;
}
.admin-products-table .product-unit {
    font-size: 0.85rem;
    color: #888;
}
.admin-products-table .badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-right: 4px;
    margin-bottom: 2px;
}
.admin-products-table .badge-featured {
    background: #fef08a;
    color: #b45309;
}
.admin-products-table .badge-new {
    background: #dbeafe;
    color: #2563eb;
}
.admin-products-table .badge-organic {
    background: #bbf7d0;
    color: #166534;
}
.admin-products-table .badge-out {
    background: #fee2e2;
    color: #b91c1c;
}
.admin-products-table .actions {
    display: flex;
    gap: 0.25rem;
}
.admin-products-table td, .admin-products-table th {
    vertical-align: middle;
}
.admin-products-table tr:hover {
    background: #f3f4f6;
}
.admin-products-table .text-strike {
    text-decoration: line-through;
    color: #aaa;
    font-size: 0.9em;
}
.admin-products-table .price-sale {
    color: #16a34a;
    font-weight: 700;
}
.admin-products-table .price-original {
    color: #aaa;
    font-size: 0.9em;
}
.admin-products-table .stock-out {
    color: #b91c1c;
    font-weight: 600;
}
.admin-products-table .stock-in {
    color: #166534;
    font-weight: 600;
}
/* Sidebar quản trị */
.sidebar {
    position: sticky;
    top: 100px;
}
.filter-card {
    background: var(--card-light);
    border: 1px solid var(--border-light);
    border-radius: 0.75rem;
    padding: 1.5rem;
}
.filter-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}
.filter-subtitle {
    font-size: 0.875rem;
    color: var(--muted-light);
    margin-bottom: 1.5rem;
}
.filter-section {
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-light);
}
.filter-section-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}
.category-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.category-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    transition: background 0.3s ease;
}
.category-item:hover {
    background: rgba(182, 230, 51, 0.1);
}
.category-item.active {
    background: rgba(182, 230, 51, 0.2);
}
.category-item.active .category-name {
    font-weight: 600;
    color: var(--primary-dark);
}
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
}
.checkbox-item input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    accent-color: var(--primary);
}