*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:       #f4f4f0;
    --surface:  #ffffff;
    --surface2: #f8f8f6;
    --border:   #e8e8e4;
    --border2:  #d0d0ca;
    --accent:   #111111;
    --text:     #111111;
    --muted:    #888888;
    --green:    #1a9e80;
    --yellow:   #d97706;
    --red:      #dc2626;
    --price:    #dc2626;
    --radius:   8px;
}

html, body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    font-size: 15px;
}
a { color: inherit; text-decoration: none; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 .75rem; }

/* ─── NAV ─── */
.nav-yame {
    background: #111;
    border-bottom: none;
    position: sticky;
    top: 0;
    z-index: 200;
}
.nav-yame-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 54px;
    padding: 0 1rem;
    max-width: 1200px;
    margin: 0 auto;
}
.nav-left  { display: flex; align-items: center; gap: .7rem; }
.nav-right { display: flex; align-items: center; gap: .3rem; }

.nav-logo {
    font-size: 1.2rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.nav-hamburger {
    background: none;
    border: none;
    cursor: pointer;
    padding: 7px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.nav-hamburger span {
    display: block;
    width: 20px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: all .2s;
}

.nav-icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 7px;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    border-radius: 50%;
    transition: background .15s;
}
.nav-icon-btn:hover { background: rgba(255,255,255,.12); }

.nav-cart-count {
    position: absolute;
    top: 2px; right: 2px;
    background: var(--red);
    color: #fff;
    font-size: .58rem;
    font-weight: 700;
    border-radius: 999px;
    min-width: 15px;
    height: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
}

.nav-search-expand {
    border-top: 1px solid rgba(255,255,255,.1);
    padding: .55rem 1rem;
    background: #111;
}
.nav-search-form {
    display: flex;
    gap: .4rem;
    max-width: 600px;
    margin: 0 auto;
}
.nav-search-form input {
    flex: 1;
    padding: .5rem .9rem;
    border: 1.5px solid rgba(255,255,255,.2);
    border-radius: var(--radius);
    font-size: .88rem;
    background: rgba(255,255,255,.08);
    color: #fff;
    outline: none;
}
.nav-search-form input::placeholder { color: rgba(255,255,255,.4); }
.nav-search-form input:focus { border-color: rgba(255,255,255,.5); }
.nav-search-form button {
    background: var(--red);
    border: none;
    color: #fff;
    border-radius: var(--radius);
    padding: .5rem .9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
}

/* ─── Drawer ─── */
.nav-drawer-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 300;
    backdrop-filter: blur(2px);
}
.nav-drawer-overlay.open { display: block; }

.nav-drawer {
    position: fixed;
    top: 0; left: 0;
    width: 280px;
    height: 100vh;
    background: #fff;
    z-index: 400;
    transform: translateX(-100%);
    transition: transform .25s ease;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}
.nav-drawer.open { transform: translateX(0); }

.nav-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.2rem;
    background: #111;
}
.nav-drawer-logo { font-size: 1.1rem; font-weight: 800; color: #fff; letter-spacing: 2px; }
.nav-drawer-close {
    background: none; border: none;
    cursor: pointer; color: rgba(255,255,255,.7);
    padding: 4px; border-radius: 4px;
    display: flex; align-items: center;
}
.nav-drawer-close:hover { color: #fff; }

.nav-drawer-body { display: flex; flex-direction: column; flex: 1; padding: .5rem 0; }
.nav-drawer-balance {
    display: flex; align-items: center; gap: .6rem;
    font-size: .9rem; font-weight: 700; color: #111;
    padding: .9rem 1.3rem;
    border-bottom: 1px solid #f0f0f0;
    background: #fafafa;
}
.nav-drawer-body a {
    display: flex; align-items: center; gap: .7rem;
    padding: .82rem 1.3rem;
    font-size: .9rem; color: #333;
    border-bottom: 1px solid #f5f5f5;
    transition: background .1s;
}
.nav-drawer-body a svg { flex-shrink: 0; color: #666; }
.nav-drawer-body a:hover { background: #f8f8f8; }
.nav-drawer-logout {
    color: #fff !important;
    background: #dc2626 !important;
    font-weight: 700;
    margin: 1rem !important;
    border-radius: var(--radius) !important;
    border-bottom: none !important;
    justify-content: center;
}
.nav-drawer-logout svg { color: #fff !important; }
.nav-drawer-logout:hover { background: #b91c1c !important; }

/* ─── TOAST ALERTS ─── */
.alert-wrap {
    position: fixed;
    top: 62px; left: 50%;
    transform: translateX(-50%);
    z-index: 9000;
    display: flex; flex-direction: column; gap: 8px;
    pointer-events: none;
    width: calc(100% - 32px);
    max-width: 400px;
}
.alert {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 12px 14px;
    border-radius: 12px;
    font-size: .85rem; font-weight: 500; line-height: 1.4;
    box-shadow: 0 4px 20px rgba(0,0,0,.18), 0 1px 4px rgba(0,0,0,.12);
    pointer-events: all;
    animation: toast-in .25s ease;
}
@keyframes toast-in {
    from { opacity: 0; transform: translateY(-10px) scale(.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.alert-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 1px; }
.alert-success { background: #18181b; color: #4ade80; border: 1px solid rgba(74,222,128,.2); }
.alert-error   { background: #18181b; color: #f87171; border: 1px solid rgba(248,113,113,.2); }
.alert-info    { background: #18181b; color: #60a5fa; border: 1px solid rgba(96,165,250,.2); }

/* ─── CARD ─── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
}

/* ─── PRODUCT GRID ─── */
.product-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: .75rem;
}
@media (min-width: 480px)  { .product-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 768px)  { .product-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1100px) { .product-grid { grid-template-columns: repeat(5, 1fr); } }

.product-card {
    background: var(--surface);
    border-radius: 12px;
    border: 1px solid var(--border);
    overflow: hidden;
    display: block;
    color: var(--text);
    transition: box-shadow .18s, transform .18s, border-color .18s;
}
.product-card:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,.1);
    transform: translateY(-2px);
    border-color: var(--border2);
}

.product-card .img-wrap {
    position: relative;
    width: 100%;
    padding-top: 100%;
    background: #f7f7f5;
    overflow: hidden;
}
.product-card .img-wrap img {
    position: absolute;
    inset: 0; width: 100%; height: 100%;
    object-fit: cover;
    transition: transform .35s ease;
}
.product-card:hover .img-wrap img { transform: scale(1.05); }
.product-card .no-img {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 3rem; color: #ccc;
    background: #f5f5f3;
}

.product-card .info { padding: .55rem .65rem .75rem; }
.product-card .name {
    font-size: .8rem; line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; color: #333;
    margin-bottom: .35rem; min-height: 2.24em;
}
.product-card .price {
    color: var(--price);
    font-size: .98rem;
    font-weight: 700;
}
.product-card .sold {
    font-size: .7rem; color: #bbb; margin-top: .15rem;
}

/* stock bar */
.stock-bar {
    height: 3px;
    background: #eee;
    border-radius: 2px;
    margin-top: 5px;
    overflow: hidden;
}
.stock-fill {
    height: 100%;
    background: var(--red);
    border-radius: 2px;
    transition: width .3s;
}
.stock-fill.ok  { background: var(--green); }
.stock-fill.mid { background: var(--yellow); }

/* badge trên ảnh */
.img-badge {
    position: absolute;
    top: 7px; left: 7px;
    font-size: .65rem; font-weight: 700;
    padding: 2px 7px; border-radius: 4px;
    letter-spacing: .3px;
    z-index: 2;
}
.badge-hot  { background: var(--red);    color: #fff; }
.badge-new  { background: #111;          color: #fff; }
.badge-sale { background: var(--green);  color: #fff; }

/* ─── FORMS ─── */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: .4rem; font-size: .82rem; color: #777; font-weight: 500; }
.form-group input,
.form-group textarea,
.form-group select {
    width: 100%; padding: .55rem .9rem;
    background: #fff; border: 1px solid var(--border2);
    border-radius: var(--radius); color: #111; font-size: .9rem;
    transition: border-color .15s;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus { outline: none; border-color: #111; }
.form-group textarea { resize: vertical; min-height: 80px; }

/* ─── BUTTONS ─── */
.btn {
    display: inline-flex; align-items: center; gap: .35rem;
    padding: .52rem 1.1rem; border-radius: var(--radius);
    font-size: .85rem; font-weight: 600; border: none;
    cursor: pointer; transition: all .15s;
    text-decoration: none; text-align: center;
    white-space: nowrap;
}
.btn:hover { opacity: .85; transform: translateY(-1px); }
.btn:active { transform: scale(.97); }
.btn-primary   { background: #111; color: #fff; }
.btn-secondary { background: #fff; color: #111; border: 1.5px solid #ccc; }
.btn-secondary:hover { border-color: #111; }
.btn-success   { background: var(--green); color: #fff; }
.btn-danger    { background: var(--red);   color: #fff; }
.btn-sm { padding: .28rem .65rem; font-size: .78rem; }
.btn-block { display: flex; width: 100%; justify-content: center; }

/* ─── TABLE ─── */
table { width: 100%; border-collapse: collapse; font-size: .85rem; }
th, td { padding: .7rem 1rem; border-bottom: 1px solid var(--border); text-align: left; }
th { color: #999; font-weight: 600; font-size: .75rem; letter-spacing: .5px; text-transform: uppercase; background: #fafaf8; }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #fafaf8; }

/* ─── STATUS ─── */
.status {
    display: inline-block; padding: 3px 9px; border-radius: 20px;
    font-size: .72rem; font-weight: 600; letter-spacing: .2px;
}
.status-pending    { background: #fef3c7; color: #92400e; }
.status-approved   { background: #d1fae5; color: #065f46; }
.status-rejected   { background: #fee2e2; color: #991b1b; }
.status-processing { background: #dbeafe; color: #1e40af; }
.status-shipped    { background: #ede9fe; color: #4c1d95; }
.status-completed  { background: #d1fae5; color: #065f46; }
.status-cancelled  { background: #fee2e2; color: #991b1b; }

/* ─── MISC ─── */
.page-title { font-size: 1.15rem; font-weight: 700; margin: 1.1rem 0 .85rem; }
.muted { color: var(--muted); }
.text-right  { text-align: right; }
.text-center { text-align: center; }
.mt-1 { margin-top: .5rem; }  .mt-2 { margin-top: 1rem; }  .mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; }
.flex { display: flex; } .gap-1 { gap: .5rem; }
.items-center { align-items: center; } .justify-between { justify-content: space-between; }
.badge {
    background: var(--red); color: #fff;
    font-size: .62rem; border-radius: 999px;
    padding: 1px 6px; font-weight: 700;
}

/* ─── CART ─── */
.cart-summary { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 1.25rem; }
.cart-total { font-size: 1.1rem; font-weight: 700; color: #111; }

/* ─── STATS ADMIN ─── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: .75rem; margin-bottom: 1.25rem;
}
.stat-card {
    background: #fff; border: 1px solid var(--border);
    border-radius: 12px; padding: 1rem;
}
.stat-card .label { font-size: .75rem; color: #999; margin-bottom: .35rem; font-weight: 500; text-transform: uppercase; letter-spacing: .4px; }
.stat-card .value { font-size: 1.5rem; font-weight: 700; }

/* ─── ADMIN NAV ─── */
.admin-nav {
    background: #fff; border-bottom: 1px solid var(--border);
    padding: 0;
    overflow-x: auto;
}
.admin-nav .container {
    display: flex; gap: 0;
    font-size: .83rem;
    flex-wrap: nowrap;
    min-width: max-content;
}
.admin-nav a {
    color: #888; padding: .7rem .9rem;
    border-bottom: 2px solid transparent;
    text-decoration: none; white-space: nowrap;
    transition: color .15s, border-color .15s;
    font-weight: 500;
}
.admin-nav a:hover { color: #111; }
.admin-nav a.active { color: #111; border-bottom-color: #111; }

/* ─── QTY + DETAIL ─── */
.qty-input { width: 60px; text-align: center; padding: .35rem; background: #fff; border: 1.5px solid #222; border-radius: var(--radius); color: #111; }
.product-detail-img { width: 100%; object-fit: cover; display: block; }

/* ─── BANNER hero ─── */
.shop-hero {
    background: #111;
    color: #fff;
    padding: 1.1rem 1rem;
    margin-bottom: 0;
}
.shop-hero-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: .3rem;
}
.shop-hero h2 { font-size: 1.05rem; font-weight: 800; letter-spacing: .5px; }
.shop-hero p  { font-size: .8rem; color: rgba(255,255,255,.55); }

/* ─── SECTION HEAD ─── */
.section-head {
    display: flex; align-items: center;
    justify-content: space-between;
    padding: 1rem 0 .5rem;
}
.section-head h2 {
    font-size: .72rem; font-weight: 700; color: #999;
    letter-spacing: .8px; text-transform: uppercase;
}
.section-head a { font-size: .78rem; color: var(--red); font-weight: 600; }

@media (max-width: 600px) {
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .container  { padding: 0 .4rem; }
    th, td { padding: .55rem .65rem; }
}
