:root {
    --primary: #d97706;
    --primary-hover: #b45309;
    --primary-light: #fef3c7;
    --dark: #0f172a;
    --dark-surface: #1e293b;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #0ea5e9;
    --radius: 10px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

body {
    background-color: var(--bg);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header & Navigation */
.header {
    background: #0f172a;
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.nav-container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    color: #fff;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.brand-logo span.highlight {
    color: var(--primary);
}

.brand-icon {
    font-size: 1.6rem;
    color: var(--primary);
}

.search-bar-quick {
    flex: 1;
    max-width: 460px;
    display: flex;
    position: relative;
}

.search-bar-quick input {
    width: 100%;
    padding: 0.6rem 2.8rem 0.6rem 1rem;
    border-radius: 20px;
    border: 1px solid #334155;
    background: #1e293b;
    color: #fff;
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s;
}

.search-bar-quick input:focus {
    border-color: var(--primary);
    background: #0f172a;
}

.search-bar-quick button {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: #94a3b8;
    padding: 0.4rem 0.75rem;
    cursor: pointer;
    font-size: 1rem;
}

.search-bar-quick button:hover {
    color: var(--primary);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.nav-link {
    color: #cbd5e1;
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: color 0.2s;
}

.nav-link:hover {
    color: var(--primary);
}

.cart-badge-wrap {
    position: relative;
    padding: 0.3rem 0.6rem;
    background: #1e293b;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.92rem;
}

.cart-badge-wrap:hover {
    background: #334155;
}

.cart-badge {
    background: var(--primary);
    color: #fff;
    font-size: 0.75rem;
    padding: 2px 7px;
    border-radius: 12px;
    font-weight: 700;
}

.user-menu {
    position: relative;
    display: inline-block;
}

.user-btn {
    background: #1e293b;
    border: 1px solid #334155;
    color: #f1f5f9;
    padding: 0.45rem 0.85rem;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.88rem;
}

.user-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    padding-top: 6px; /* Không dùng margin để tránh bị đứt hover */
    z-index: 200;
}

/* Cầu nối vô hình chống mất hover khi lia chuột xuống */
.user-dropdown::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 0;
    right: 0;
    height: 12px;
    background: transparent;
}

.user-dropdown-inner {
    background: #fff;
    color: var(--text-main);
    border-radius: 8px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    min-width: 220px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.user-menu:hover .user-dropdown,
.user-dropdown.show {
    display: block;
}

.user-dropdown a, .user-dropdown button {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    text-align: left;
    padding: 0.75rem 1rem;
    text-decoration: none;
    color: var(--text-main);
    font-size: 0.88rem;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.user-dropdown a:hover, .user-dropdown button:hover {
    background: #f1f5f9;
    color: var(--primary);
}

.user-dropdown .logout-item {
    color: #ef4444 !important;
}

.user-dropdown .logout-item:hover {
    background: #fee2e2 !important;
    color: #dc2626 !important;
}

.user-dropdown .divider {
    height: 1px;
    background: var(--border);
}

/* Secondary Navigation Bar (Categories) */
.sub-nav {
    background: #1e293b;
    border-top: 1px solid #334155;
    overflow-x: auto;
}

.sub-nav-container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0.4rem 1.5rem;
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.sub-nav-link {
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    padding: 0.35rem 0.6rem;
    border-radius: 6px;
    transition: all 0.2s;
    cursor: pointer;
}

.sub-nav-link:hover, .sub-nav-link.active {
    color: #fff;
    background: #334155;
}

/* Main Container */
.main-content {
    flex: 1;
    max-width: 1240px;
    width: 100%;
    margin: 0 auto;
    padding: 1.5rem;
}

/* Hero Section */
.hero-banner {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #451a03 100%);
    color: #fff;
    border-radius: 16px;
    padding: 3rem 2.5rem;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.hero-text h1 {
    font-size: 2.3rem;
    font-weight: 800;
    margin-bottom: 0.75rem;
    line-height: 1.2;
}

.hero-text p {
    color: #cbd5e1;
    font-size: 1.05rem;
    max-width: 540px;
    margin-bottom: 1.5rem;
}

.hero-btn {
    background: var(--primary);
    color: #fff;
    padding: 0.75rem 1.75rem;
    border-radius: 30px;
    text-decoration: none;
    font-weight: 700;
    display: inline-block;
    transition: background 0.2s;
}

.hero-btn:hover {
    background: var(--primary-hover);
}

/* Advanced Search Box */
.advanced-search-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

.search-grid {
    display: grid;
    grid-template-columns: 2fr 1.5fr 1fr 1fr auto;
    gap: 1rem;
    align-items: end;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.form-group label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
}

.form-control {
    padding: 0.55rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--text-main);
    outline: none;
    background: #fff;
    transition: border 0.2s;
}

.form-control:focus {
    border-color: var(--primary);
}

.btn-search {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 0.58rem 1.4rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    height: 38px;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.btn-search:hover {
    background: var(--primary-hover);
}

.btn-reset {
    background: #f1f5f9;
    color: var(--text-muted);
    border: 1px solid var(--border);
    padding: 0.58rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    height: 38px;
}

.btn-reset:hover {
    background: #e2e8f0;
}

/* Product Grid */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.section-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-main);
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.product-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    position: relative;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.product-thumb-wrap {
    height: 200px;
    width: 100%;
    background: #f1f5f9;
    overflow: hidden;
    position: relative;
}

.product-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.product-card:hover .product-thumb {
    transform: scale(1.05);
}

.stock-tag {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
}

.stock-tag.in-stock {
    background: #dcfce7;
    color: #15803d;
}

.stock-tag.low-stock {
    background: #fef3c7;
    color: #b45309;
}

.stock-tag.out-of-stock {
    background: #fee2e2;
    color: #b91c1c;
}

.product-body {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.product-category-name {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}

.product-title {
    font-size: 0.98rem;
    font-weight: 600;
    color: var(--text-main);
    text-decoration: none;
    margin-bottom: 0.5rem;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-title:hover {
    color: var(--primary);
}

.product-price-row {
    margin-top: auto;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding-top: 0.75rem;
    border-top: 1px dashed var(--border);
}

.product-price {
    font-size: 1.15rem;
    font-weight: 700;
    color: #b45309;
}

.btn-add-cart {
    background: var(--dark-surface);
    color: #fff;
    border: none;
    padding: 0.45rem 0.85rem;
    border-radius: 7px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.btn-add-cart:hover {
    background: var(--primary);
}

.btn-add-cart:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
}

/* Pagination */
.pagination-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin: 2rem 0;
}

.page-btn {
    padding: 0.45rem 0.85rem;
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-main);
    transition: all 0.2s;
}

.page-btn:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
}

.page-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Cart & Checkout Styles */
.cart-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    align-items: start;
}

.cart-table-card, .summary-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.table-custom {
    width: 100%;
    border-collapse: collapse;
}

.table-custom th {
    text-align: left;
    padding: 0.75rem;
    font-size: 0.82rem;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
}

.table-custom td {
    padding: 1rem 0.75rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.qty-control {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
}

.qty-btn {
    background: #f1f5f9;
    border: none;
    width: 28px;
    height: 28px;
    cursor: pointer;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qty-btn:hover {
    background: #e2e8f0;
}

.qty-input {
    width: 40px;
    height: 28px;
    border: none;
    text-align: center;
    font-weight: 600;
    font-size: 0.88rem;
    outline: none;
}

.btn-remove-item {
    background: transparent;
    border: none;
    color: #ef4444;
    cursor: pointer;
    font-size: 1.1rem;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
}

.summary-row.total {
    border-top: 1px solid var(--border);
    padding-top: 1rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: #b45309;
}

.btn-checkout {
    display: block;
    width: 100%;
    text-align: center;
    background: var(--primary);
    color: #fff;
    padding: 0.85rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 700;
    border: none;
    cursor: pointer;
    margin-top: 1.25rem;
    transition: background 0.2s;
}

.btn-checkout:hover {
    background: var(--primary-hover);
}

/* Toast Notification */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    background: #ffffff;
    color: #0f172a;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
    padding: 0.95rem 1.25rem;
    border-radius: 10px;
    min-width: 300px;
    max-width: 420px;
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.4;
    animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid #cbd5e1;
}

.toast.success {
    background: #ffffff;
    border: 1px solid #86efac;
    border-left: 6px solid #16a34a;
    color: #14532d;
}

.toast.error {
    background: #ffffff;
    border: 1px solid #fca5a5;
    border-left: 6px solid #dc2626;
    color: #991b1b;
}

.toast.warning {
    background: #ffffff;
    border: 1px solid #fde047;
    border-left: 6px solid #d97706;
    color: #92400e;
}

@keyframes toastSlideIn {
    from { transform: translateX(110%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.6);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-content {
    background: #fff;
    border-radius: var(--radius);
    max-width: 650px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 1.75rem;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

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

.modal-close {
    background: transparent;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: var(--text-muted);
}

/* Footer */
.footer {
    background: #0f172a;
    color: #94a3b8;
    padding: 2.5rem 1.5rem 1.5rem;
    margin-top: auto;
    border-top: 1px solid #1e293b;
}

.footer-container {
    max-width: 1240px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-bottom {
    max-width: 1240px;
    margin: 0 auto;
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid #1e293b;
    font-size: 0.82rem;
}

@media (max-width: 768px) {
    .nav-container { flex-wrap: wrap; }
    .search-bar-quick { order: 3; max-width: 100%; }
    .search-grid { grid-template-columns: 1fr; }
    .cart-layout { grid-template-columns: 1fr; }
    .footer-container { grid-template-columns: 1fr; }
}

/* Badges for Customer Side */
.badge {
    display: inline-block;
    padding: 0.35rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    white-space: nowrap;
    text-align: center;
}
.badge.pending, .badge.unpaid, .badge.warning {
    background: #fef3c7;
    color: #b45309;
    border: 1px solid #fde68a;
}
.badge.processing, .badge.draft {
    background: #e0f2fe;
    color: #0369a1;
    border: 1px solid #bae6fd;
}
.badge.delivered, .badge.active, .badge.paid {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #bbf7d0;
}
.badge.cancelled, .badge.locked, .badge.danger {
    background: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

/* Order History Cards */
.order-card-customer {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
    transition: box-shadow 0.2s;
}
.order-card-customer:hover {
    box-shadow: var(--shadow-lg);
}

.order-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 0.85rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.order-item-thumb {
    width: 65px;
    height: 65px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
}

/* Order Progress Timeline */
.order-progress-track {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 1rem 0;
    padding: 0.75rem 1rem;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.progress-step {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: #94a3b8;
}

.progress-step.done {
    color: #15803d;
}

.progress-step.current {
    color: #d97706;
}

.progress-arrow {
    color: #cbd5e1;
    font-size: 0.9rem;
}



/* Header & Navigation Utilities */
.btn-nav-register {
    padding: 0.45rem 1.1rem;
    font-size: 0.85rem;
}

.icon-search {
    vertical-align: middle;
}

/* Footer Components */
.footer-brand-logo {
    margin-bottom: 0.75rem;
}

.footer-description {
    font-size: 0.88rem;
    line-height: 1.6;
    max-width: 380px;
}

.footer-title {
    color: #ffffff;
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
}

.footer-links {
    list-style: none;
    font-size: 0.88rem;
    line-height: 2;
}

.footer-link-item {
    color: #94a3b8;
    text-decoration: none;
    transition: color 0.2s;
}

.footer-link-item:hover {
    color: #ffffff;
}

.footer-contact-info {
    font-size: 0.88rem;
    line-height: 1.8;
}

.footer-admin-link-wrapper {
    margin-top: 1rem;
}

.footer-admin-link {
    color: #64748b;
    font-size: 0.78rem;
    text-decoration: none;
    transition: color 0.2s;
}

.footer-admin-link:hover {
    color: #94a3b8;
}

/* Quick Orders Modal Styles */
.quick-orders-scroll {
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.quick-orders-loading {
    text-align: center;
    padding: 2rem;
    color: #64748b;
}

.quick-orders-empty {
    text-align: center;
    padding: 3rem 1rem;
}

.quick-orders-empty-title {
    color: #0f172a;
    margin-bottom: 0.5rem;
}

.quick-orders-empty-desc {
    color: #64748b;
    font-size: 0.9rem;
}

.quick-orders-empty-btn {
    margin-top: 1rem;
}

.quick-orders-card {
    margin-bottom: 1rem;
    padding: 1.25rem;
}

.quick-orders-code {
    font-weight: 800;
    font-size: 1.05rem;
    color: #0f172a;
}

.quick-orders-date {
    color: #64748b;
    font-size: 0.85rem;
    margin-left: 0.75rem;
}

.quick-orders-items-list {
    margin-bottom: 1rem;
}

.quick-orders-item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.5rem 0;
    border-bottom: 1px dashed #f1f5f9;
}

.quick-orders-item-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.quick-orders-item-img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.quick-orders-item-name {
    font-weight: 600;
    font-size: 0.92rem;
    color: #0f172a;
    text-decoration: none;
}

.quick-orders-item-qty {
    font-size: 0.8rem;
    color: #64748b;
}

.quick-orders-item-subtotal {
    font-weight: 700;
    color: #b45309;
    font-size: 0.95rem;
}

.quick-orders-summary-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    background: #f8fafc;
    padding: 0.75rem 1rem;
    border-radius: 8px;
}

.quick-orders-recipient {
    font-size: 0.82rem;
    color: #475569;
}

.quick-orders-total-box {
    text-align: right;
}

.quick-orders-total-label {
    font-size: 0.82rem;
    color: #64748b;
}

.quick-orders-total-amount {
    font-size: 1.15rem;
    font-weight: 800;
    color: #b45309;
}

.quick-orders-error {
    color: #ef4444;
    padding: 1.5rem;
    text-align: center;
}
