/* ===== 响应式布局框架（兼容 Bootstrap）===== */

/* 基础重置 */
* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: #333;
}

/* ===== 汉堡菜单按钮（默认隐藏）===== */
.hamburger-btn {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1002;
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transition: all 0.3s;
}

.hamburger-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* ===== 侧边栏 ===== */
.sidebar {
    position: fixed;
    top: 56px;
    left: 0;
    bottom: 0;
    width: 250px;
    background: #001529;
    overflow-y: auto;
    transition: transform 0.3s ease;
    z-index: 1000;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-menu-item {
    padding: 14px 20px;
    color: rgba(255,255,255,0.65);
    cursor: pointer;
    transition: all 0.3s;
    border-left: 3px solid transparent;
}

.sidebar-menu-item:hover,
.sidebar-menu-item.active {
    color: #fff;
    background: rgba(255,255,255,0.1);
    border-left-color: #1890ff;
}

.sidebar-menu-item i {
    margin-right: 10px;
}

/* ===== 遮罩层（手机端显示）===== */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    pointer-events: none;
}

.sidebar-overlay.show {
    pointer-events: auto;
}

/* ===== 主内容区 ===== */
.main-content {
    margin-top: 56px;
    margin-left: 250px;
    padding: 20px;
    min-height: calc(100vh - 56px);
    transition: margin-left 0.3s ease;
}

/* ===== 卡片组件 ===== */
.card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 20px;
    padding: 20px;
    transition: box-shadow 0.3s;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #333;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 10px;
}

/* ===== 按钮 ===== */
.btn {
    display: inline-block;
    min-height: 40px;
    padding: 8px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
    text-decoration: none;
}

.btn-primary {
    background: #1890ff;
    color: white;
}

.btn-primary:hover {
    background: #40a9ff;
}

.btn-success {
    background: #52c41a;
    color: white;
}

.btn-danger {
    background: #ff4d4f;
    color: white;
}

.btn-block {
    width: 100%;
}

/* ===== 表单 ===== */
.form-group {
    margin-bottom: 15px;
}

.form-label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    min-height: 40px;
    padding: 8px 12px;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: #1890ff;
    box-shadow: 0 0 0 2px rgba(24,144,255,0.2);
}

.form-textarea {
    min-height: 100px;
    resize: vertical;
}

.form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.form-col {
    flex: 1;
}

/* ===== 表格 ===== */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

thead {
    background: #fafafa;
}

th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e8e8e8;
}

th {
    font-weight: 600;
    color: #555;
}

tbody tr:hover {
    background: #f5f5f5;
}

/* ===== 网格布局 ===== */
.grid {
    display: grid;
    gap: 20px;
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* ===== 统计卡片 ===== */
.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.stat-value {
    font-size: 32px;
    font-weight: bold;
    margin: 10px 0;
}

.stat-label {
    font-size: 14px;
    opacity: 0.9;
}

/* ===== 徽章 ===== */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge-success {
    background: #f6ffed;
    color: #52c41a;
    border: 1px solid #b7eb8f;
}

.badge-warning {
    background: #fffbe6;
    color: #faad14;
    border: 1px solid #ffe58f;
}

.badge-danger {
    background: #fff1f0;
    color: #ff4d4f;
    border: 1px solid #ffa39e;
}

/* ===== 工具类 ===== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }
.p-10 { padding: 10px; }
.p-20 { padding: 20px; }

/* ===== 平板端适配 (768px - 1023px) ===== */
@media (max-width: 1023px) {
    .sidebar {
        width: 220px;
    }
    
    .main-content {
        margin-left: 220px;
    }
    
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .card {
        padding: 15px;
    }
}

/* ===== 手机端适配 (< 768px) ===== */
@media (max-width: 767px) {
    body {
        font-size: 13px;
    }
    
    /* 显示汉堡菜单按钮 */
    .hamburger-btn {
        display: block;
    }
    
    /* 侧边栏默认隐藏 */
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    /* 显示遮罩层 */
    .sidebar-overlay.show {
        display: block;
    }
    
    /* 主内容占满全屏 */
    .main-content {
        margin-left: 0 !important;
        padding: 70px 15px 15px 15px; /* 顶部留出汉堡按钮空间 */
    }
    
    /* Bootstrap 表格响应式优化 */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    table {
        font-size: 13px;
    }
    
    th, td {
        padding: 8px 6px !important;
        white-space: nowrap;
    }
    
    /* Bootstrap 卡片紧凑布局 */
    .card {
        margin-bottom: 15px;
    }
    
    .card-body {
        padding: 12px;
    }
    
    /* Bootstrap 表单堆叠 */
    .form-row > [class*="col-"] {
        margin-bottom: 10px;
    }
    
    /* Bootstrap 按钮全宽 */
    .btn-mobile-block {
        display: block;
        width: 100%;
        margin-bottom: 8px;
    }
    
    /* 商品卡片单列 */
    .goods-card {
        margin-bottom: 15px;
    }
    
    /* 统计卡片缩小 */
    .stat-value {
        font-size: 24px;
    }
}

/* ===== 小屏手机 (< 480px) ===== */
@media (max-width: 479px) {
    body {
        font-size: 12px;
    }
    
    .main-content {
        padding: 65px 10px 10px 10px;
    }
    
    .hamburger-btn {
        top: 10px;
        left: 10px;
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
    
    table {
        font-size: 12px;
    }
    
    th, td {
        padding: 6px 4px !important;
    }
}

/* ===== 打印样式 ===== */
@media print {
    .navbar,
    .sidebar,
    .hamburger,
    .overlay {
        display: none !important;
    }
    
    .main-content {
        margin: 0;
        padding: 0;
    }
}
