﻿/* ============================================
   Material Management System v2.0
   现代简约设计 - 高级配色
   ============================================ */

:root {
    /* 主色调 - 深蓝灰系 */
    --bg-primary: #f0f2f5;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f7f8fa;
    --bg-input: #f7f8fa;
    --bg-overlay: rgba(15, 23, 42, 0.5);
    
    /* 文字色 */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-accent: #0ea5e9;
    
    /* 主题色 - 天蓝色系 */
    --accent: #0ea5e9;
    --accent-light: #38bdf8;
    --accent-dark: #0284c7;
    --accent-gradient: linear-gradient(135deg, #0ea5e9 0%, #06b6d4 100%);
    --accent-bg: rgba(14, 165, 233, 0.08);
    
    /* 边框 */
    --border: #e2e8f0;
    --border-light: #cbd5e1;
    
    /* 状态色 */
    --status-pending: #64748b;
    --status-in-progress: #0ea5e9;
    --status-completed: #10b981;
    --status-archived: #94a3b8;
    
    /* 功能色 */
    --danger: #f43f5e;
    --danger-bg: rgba(244, 63, 94, 0.08);
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.08);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.08);
    
    /* 圆角 */
    --radius-xs: 4px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
}

/* === 基础重置 === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* === 三栏布局 === */
.app-container {
    display: flex;
    height: 100vh;
    width: 100%;
    overflow: hidden;
}

/* 左导航栏 (60px) */
.sidebar {
    width: 60px;
    min-width: 60px;
    height: 100vh;
    background: linear-gradient(180deg, #4a5568 0%, #2d3748 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 0;
    z-index: 100;
    border-right: 1px solid rgba(255,255,255,0.1);
}

.sidebar-item {
    width: 100%;
    padding: 12px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: rgba(255,255,255,0.7);
    font-size: 11px;
    font-weight: 500;
    transition: all 0.2s;
    position: relative;
}

.sidebar-item:active {
    background: rgba(255,255,255,0.1);
}

.sidebar-item.active {
    color: #fff;
    font-weight: 600;
}

.sidebar-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: #fff;
    border-radius: 0 3px 3px 0;
}

.sidebar-icon {
    font-size: 20px;
    margin-bottom: 4px;
}

.sidebar-manage {
    margin-top: auto;
    border-top: 1px solid rgba(255,255,255,0.2);
    padding-top: 12px;
    width: 100%;
    position: relative;
}

.sidebar-manage-btn {
    width: 100%;
    padding: 16px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: rgba(255,255,255,0.7);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
}

.sidebar-manage-btn:active {
    color: #fff;
}

.sidebar-manage-menu {
    display: none;
    position: absolute;
    left: 100%;
    bottom: 0;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    min-width: 140px;
    padding: 8px 0;
    margin-bottom: 10px;
    z-index: 200;
}

.sidebar-manage-menu.show {
    display: block;
}

.sidebar-manage-menu a {
    display: block;
    padding: 14px 18px;
    color: #333;
    text-decoration: none;
    font-size: 15px;
}

.sidebar-manage-menu a:active {
    background: #4a5568;
    color: #fff;
}

/* 右导航栏 (60px) */
.right-category-bar {
    width: 60px;
    min-width: 60px;
    background: linear-gradient(180deg, #fafafa 0%, #f0f0f0 100%);
    border-left: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    padding: 8px 4px;
    gap: 4px;
    overflow-y: auto;
    scrollbar-width: none;
}

.right-category-bar::-webkit-scrollbar {
    display: none;
}

.right-category-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 2px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    color: #555;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    text-align: center;
    line-height: 1.3;
    min-height: 44px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.right-category-btn:active {
    transform: scale(0.96);
    background: #f5f5f5;
}

.right-category-btn.active {
    background: linear-gradient(135deg, #4a5568, #2d3748);
    color: #fff;
    box-shadow: 0 2px 8px rgba(74,85,104,0.3);
}

/* 中间内容区 */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    width: 100%;
    background: #f5f5f5;
}

.page {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.fixed-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: #fff;
}

.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #fff;
    border-bottom: 1px solid #eee;
}

.top-bar-title {
    font-size: 17px;
    font-weight: 700;
    color: #333;
}

.top-bar-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-new-material {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #fff;
    border: none;
    box-shadow: 0 2px 8px rgba(16,185,129,0.3);
    padding: 12px 20px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    min-height: 44px;
}

.btn-new-material:active {
    transform: scale(0.96);
}

.btn-trash {
    background: #f5f5f5;
    color: #666;
    border: none;
    padding: 12px 16px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 15px;
    min-height: 44px;
    min-width: 44px;
}

.btn-trash:active {
    background: #eee;
}

.btn-trash.active {
    background: #fee;
    color: #c00;
}

.search-bar {
    padding: 10px 14px;
    background: #fff;
    border-bottom: 1px solid #eee;
}

.search-input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f5f5f5;
    border-radius: 10px;
    padding: 0 12px;
    border: 1px solid #e0e0e0;
}

.search-input-wrapper:focus-within {
    border-color: #4a5568;
    background: #fff;
}

.search-icon {
    font-size: 16px;
    color: #999;
}

.search-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 10px 0;
    font-size: 14px;
    outline: none;
}

.content-wrapper {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.content-container {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.content-container::-webkit-scrollbar {
    display: none;
}

/* 卡片样式 */
.material-card {
    background: #fff;
    border-radius: 14px;
    margin-bottom: 12px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    cursor: pointer;
}

.material-card:active {
    transform: scale(0.98);
}

.material-header {
    display: flex;
    align-items: center;
    gap: 14px;
}

.material-thumb {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    background: linear-gradient(135deg, #4a5568, #2d3748);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #fff;
    overflow: hidden;
    flex-shrink: 0;
}

.material-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.material-info {
    flex: 1;
    min-width: 0;
}

.material-name {
    font-weight: 600;
    font-size: 15px;
    color: #333;
}

.material-meta {
    font-size: 12px;
    color: #888;
    margin-top: 3px;
}

/* 统计面板 */
.stats-panel {
    display: flex;
    gap: 8px;
    padding: 8px 12px;
    background: #fff;
}

.stat-card {
    flex: 1;
    text-align: center;
    padding: 6px;
    background: #f8f9fa;
    border-radius: 8px;
}

.stat-value {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.stat-label {
    font-size: 11px;
    color: #888;
    margin-top: 2px;
}

/* 回收站 */
.trash-section {
    display: none;
    background: #fff;
    border-top: 1px solid #eee;
    padding: 14px 16px;
}

.trash-section.show {
    display: block;
}

.trash-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.trash-title {
    font-size: 14px;
    font-weight: 600;
    color: #c00;
}

.trash-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: #fef2f2;
    border-radius: 10px;
    margin-bottom: 8px;
}

/* 模态框 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal-overlay.show {
    display: flex !important;
}

.modal-content {
    background: #fff;
    border-radius: 18px;
    padding: 20px;
    width: 92%;
    max-width: 440px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 12px 48px rgba(0,0,0,0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    color: #333;
}

.modal-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #f5f5f5;
    border: none;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
}

/* 空白状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.empty-title {
    font-size: 16px;
    font-weight: 600;
    color: #666;
}

/* ============ Responsive ============ */

@media (max-width: 768px) {
  .sidebar { width: 48px; min-width: 48px; }
  .right-category-bar { width: 48px; min-width: 48px; }
  .top-bar { padding: 10px 12px; }
  .top-bar-title { font-size: 15px; }
  .btn-new-material { padding: 8px 14px; font-size: 13px; border-radius: 10px; min-height: 38px; }
  .search-bar { padding: 8px 10px; }
  .search-input-wrapper { padding: 8px 12px; }
  .content-container { padding: 8px; }
  .material-card { padding: 12px; border-radius: 12px; margin-bottom: 8px; }
  .material-thumb { width: 42px; height: 42px; border-radius: 10px; font-size: 18px; }
  .material-name { font-size: 14px; }
  .material-meta { font-size: 11px; }
  .stats-panel { gap: 6px; padding: 8px 10px; }
  .stat-card { padding: 8px; border-radius: 8px; }
  .stat-value { font-size: 16px; }
  .stat-label { font-size: 10px; }
  .btn-trash { padding: 8px 12px; font-size: 13px; min-height: 38px; min-width: 38px; }
  .modal-content { width: 96%; max-width: 96vw; border-radius: 14px; padding: 16px; }
  .modal-header h2 { font-size: 16px; }
}

@media (max-width: 480px) {
  /* === Sidebar: 左侧 → 底部 Tab Bar === */
  .sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    width: 100%;
    min-width: 100%;
    height: 56px;
    flex-direction: row;
    padding: 0;
    z-index: 200;
    border-right: none;
    border-top: 1px solid rgba(255,255,255,0.2);
  }
  .sidebar-item {
    flex: 1;
    padding: 6px 0;
    flex-direction: column;
    font-size: 10px;
  }
  .sidebar-icon { font-size: 18px; margin-bottom: 2px; }
  .sidebar-item.active::before {
    left: 50%;
    top: 0;
    bottom: auto;
    transform: translateX(-50%);
    width: 20px;
    height: 3px;
    border-radius: 0 0 3px 3px;
  }
  .sidebar-manage {
    margin-top: 0;
    border-top: none;
    padding-top: 0;
  }
  .sidebar-manage-btn { padding: 6px 0; font-size: 10px; }
  .sidebar-manage-menu {
    left: 50%;
    bottom: 56px;
    transform: translateX(-50%);
    margin-bottom: 0;
  }

  /* === 主内容区底部留出 Tab Bar 空间 === */
  .main-content { padding-bottom: 60px; }

  /* === 右分类栏：隐藏 + 浮层唤起 === */
  .right-category-bar { width: 0; min-width: 0; overflow: hidden; border-left: none; }
  .right-category-bar.show {
    position: fixed;
    right: 0;
    top: 0;
    height: 100vh;
    width: 60px;
    min-width: 60px;
    z-index: 250;
    box-shadow: -2px 0 12px rgba(0,0,0,0.1);
  }

  /* 右栏遮罩层 */
  .category-bar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.3);
    z-index: 240;
  }
  .category-bar-overlay.show { display: block; }

  /* 筛选唤起按钮 */
  .btn-category-filter {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #f5f5f5;
    color: #666;
    border: 1px solid #e0e0e0;
    padding: 6px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    min-height: 34px;
  }
  .btn-category-filter:active { background: #eee; }

  .top-bar-title { font-size: 14px; }
  .search-input { font-size: 13px; }
  .material-card { border-radius: 10px; }
  .btn-new-material { padding: 6px 12px; font-size: 12px; min-height: 34px; }
  .stats-panel { flex-wrap: wrap; }
  .stat-card { min-width: 60px; }
}

/* ============ Desktop (>= 769px) ============ */
@media (min-width: 769px) {
    /* 电脑端约束最大宽度，居中显示 */
    .app-container {
        max-width: 960px;
        margin: 0 auto;
        box-shadow: 0 0 30px rgba(0,0,0,0.08);
    }

    /* 电脑端左导航加宽，显示文字 */
    .sidebar {
        width: 80px;
        min-width: 80px;
    }
    .sidebar-item {
        padding: 14px 0;
        font-size: 12px;
    }
    .sidebar-icon {
        font-size: 22px;
        margin-bottom: 4px;
    }
    .sidebar-manage-btn {
        font-size: 12px;
    }

    /* 右分类栏加宽 */
    .right-category-bar {
        width: 72px;
        min-width: 72px;
    }
    .right-category-btn {
        font-size: 12px;
        min-height: 50px;
    }

    /* 卡片更大间距 */
    .material-card {
        padding: 18px;
        border-radius: 14px;
    }
    .material-thumb {
        width: 56px;
        height: 56px;
    }

    /* 搜索框更大 */
    .search-input {
        padding: 12px 0;
        font-size: 15px;
    }

    /* 弹窗更宽 */
    .modal-content {
        max-width: 520px;
        border-radius: 20px;
    }

    /* 统计面板更大 */
    .stat-value {
        font-size: 20px;
    }
    .stat-card {
        padding: 10px;
    }
}

/* ============ Tablet (481px - 768px) ============ */
@media (min-width: 481px) and (max-width: 768px) {
    .app-container {
        max-width: 100%;
    }

    .sidebar {
        width: 56px;
        min-width: 56px;
    }
    .sidebar-item {
        padding: 10px 0;
        font-size: 10px;
    }
    .sidebar-icon {
        font-size: 19px;
    }

    .right-category-bar {
        width: 56px;
        min-width: 56px;
    }
    .right-category-btn {
        font-size: 11px;
        min-height: 46px;
    }

    .top-bar {
        padding: 10px 14px;
    }
    .top-bar-title {
        font-size: 16px;
    }

    .material-card {
        padding: 14px;
    }
    .material-thumb {
        width: 48px;
        height: 48px;
    }
    .material-name {
        font-size: 14px;
    }

    .content-container {
        padding: 10px;
    }

    .stats-panel {
        gap: 6px;
    }

    .btn-new-material {
        padding: 10px 16px;
        font-size: 14px;
    }

    .modal-content {
        max-width: 480px;
        border-radius: 16px;
    }
}

/* ============ Card Levels ============ */

.card-level-1 {
  box-shadow: 0 4px 16px rgba(74, 85, 104, 0.12);
  border-left: 4px solid #4a5568;
  background: #fff;
}
.card-level-1:hover {
  box-shadow: 0 8px 24px rgba(74, 85, 104, 0.18);
  transform: translateY(-2px);
}

.card-level-2 {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  background: #fff;
}
.card-level-2:hover { box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); }

.card-level-3 {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  box-shadow: none;
}
.card-level-3:hover { background: #f1f3f5; }

/* ============ Global Responsive Helpers ============ */

/* 响应式图片 */
img {
    max-width: 100%;
    height: auto;
}

/* 表格在小屏横向滚动 */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* 弹窗在小屏全屏化 */
@media (max-width: 480px) {
    .modal-content {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 100vh !important;
        border-radius: 0 !important;
        min-height: 100vh;
    }
    .modal-overlay {
        align-items: flex-start !important;
    }
}

/* 表格响应式 */
@media (max-width: 768px) {
    table {
        font-size: 13px;
    }
    table td, table th {
        padding: 8px 6px;
    }
}

@media (max-width: 480px) {
    table {
        font-size: 12px;
    }
    table td, table th {
        padding: 6px 4px;
    }
}