/* 超市销售管理系统 - 自定义样式 */
:root {
    --primary: #4e73df;
    --success: #1cc88a;
    --warning: #f6c23e;
    --danger: #e74a3b;
    --info: #36b9cc;
    --dark: #2c3e50;
    --sidebar-width: 220px;
    --sidebar-collapsed-width: 60px;
    --topbar-height: 50px;
}
body { background: #f0f2f5; font-family: "Microsoft YaHei", sans-serif; margin: 0; }

/* ===== Top Navigation Bar ===== */
.navbar-top {
    height: var(--topbar-height);
    background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
    color: #fff;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1030;
}
.navbar-top-brand { display: flex; align-items: center; gap: 10px; }
.navbar-top-brand a { color: #fff; text-decoration: none; font-weight: bold; font-size: 1.15rem; }
.navbar-top-right { display: flex; align-items: center; gap: 15px; }
.navbar-top-user { font-size: 0.9rem; }
.navbar-top-logout { color: #fff; text-decoration: none; font-size: 0.9rem; opacity: 0.85; }
.navbar-top-logout:hover { opacity: 1; color: #fff; }
.sidebar-toggle {
    background: none; border: none; color: #fff; font-size: 1.4rem;
    cursor: pointer; padding: 2px 6px; border-radius: 4px;
}
.sidebar-toggle:hover { background: rgba(255,255,255,0.15); }

/* ===== Main Layout ===== */
.main-wrapper {
    display: flex;
    margin-top: var(--topbar-height);
    height: calc(100vh - var(--topbar-height));
}

/* ===== Sidebar ===== */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: #2c3e50;
    color: #ecf0f1;
    overflow-y: auto;
    overflow-x: hidden;
    transition: width 0.25s ease, min-width 0.25s ease;
    position: fixed;
    top: var(--topbar-height);
    left: 0;
    bottom: 0;
    z-index: 1020;
}
.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
    min-width: var(--sidebar-collapsed-width);
}
.sidebar.collapsed .sidebar-menu li a span {
    display: none;
}
.sidebar.collapsed .sidebar-menu li a {
    justify-content: center;
    padding: 12px 0;
}
.sidebar.collapsed .sidebar-menu li a i {
    margin-right: 0;
    font-size: 1.2rem;
}
.sidebar-menu {
    list-style: none;
    padding: 8px 0;
    margin: 0;
}
.sidebar-menu li a {
    display: flex;
    align-items: center;
    padding: 11px 20px;
    color: #bdc3c7;
    text-decoration: none;
    font-size: 0.92rem;
    transition: all 0.2s;
    white-space: nowrap;
}
.sidebar-menu li a i {
    margin-right: 10px;
    font-size: 1.05rem;
    width: 20px;
    text-align: center;
}
.sidebar-menu li a:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
}
.sidebar-menu li.active a {
    background: var(--primary);
    color: #fff;
    border-radius: 0;
}

/* ===== Content Area ===== */
.content-area {
    flex: 1;
    overflow-y: auto;
    margin-left: var(--sidebar-width);
    transition: margin-left 0.25s ease;
}
.content-area.sidebar-collapsed {
    margin-left: var(--sidebar-collapsed-width);
}

/* ===== Cards ===== */
.card { border: none; box-shadow: 0 2px 6px rgba(0,0,0,0.08); border-radius: 8px; }
.card-header { font-weight: 600; }

/* ===== Buttons ===== */
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-success { background: var(--success); border-color: var(--success); }
.btn-warning { background: var(--warning); border-color: var(--warning); color: #fff; }
.btn-danger { background: var(--danger); border-color: var(--danger); }

/* ===== Login page ===== */
.login-container { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.login-card { width: 400px; border-radius: 12px; padding: 40px; background: #fff; box-shadow: 0 10px 40px rgba(0,0,0,0.2); }
.login-card h3 { text-align: center; margin-bottom: 30px; color: var(--dark); }

/* ===== POS page ===== */
.pos-container { height: calc(100vh - var(--topbar-height)); overflow: hidden; }
.pos-left, .pos-center, .pos-right { height: 100%; overflow-y: auto; padding: 10px; }
.pos-left { background: #fff; border-right: 1px solid #dee2e6; }
.pos-center { background: #fff; }
.pos-right { background: #f8f9fa; border-left: 1px solid #dee2e6; }

#barcode-input { font-size: 1.2rem; padding: 10px 15px; border: 2px solid var(--primary); border-radius: 8px; }
#barcode-input:focus { box-shadow: 0 0 0 3px rgba(78,115,223,0.25); }

.product-info-card { background: #f8f9fa; border-radius: 8px; padding: 12px; margin-top: 10px; font-size: 0.9rem; }
.product-info-card .label { color: #6c757d; min-width: 70px; display: inline-block; }

.cart-table { font-size: 0.85rem; }
.cart-table th { background: #f8f9fa; position: sticky; top: 0; z-index: 1; font-weight: 600; white-space: nowrap; }
.cart-table td { vertical-align: middle; }
.cart-table .qty-input { width: 60px; text-align: center; }
.cart-item-img { width: 40px; height: 40px; object-fit: contain; background: #f0f0f0; border-radius: 4px; }

.total-bar { background: #fff; border-top: 2px solid var(--primary); padding: 15px; position: sticky; bottom: 0; }
.total-amount { font-size: 1.8rem; font-weight: bold; color: var(--danger); }

.action-buttons .btn { font-size: 1.1rem; padding: 10px 25px; }
.btn-hold { background: #3498db; color: #fff; }
.btn-checkout { background: var(--success); color: #fff; font-weight: bold; }
.btn-clear { background: var(--danger); color: #fff; }

/* Hold order list */
.hold-card { transition: transform 0.15s, box-shadow 0.15s; }
.hold-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important; }
.hold-items-detail { font-size: 0.82rem; max-height: 160px; overflow-y: auto; }
.hold-item-row { display: flex; justify-content: space-between; align-items: center; padding: 3px 0; border-bottom: 1px dotted #eee; }
.hold-item-row:last-child { border-bottom: none; }
.hold-item-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #333; }
.hold-item-qty { width: 40px; text-align: center; color: #666; flex-shrink: 0; }
.hold-item-price { width: 65px; text-align: right; color: #e74c3c; font-weight: 500; flex-shrink: 0; }

/* Order history accordion */
.order-accordion .accordion-button { font-size: 0.9rem; padding: 10px 15px; }
.order-accordion .accordion-body { padding: 10px 15px; }
.order-meta { font-size: 0.85rem; color: #6c757d; }
.order-badge { font-size: 0.75rem; }

/* Product management */
.product-image-thumb { width: 50px; height: 50px; object-fit: contain; background: #f0f0f0; border-radius: 4px; }
.product-img-container { position: relative; display: inline-block; }
.product-img-container.out-of-stock .product-image-thumb { filter: grayscale(100%); opacity: 0.5; }
.product-img-container .out-of-stock-label { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); background: rgba(0,0,0,0.75); color: #fff; padding: 2px 6px; border-radius: 3px; font-size: 10px; white-space: nowrap; }
.spec-row { background: #f8f9fa; padding: 10px; margin-bottom: 5px; border-radius: 4px; }

/* ===== Profit page ===== */
.profit-card {
    border-radius: 10px;
    padding: 20px;
    color: #fff;
    text-align: center;
}
.profit-card .profit-number { font-size: 1.8rem; font-weight: bold; margin-top: 5px; }
.profit-card .profit-label { font-size: 0.9rem; opacity: 0.9; }
.profit-card-orders { background: linear-gradient(135deg, #4e73df, #224abe); }
.profit-card-revenue { background: linear-gradient(135deg, #1cc88a, #13855c); }
.profit-card-profit { background: linear-gradient(135deg, #f6c23e, #dda20a); }

/* ===== VIP Badge ===== */
.vip-badge {
    background: linear-gradient(135deg, #f6c23e, #e2a506);
    color: #fff;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: bold;
}

/* ===== Print styles ===== */
@media print {
    .no-print { display: none !important; }
    body { background: #fff; }
    .receipt-container { width: 100%; max-width: none; margin: 0; padding: 10px; box-shadow: none; }
    .sidebar, .navbar-top { display: none !important; }
    .content-area { margin-left: 0 !important; }
}
.receipt-container { max-width: 800px; margin: 0 auto; background: #fff; padding: 30px; }
.receipt-header { text-align: center; border-bottom: 2px dashed #333; padding-bottom: 15px; margin-bottom: 15px; }
.receipt-header h2 { font-size: 1.5rem; margin-bottom: 5px; }
.receipt-table { width: 100%; border-collapse: collapse; margin: 15px 0; }
.receipt-table th, .receipt-table td { padding: 6px 10px; border-bottom: 1px solid #ddd; text-align: left; }
.receipt-table th { background: #f0f0f0; }
.receipt-total { text-align: right; font-size: 1.2rem; font-weight: bold; padding: 10px 0; border-top: 2px dashed #333; }
.receipt-footer { text-align: center; color: #666; font-size: 0.9rem; padding-top: 15px; border-top: 1px dashed #ccc; }

/* Toast notifications */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 9999; }

/* ===== Image Zoom Overlay ===== */
.image-zoom-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.image-zoom-overlay img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: 8px;
}
.zoomable-img {
    cursor: pointer;
    transition: opacity 0.2s;
}
.zoomable-img:hover {
    opacity: 0.85;
}

/* ===== Pagination Styles ===== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin: 20px 0;
    padding: 0;
    list-style: none;
    flex-wrap: wrap;
}
.pagination li {
    margin: 0;
}
.pagination li a,
.pagination li span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 12px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #5a5a5a;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s ease;
}
.pagination li a:hover {
    color: var(--primary);
    background: #f0f4ff;
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(78, 115, 223, 0.15);
}
.pagination li.active span,
.pagination li.active a {
    color: #fff;
    background: linear-gradient(135deg, var(--primary), #224abe);
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(78, 115, 223, 0.3);
}
.pagination li.disabled span,
.pagination li.disabled a {
    color: #bbb;
    background: #f5f5f5;
    border-color: #e8e8e8;
    cursor: not-allowed;
    pointer-events: none;
}
/* First/Last and Prev/Next buttons */
.pagination li:first-child a,
.pagination li:last-child a {
    font-weight: 600;
}
/* Ellipsis */
.pagination li span.ellipsis {
    border: none;
    background: transparent;
    color: #999;
    min-width: 30px;
    padding: 0;
}
/* Page info text */
.pagination-info {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 10px;
    font-size: 0.85rem;
    color: #666;
}
.pagination-info span {
    background: #f8f9fa;
    padding: 4px 12px;
    border-radius: 15px;
}
/* Pagination wrapper */
.pagination-wrapper {
    padding: 15px 0;
    border-top: 1px solid #eee;
    margin-top: 15px;
}
