/* ══════════════════════════════════════════
   KHO HÀNG SẴN — kho-hang.css
   Bao Bì Tân Long
══════════════════════════════════════════ */

/* ── HERO ── */
.kh-hero {
    background: var(--primary-navy);
    padding: 2.5rem 2rem 2rem;
    position: relative;
    overflow: hidden;
}

.kh-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(-45deg,
            rgba(255, 255, 255, .012) 0, rgba(255, 255, 255, .012) 1px,
            transparent 1px, transparent 36px);
}

.kh-hero-inner {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    position: relative;
    z-index: 1;
}

.kh-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(229, 62, 62, .15);
    border: 1px solid rgba(229, 62, 62, .35);
    color: #fc8181;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    padding: 4px 12px;
    border-radius: 20px;
    margin-bottom: 12px;
}

.kh-hero-left h1 {
    font-size: 2rem;
    font-weight: 900;
    color: #fff;
    text-transform: uppercase;
    line-height: 1.15;
    margin-bottom: 8px;
}

.kh-em {
    color: var(--accent);
}

.kh-hero-left p {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, .5);
    margin-bottom: 1.5rem;
    line-height: 1.7;
}

.kh-hero-stats {
    display: flex;
    gap: 2.5rem;
}

.kh-stat {
    display: flex;
    flex-direction: column;
}

.kh-stat-n {
    font-size: 1.6rem;
    font-weight: 900;
    color: var(--accent);
    line-height: 1;
}

.kh-stat-l {
    font-size: 11px;
    color: rgba(255, 255, 255, .4);
    margin-top: 3px;
}

.kh-hero-right {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-shrink: 0;
}

.kh-contact-box {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, .07);
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 10px;
    padding: 12px 18px;
    text-decoration: none;
    transition: background .2s;
    min-width: 200px;
}

.kh-contact-box:hover {
    background: rgba(255, 255, 255, .12);
}

.kh-contact-box.kh-zalo {
    border-color: rgba(0, 104, 255, .4);
}

.kh-contact-icon {
    font-size: 1.4rem;
    flex-shrink: 0;
}

.kh-contact-n {
    font-size: 0.95rem;
    font-weight: 700;
    color: #fff;
}

.kh-contact-l {
    font-size: 11px;
    color: rgba(255, 255, 255, .4);
    margin-top: 2px;
}

/* ── FILTER BAR ── */
.kh-filter-bar {
    background: #fff;
    border-bottom: 1px solid #e8edf5;
    position: sticky;
    top: 72px;
    z-index: 100;
}

.kh-filter-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    overflow-x: auto;
}

.kh-tabs {
    display: flex;
    gap: 0;
}

.kh-tab {
    padding: 13px 18px;
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    text-decoration: none;
    border-bottom: 2.5px solid transparent;
    white-space: nowrap;
    transition: all .2s;
}

.kh-tab:hover {
    color: var(--primary);
}

.kh-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.kh-sort-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.kh-sort {
    border: 1px solid #e0eaf5;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 13px;
    color: #475569;
    background: #fff;
    cursor: pointer;
    outline: none;
}

.kh-total {
    font-size: 12px;
    color: #94a3b8;
    white-space: nowrap;
}

/* ── ALERT ── */
.kh-alert {
    max-width: 1280px;
    margin: 1rem auto;
    padding: .85rem 1.5rem;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
}

.kh-alert-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.kh-alert-error {
    background: #fff1f2;
    border: 1px solid #fecdd3;
    color: #9f1239;
}

/* ── BODY + GRID ── */
.kh-body {
    background: #f4f7fb;
    padding: 2rem;
    min-height: 400px;
}

.kh-grid {
    max-width: 1280px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
}

/* ── CARD ── */
.kh-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid #c8955a;
    transition: all .22s;
    display: flex;
    flex-direction: column;
}

.kh-card:hover {
    border-color: #9a6030;
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(155, 100, 60, .2);
}

.kh-card.kh-soldout {
    opacity: .6;
}

.kh-card.kh-soldout:hover {
    transform: none;
    border-color: #e8d5b0;
    box-shadow: none;
}

/* ảnh */
.kh-img-wrap {
    position: relative;
    display: block;
    aspect-ratio: 4 / 3;
    background: #fef3e2;
    overflow: hidden;
}

.kh-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .4s;
}

.kh-card:hover .kh-img-wrap img {
    transform: scale(1.05);
}

.kh-img-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.5rem;
    background: #fef3e2;
}

/* badge */
.kh-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.kh-badge-hot {
    background: #e53e3e;
    color: #fff;
}

.kh-badge-new {
    background: #0d9488;
    color: #fff;
}

.kh-badge-sale {
    background: #f97316;
    color: #fff;
}

.kh-badge-out {
    background: #94a3b8;
    color: #fff;
}

/* tồn kho */
.kh-stock {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(8, 20, 50, .68);
    padding: 5px 10px;
    font-size: 11px;
    color: rgba(255, 255, 255, .85);
    font-weight: 600;
}

.kh-stock-urgent {
    color: #fca5a5;
}

/* body card */
.kh-card-body {
    padding: 13px 14px 15px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.kh-cat {
    font-size: 10px;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 5px;
}

.kh-name {
    font-size: 14px;
    font-weight: 800;
    color: var(--primary-navy);
    line-height: 1.35;
    margin-bottom: 5px;
    text-decoration: none;
    display: block;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.kh-name:hover {
    color: var(--primary);
}

.kh-spec {
    font-size: 11px;
    color: #94a3b8;
    margin-bottom: 10px;
    line-height: 1.5;
}

/* giá */
.kh-price-row {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.kh-price {
    font-size: 20px;
    font-weight: 900;
    color: #e53e3e;
    line-height: 1;
}

.kh-price-out {
    color: #94a3b8;
    font-size: 15px;
}

.kh-unit {
    font-size: 11px;
    color: #94a3b8;
}

.kh-price-old {
    font-size: 12px;
    color: #cbd5e1;
    text-decoration: line-through;
}

.kh-saving {
    font-size: 10px;
    font-weight: 700;
    background: #fff0f0;
    color: #e53e3e;
    padding: 2px 7px;
    border-radius: 4px;
}

/* moq */
.kh-moq {
    font-size: 12px;
    color: var(--primary);
    font-weight: 600;
    background: #f0f7ff;
    border: 1px solid #dce8fb;
    border-radius: 6px;
    padding: 5px 10px;
    margin-bottom: 10px;
}

.kh-moq-urgent {
    color: #b45309;
}

/* actions */
.kh-actions {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 6px;
    margin-bottom: 10px;
    margin-top: auto;
}

.kh-btn-order {
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 7px;
    padding: 9px 0;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background .2s;
}

.kh-btn-order:hover {
    background: var(--primary-dark);
}

.kh-btn-disabled {
    background: #e2e8f0 !important;
    color: #94a3b8 !important;
    cursor: not-allowed;
}

.kh-btn-zalo {
    background: #e8f0fb;
    color: var(--primary);
    border: none;
    border-radius: 7px;
    padding: 9px 11px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    display: flex;
    align-items: center;
    transition: background .2s;
}

.kh-btn-zalo:hover {
    background: #d0e4f8;
}

.kh-btn-phone {
    background: #e8f0fb;
    color: var(--primary);
    border: none;
    border-radius: 7px;
    padding: 9px 11px;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    display: flex;
    align-items: center;
    transition: background .2s;
}

.kh-btn-phone:hover {
    background: #d0e4f8;
}

/* contact row */
.kh-contact-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #f0f4fa;
    padding-top: 8px;
}

.kh-phone {
    font-size: 12px;
    font-weight: 700;
    color: var(--primary);
}

.kh-detail-link {
    font-size: 12px;
    color: #94a3b8;
    text-decoration: none;
}

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

/* empty state */
.kh-empty {
    text-align: center;
    padding: 5rem 2rem;
    max-width: 400px;
    margin: 0 auto;
}

.kh-empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.kh-empty h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-navy);
    margin-bottom: .5rem;
}

.kh-empty p {
    font-size: 0.875rem;
    color: #64748b;
    margin-bottom: 1.5rem;
}

/* pagination */
.kh-pagination {
    max-width: 1280px;
    margin: 2rem auto 0;
    display: flex;
    justify-content: center;
}

/* ── MODAL ĐẶT HÀNG ── */
.kh-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    z-index: 9000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.kh-modal-overlay.open {
    display: flex;
}

.kh-modal {
    background: #fff;
    border-radius: 14px;
    width: 100%;
    max-width: 480px;
    overflow: hidden;
    animation: modalIn .25s ease;
}

@keyframes modalIn {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
}

.kh-modal-head {
    background: var(--primary-navy);
    padding: 1.1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.kh-modal-head h3 {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
}

.kh-modal-close {
    background: rgba(255, 255, 255, .1);
    border: none;
    color: rgba(255, 255, 255, .7);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    transition: background .2s;
}

.kh-modal-close:hover {
    background: rgba(255, 255, 255, .2);
}

.kh-modal-info {
    padding: .85rem 1.5rem;
    background: #f0f7ff;
    border-bottom: 1px solid #dce8fb;
    font-size: 14px;
    color: var(--primary-navy);
    line-height: 1.6;
}

.kh-modal-form {
    padding: 1.25rem 1.5rem;
}

.kh-form-group {
    margin-bottom: 1rem;
}

.kh-form-group label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 5px;
}

.kh-form-group input,
.kh-form-group textarea {
    width: 100%;
    border: 1.5px solid #e0eaf5;
    border-radius: 7px;
    padding: 9px 12px;
    font-size: 14px;
    color: var(--primary-navy);
    outline: none;
    transition: border-color .2s;
}

.kh-form-group input:focus,
.kh-form-group textarea:focus {
    border-color: var(--primary);
}

.kh-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.kh-modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 1.25rem;
}

.kh-btn-primary {
    flex: 1;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 11px 0;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .2s;
}

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

.kh-btn-cancel {
    background: #f0f4fa;
    color: #64748b;
    border: none;
    border-radius: 8px;
    padding: 11px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s;
}

.kh-btn-cancel:hover {
    background: #e2e8f0;
}

/* ── RESPONSIVE ── */
@media (max-width: 1200px) {
    .kh-grid {
        grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    }
}

@media (max-width: 900px) {
    .kh-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    }
}

@media (max-width: 640px) {
    .kh-hero-inner {
        flex-direction: column;
    }

    .kh-hero-right {
        flex-direction: row;
        width: 100%;
    }

    .kh-contact-box {
        flex: 1;
        min-width: 0;
    }

    .kh-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 12px;
    }

    .kh-hero-left h1 {
        font-size: 1.5rem;
    }
}

@media (max-width: 400px) {
    .kh-grid {
        grid-template-columns: 1fr;
    }
}