/**
 * 医药行业一体化系统 - 主样式文件
 * 专业、清晰、符合医药行业规范的UI设计
 */

/* ========================================
   CSS变量定义
   ======================================== */
:root {
    /* 主色调 - 医药行业专业蓝绿色系 */
    --primary-color: #0891b2;
    --primary-dark: #0e7490;
    --primary-light: #22d3ee;
    --primary-bg: #ecfeff;
    
    /* 辅助色 */
    --secondary-color: #0f766e;
    --accent-color: #f59e0b;
    
    /* 状态色 */
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #3b82f6;
    
    /* 中性色 */
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --bg-light: #f8fafc;
    --bg-white: #ffffff;
    --bg-dark: #0f172a;
    
    /* 阴影 */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    
    /* 圆角 */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    
    /* 过渡 */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    
    /* 侧边栏宽度 */
    --sidebar-width: 260px;
    --sidebar-collapsed: 72px;
}

/* 深色模式变量 */
[data-theme="dark"] {
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: #334155;
    --bg-light: #1e293b;
    --bg-white: #0f172a;
    --bg-dark: #020617;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.2);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.3), 0 2px 4px -2px rgb(0 0 0 / 0.2);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.4), 0 4px 6px -4px rgb(0 0 0 / 0.3);
}

/* 自动深色模式（跟随系统） */
@media (prefers-color-scheme: dark) {
    [data-theme="auto"] {
        --text-primary: #f1f5f9;
        --text-secondary: #94a3b8;
        --text-muted: #64748b;
        --border-color: #334155;
        --bg-light: #1e293b;
        --bg-white: #0f172a;
        --bg-dark: #020617;
        
        --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.2);
        --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.3), 0 2px 4px -2px rgb(0 0 0 / 0.2);
        --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.4), 0 4px 6px -4px rgb(0 0 0 / 0.3);
    }
}

/* ========================================
   全局重置
   ======================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
    background-color: var(--bg-light);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-dark);
}

/* ========================================
   布局结构
   ======================================== */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* 侧边栏 */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--bg-dark) 0%, #1e293b 100%);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1000;
    transition: width var(--transition-normal);
    overflow: hidden;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-logo svg {
    width: 24px;
    height: 24px;
    color: white;
}

.sidebar-title {
    color: white;
    font-size: 1rem;
    font-weight: 600;
    white-space: nowrap;
    opacity: 1;
    transition: opacity var(--transition-fast);
}

.sidebar.collapsed .sidebar-title {
    opacity: 0;
}

/* 导航菜单 */
.sidebar-nav {
    padding: 16px 12px;
    overflow-y: auto;
    height: calc(100vh - 80px);
}

.nav-section {
    margin-bottom: 24px;
}

.nav-section-title {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0 12px;
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar.collapsed .nav-section-title {
    text-align: center;
    padding: 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    color: #cbd5e1;
    border-radius: var(--radius-md);
    margin-bottom: 4px;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.nav-item:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.nav-item.active {
    background: var(--primary-color);
    color: white;
}

.nav-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.nav-item span {
    opacity: 1;
    transition: opacity var(--transition-fast);
}

.sidebar.collapsed .nav-item span {
    opacity: 0;
    width: 0;
}

.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 12px;
}

/* 子菜单 */
.nav-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-normal);
    padding-left: 44px;
}

.nav-item.expanded + .nav-submenu {
    max-height: 500px;
}

.nav-submenu-item {
    display: block;
    padding: 10px 12px;
    color: #94a3b8;
    font-size: 0.9rem;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.nav-submenu-item:hover {
    color: white;
    background: rgba(255,255,255,0.05);
}

.nav-submenu-item.active {
    color: var(--primary-light);
}

/* 主内容区 */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: margin-left var(--transition-normal);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.sidebar.collapsed ~ .main-content {
    margin-left: var(--sidebar-collapsed);
}

/* 顶部导航栏 */
.topbar {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.toggle-sidebar {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.toggle-sidebar:hover {
    background: var(--bg-light);
    color: var(--text-primary);
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.breadcrumb-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.breadcrumb-item::after {
    content: '/';
    color: var(--text-muted);
}

.breadcrumb-item:last-child::after {
    display: none;
}

.breadcrumb-item:last-child {
    color: var(--text-primary);
    font-weight: 500;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-icon-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    position: relative;
    transition: all var(--transition-fast);
}

.topbar-icon-btn:hover {
    background: var(--bg-light);
    color: var(--text-primary);
}

.topbar-icon-btn .badge {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 18px;
    height: 18px;
    background: var(--danger-color);
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-dropdown {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.user-dropdown:hover {
    background: var(--bg-light);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
}

.user-info {
    text-align: left;
}

.user-name {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* 页面内容 */
.page-content {
    flex: 1;
    padding: 24px;
}

.page-header {
    margin-bottom: 24px;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.page-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ========================================
   卡片组件
   ======================================== */
.card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-title svg {
    width: 20px;
    height: 20px;
    color: var(--primary-color);
}

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-light);
}

/* ========================================
   统计卡片
   ======================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 20px;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    transition: all var(--transition-fast);
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-info h3 {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.stat-trend {
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 4px;
}

.stat-trend.up {
    color: var(--success-color);
}

.stat-trend.down {
    color: var(--danger-color);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon svg {
    width: 24px;
    height: 24px;
}

.stat-icon.primary {
    background: var(--primary-bg);
    color: var(--primary-color);
}

.stat-icon.success {
    background: #dcfce7;
    color: var(--success-color);
}

.stat-icon.warning {
    background: #fef3c7;
    color: var(--warning-color);
}

.stat-icon.danger {
    background: #fee2e2;
    color: var(--danger-color);
}

/* ========================================
   表格样式
   ======================================== */
.table-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background: var(--bg-light);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.data-table tbody tr {
    transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
    background: var(--bg-light);
}

.data-table td {
    color: var(--text-primary);
    font-size: 0.9rem;
}

/* ========================================
   状态标签
   ======================================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-success {
    background: #dcfce7;
    color: #166534;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background: #fee2e2;
    color: #dc2626;
}

.badge-info {
    background: #dbeafe;
    color: #1d4ed8;
}

.badge-secondary {
    background: #f1f5f9;
    color: #475569;
}

/* ========================================
   按钮样式
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.btn svg {
    width: 18px;
    height: 18px;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

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

.btn-secondary {
    background: var(--bg-light);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 12px 28px;
    font-size: 1rem;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
}

.btn-group {
    display: flex;
    gap: 8px;
}

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

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.form-label .required {
    color: var(--danger-color);
    margin-left: 2px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    color: var(--text-primary);
    background: var(--bg-white);
    transition: all var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.1);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-control:disabled {
    background: var(--bg-light);
    cursor: not-allowed;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

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

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.form-help {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 6px;
}

.form-error {
    font-size: 0.8rem;
    color: var(--danger-color);
    margin-top: 6px;
}

/* ========================================
   搜索和筛选
   ======================================== */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.search-box {
    position: relative;
    width: 280px;
}

.search-box input {
    width: 100%;
    padding: 10px 14px 10px 40px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    background: var(--bg-white);
}

.search-box svg {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-muted);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group select {
    min-width: 140px;
}

/* ========================================
   分页
   ======================================== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
}

.pagination-info {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.pagination-pages {
    display: flex;
    align-items: center;
    gap: 4px;
}

.pagination-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-color);
    background: var(--bg-white);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: all var(--transition-fast);
}

.pagination-btn:hover:not(:disabled) {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.pagination-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========================================
   模态框
   ======================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-white);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    transform: scale(0.9);
    transition: transform var(--transition-normal);
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-lg {
    max-width: 900px;
}

.modal-xl {
    max-width: 1200px;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--bg-light);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    max-height: calc(90vh - 140px);
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

/* ========================================
   预警提示
   ======================================== */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
}

.alert svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    margin-top: 2px;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.alert-info {
    background: #dbeafe;
    border: 1px solid #93c5fd;
    color: #1e40af;
}

.alert-success {
    background: #dcfce7;
    border: 1px solid #86efac;
    color: #166534;
}

.alert-warning {
    background: #fef3c7;
    border: 1px solid #fcd34d;
    color: #92400e;
}

.alert-danger {
    background: #fee2e2;
    border: 1px solid #fca5a5;
    color: #dc2626;
}

/* ========================================
   Tab选项卡
   ======================================== */
.tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: #f1f5f9;
    border-radius: 10px;
    margin-bottom: 0;
    border-bottom: none;
}

.tab-btn {
    padding: 10px 20px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.tab-btn:hover {
    color: var(--primary-color);
    background: rgba(255, 255, 255, 0.5);
}

.tab-btn.active {
    background: white;
    color: var(--primary-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.tab-item {
    padding: 12px 20px;
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: all var(--transition-fast);
}

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

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

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ========================================
   加载状态
   ======================================== */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ========================================
   空状态
   ======================================== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

/* ========================================
   响应式布局
   ======================================== */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .toolbar-left,
    .toolbar-right {
        width: 100%;
    }
    
    .search-box {
        width: 100%;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .modal {
        margin: 16px;
        max-height: calc(100vh - 32px);
    }
}

/* ========================================
   GSP合规特殊样式
   ======================================== */
.gsp-warning {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border: 1px solid #f59e0b;
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.gsp-warning svg {
    color: #d97706;
    width: 24px;
    height: 24px;
}

.expire-warning {
    color: var(--danger-color);
    font-weight: 500;
}

.cold-chain-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: #dbeafe;
    color: #1d4ed8;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.temperature-normal {
    color: var(--success-color);
}

.temperature-warning {
    color: var(--warning-color);
}

.temperature-danger {
    color: var(--danger-color);
}

/* ========================================
   响应式布局
   ======================================== */
@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
        position: fixed;
        z-index: 1000;
    }
    
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .topbar {
        padding: 0 16px;
    }
    
    .data-table {
        font-size: 13px;
    }
    
    .data-table th,
    .data-table td {
        padding: 10px 8px;
    }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .page-header {
        padding: 16px;
    }
    
    .page-title {
        font-size: 20px;
    }
    
    .card {
        border-radius: var(--radius-md);
    }
    
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .filter-bar {
        flex-direction: column;
    }
    
    .filter-item {
        width: 100%;
    }
    
    .btn {
        padding: 10px 16px;
        font-size: 13px;
    }
    
    .form-row {
        grid-template-columns: 1fr !important;
    }
    
    .detail-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        width: 95%;
        margin: 20px;
        max-height: 90vh;
    }
    
    .topbar-right {
        gap: 8px;
    }
    
    .user-info {
        display: none;
    }
    
    /* 表格响应式 */
    .data-table-responsive {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 480px) {
    .page-content {
        padding: 12px;
    }
    
    .card-body {
        padding: 16px;
    }
    
    .tabs {
        flex-wrap: wrap;
    }
    
    .tab-btn {
        flex: 1;
        min-width: 100px;
        text-align: center;
    }
    
    .btn-group {
        flex-direction: column;
    }
    
    .btn-group .btn {
        width: 100%;
    }
}

/* ========================================
   打印样式
   ======================================== */
@media print {
    .sidebar,
    .topbar,
    .btn,
    .toolbar {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* ========================================
   用户下拉菜单
   ======================================== */
.user-dropdown {
    position: relative;
    cursor: pointer;
}

.user-dropdown .dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    min-width: 180px;
    background: var(--bg-white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-fast);
    z-index: 1000;
}

.user-dropdown.active .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: var(--text-primary);
    text-decoration: none;
    transition: background var(--transition-fast);
}

.dropdown-item:hover {
    background: var(--bg-light);
}

.dropdown-item.text-danger {
    color: var(--danger-color);
}

.dropdown-item.text-danger:hover {
    background: #fef2f2;
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 0;
}

/* ========================================
   模态框 .show 支持（兼容 .active）
   ======================================== */
.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal-overlay.show .modal {
    transform: scale(1);
}

/* ========================================
   高级分页控件
   ======================================== */
.pagination {
    flex-wrap: wrap;
    gap: 12px;
}

.pagination-left,
.pagination-center,
.pagination-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pagination select {
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-white);
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    min-width: 80px;
}

.pagination select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.pagination-jump {
    display: flex;
    align-items: center;
    gap: 6px;
}

.pagination-jump input {
    width: 50px;
    padding: 6px 8px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    text-align: center;
    font-size: 0.9rem;
}

.pagination-jump input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.pagination-jump .btn {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.pagination-buttons {
    display: flex;
    align-items: center;
    gap: 4px;
}

.pagination-buttons .btn {
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
}

/* ========================================
   增强的个人资料页面样式
   ======================================== */
.profile-avatar-large {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    font-size: 32px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
}

.stat-mini {
    text-align: center;
    padding: 12px;
}

.stat-mini .value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-mini .label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.security-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.security-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-light);
    border-radius: var(--radius-md);
}

.security-item .label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.security-item .value {
    font-weight: 500;
    color: var(--text-primary);
}

/* 密码强度指示器 */
.password-strength {
    margin-top: 8px;
}

.strength-bar {
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 4px;
}

.strength-fill {
    height: 100%;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.strength-fill.weak { width: 33%; background: var(--danger-color); }
.strength-fill.medium { width: 66%; background: var(--warning-color); }
.strength-fill.strong { width: 100%; background: var(--success-color); }

.strength-text {
    font-size: 0.8rem;
}

.strength-text.weak { color: var(--danger-color); }
.strength-text.medium { color: var(--warning-color); }
.strength-text.strong { color: var(--success-color); }

/* ========================================
   供应商搜索框
   ======================================== */
.supplier-search-box {
    margin-bottom: 16px;
}

.supplier-search-box input {
    width: 100%;
    padding: 10px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
}

.supplier-search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.1);
}

/* ========================================
   数据卡片网格
   ======================================== */
.data-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.data-card {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: all var(--transition-fast);
}

.data-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

/* ========================================
   空状态样式
   ======================================== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 0.9rem;
}

/* ========================================
   时间线样式
   ======================================== */
.timeline {
    position: relative;
    padding-left: 30px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-color);
}

.timeline-item {
    position: relative;
    padding-bottom: 20px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -24px;
    top: 4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary-color);
    border: 2px solid var(--bg-white);
    box-shadow: 0 0 0 2px var(--primary-color);
}

.timeline-time {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.timeline-content {
    background: var(--bg-light);
    padding: 12px 16px;
    border-radius: var(--radius-md);
}

/* ========================================
   快捷键提示
   ======================================== */
.kbd {
    display: inline-block;
    padding: 2px 6px;
    font-family: monospace;
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-shadow: 0 1px 0 var(--border-color);
}

/* ========================================
   标签输入
   ======================================== */
.tag-input {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    min-height: 44px;
    align-items: center;
}

.tag-input:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.1);
}

.tag-item {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: var(--primary-bg);
    color: var(--primary-color);
    border-radius: 4px;
    font-size: 0.85rem;
}

.tag-item button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    color: inherit;
    opacity: 0.7;
}

.tag-item button:hover {
    opacity: 1;
}

.tag-input input {
    flex: 1;
    min-width: 100px;
    border: none;
    outline: none;
    font-size: 0.95rem;
}

/* ========================================
   响应式优化
   ======================================== */
@media (max-width: 768px) {
    .pagination {
        flex-direction: column;
        align-items: stretch;
    }
    
    .pagination-left,
    .pagination-center,
    .pagination-right {
        justify-content: center;
    }
    
    .toolbar {
        flex-direction: column;
        gap: 12px;
    }
    
    .toolbar-left,
    .toolbar-right {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .form-row {
        flex-direction: column;
    }
    
    .modal {
        margin: 10px;
        max-height: calc(100vh - 20px);
    }
}

/* ========================================
   深色模式特定样式
   ======================================== */
[data-theme="dark"] .card,
[data-theme="dark"] .modal-content {
    background: #1e293b;
}

[data-theme="dark"] .data-table th {
    background: #334155;
}

[data-theme="dark"] .data-table tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
    background: #1e293b;
    border-color: #475569;
    color: #f1f5f9;
}

[data-theme="dark"] input:focus,
[data-theme="dark"] select:focus,
[data-theme="dark"] textarea:focus {
    border-color: var(--primary-color);
    background: #0f172a;
}

/* ========================================
   主题切换按钮
   ======================================== */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    border: none;
    background: var(--bg-light);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.theme-toggle:hover {
    background: var(--primary-bg);
    color: var(--primary-color);
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
}

/* ========================================
   增强的Loading状态
   ======================================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-fast);
}

.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--primary-light);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    color: white;
    margin-top: 16px;
    font-size: 14px;
}

/* ========================================
   空状态样式
   ======================================== */
.empty-state {
    text-align: center;
    padding: 60px 24px;
    color: var(--text-muted);
}

.empty-state svg {
    width: 80px;
    height: 80px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
    margin-bottom: 24px;
}

/* ========================================
   骨架屏加载
   ======================================== */
.skeleton {
    background: linear-gradient(90deg, var(--bg-light) 25%, var(--border-color) 50%, var(--bg-light) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text {
    height: 16px;
    margin-bottom: 8px;
}

.skeleton-text.short {
    width: 60%;
}

.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.skeleton-card {
    height: 120px;
}

/* ========================================
   系统公告横幅
   ======================================== */
.announcement-banner {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

.announcement-banner.urgent {
    background: linear-gradient(135deg, var(--danger-color), #dc2626);
}

.announcement-banner.maintenance {
    background: linear-gradient(135deg, var(--warning-color), #d97706);
}

.announcement-banner-icon {
    flex-shrink: 0;
}

.announcement-banner-content {
    flex: 1;
}

.announcement-banner-title {
    font-weight: 600;
    margin-bottom: 2px;
}

.announcement-banner-text {
    font-size: 13px;
    opacity: 0.9;
}

.announcement-banner-close {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    opacity: 0.7;
    transition: opacity var(--transition-fast);
}

.announcement-banner-close:hover {
    opacity: 1;
}

/* ========================================
   快捷操作面板
   ======================================== */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 12px;
    padding: 16px;
}

.quick-action-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 12px;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    color: var(--text-primary);
}

.quick-action-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.quick-action-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-bg);
    color: var(--primary-color);
}

.quick-action-icon svg {
    width: 20px;
    height: 20px;
}

.quick-action-text {
    font-size: 13px;
    font-weight: 500;
}

/* ========================================
   收藏夹样式
   ======================================== */
.favorite-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: var(--text-muted);
    transition: all var(--transition-fast);
}

.favorite-btn:hover {
    color: var(--warning-color);
}

.favorite-btn.active {
    color: var(--warning-color);
}

.favorite-btn.active svg {
    fill: currentColor;
}

/* ========================================
   进度条
   ======================================== */
.progress {
    height: 8px;
    background: var(--bg-light);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--primary-color);
    border-radius: var(--radius-sm);
    transition: width var(--transition-normal);
}

.progress-bar.success { background: var(--success-color); }
.progress-bar.warning { background: var(--warning-color); }
.progress-bar.danger { background: var(--danger-color); }

/* 带标签的进度条 */
.progress-with-label {
    display: flex;
    align-items: center;
    gap: 12px;
}

.progress-with-label .progress {
    flex: 1;
}

.progress-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    min-width: 40px;
    text-align: right;
}

/* ========================================
   步骤条
   ======================================== */
.steps {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 0;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    flex: 1;
}

.step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 16px;
    left: calc(50% + 24px);
    width: calc(100% - 48px);
    height: 2px;
    background: var(--border-color);
}

.step.completed:not(:last-child)::after {
    background: var(--success-color);
}

.step-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-white);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 14px;
    position: relative;
    z-index: 1;
}

.step.active .step-icon {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.step.completed .step-icon {
    border-color: var(--success-color);
    background: var(--success-color);
    color: white;
}

.step-title {
    margin-top: 8px;
    font-size: 13px;
    color: var(--text-muted);
}

.step.active .step-title {
    color: var(--primary-color);
    font-weight: 500;
}

.step.completed .step-title {
    color: var(--success-color);
}

/* ========================================
   时间线
   ======================================== */
.timeline {
    position: relative;
    padding-left: 32px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: var(--border-color);
}

.timeline-item {
    position: relative;
    padding-bottom: 24px;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-dot {
    position: absolute;
    left: -28px;
    top: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--bg-white);
    border: 2px solid var(--primary-color);
}

.timeline-item.success .timeline-dot {
    border-color: var(--success-color);
    background: var(--success-color);
}

.timeline-item.warning .timeline-dot {
    border-color: var(--warning-color);
    background: var(--warning-color);
}

.timeline-item.danger .timeline-dot {
    border-color: var(--danger-color);
    background: var(--danger-color);
}

.timeline-time {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.timeline-content {
    font-size: 14px;
    color: var(--text-primary);
}

/* ========================================
   数据统计卡片增强
   ======================================== */
.stat-card-mini {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.stat-card-mini-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-card-mini-icon svg {
    width: 24px;
    height: 24px;
}

.stat-card-mini-icon.primary {
    background: var(--primary-bg);
    color: var(--primary-color);
}

.stat-card-mini-icon.success {
    background: #dcfce7;
    color: var(--success-color);
}

.stat-card-mini-icon.warning {
    background: #fef3c7;
    color: var(--warning-color);
}

.stat-card-mini-icon.danger {
    background: #fee2e2;
    color: var(--danger-color);
}

.stat-card-mini-info h4 {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.stat-card-mini-info .value {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
}

/* ========================================
   浮动操作按钮
   ======================================== */
.fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: none;
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    z-index: 100;
}

.fab:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

.fab svg {
    width: 24px;
    height: 24px;
}

/* ========================================
   回到顶部按钮
   ======================================== */
.back-to-top {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-white);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-fast);
    z-index: 100;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.back-to-top svg {
    width: 20px;
    height: 20px;
}

/* ========================================
   表单优化
   ======================================== */
.form-floating {
    position: relative;
}

.form-floating input,
.form-floating textarea {
    padding-top: 24px;
}

.form-floating label {
    position: absolute;
    top: 50%;
    left: 12px;
    transform: translateY(-50%);
    transition: all var(--transition-fast);
    pointer-events: none;
    color: var(--text-muted);
}

.form-floating input:focus ~ label,
.form-floating input:not(:placeholder-shown) ~ label {
    top: 8px;
    transform: translateY(0);
    font-size: 12px;
    color: var(--primary-color);
}

/* 输入框前后缀 */
.input-group {
    display: flex;
    align-items: stretch;
}

.input-group-prepend,
.input-group-append {
    display: flex;
    align-items: center;
    padding: 0 12px;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 14px;
}

.input-group-prepend {
    border-right: none;
    border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.input-group-append {
    border-left: none;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.input-group .form-control {
    border-radius: 0;
}

.input-group .form-control:first-child {
    border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.input-group .form-control:last-child {
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

/* ========================================
   图片上传组件
   ======================================== */
.image-upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    background: var(--bg-light);
}

.image-upload-area:hover {
    border-color: var(--primary-color);
    background: var(--primary-bg);
}

.image-upload-area.dragover {
    border-color: var(--primary-color);
    background: var(--primary-bg);
}

.image-upload-area svg {
    width: 48px;
    height: 48px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.image-upload-area p {
    color: var(--text-secondary);
    margin: 0;
}

.image-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.image-preview-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 2px solid transparent;
    cursor: move;
}

.image-preview-item.is-main {
    border-color: var(--primary-color);
}

.image-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-preview-item .actions {
    position: absolute;
    top: 4px;
    right: 4px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.image-preview-item:hover .actions {
    opacity: 1;
}

.image-preview-item .action-btn {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-preview-item .action-btn:hover {
    background: rgba(0, 0, 0, 0.8);
}

.image-preview-item .main-badge {
    position: absolute;
    bottom: 4px;
    left: 4px;
    background: var(--primary-color);
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
}

/* 产品/供应商/客户头像样式 */
.entity-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    object-fit: cover;
    background: var(--bg-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 18px;
    font-weight: 600;
}

.entity-avatar-lg {
    width: 64px;
    height: 64px;
    font-size: 24px;
}

.entity-avatar-sm {
    width: 32px;
    height: 32px;
    font-size: 14px;
}

/* ========================================
   搜索栏增强
   ======================================== */
.search-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.search-toolbar .search-box {
    flex: 1;
    min-width: 200px;
}

.search-toolbar .btn-search {
    height: 38px;
    padding: 0 16px;
}

/* 搜索按钮样式优化 */
.btn-search {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

/* ========================================
   导出选择器
   ======================================== */
.export-selector {
    position: relative;
}

.export-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    z-index: 100;
    display: none;
}

.export-dropdown.show {
    display: block;
}

.export-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.export-dropdown-item:hover {
    background: var(--bg-light);
}

.export-dropdown-item svg {
    width: 18px;
    height: 18px;
    color: var(--text-muted);
}

/* ========================================
   地图容器
   ======================================== */
.map-container {
    width: 100%;
    height: 400px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg-light);
    position: relative;
}

.map-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.map-placeholder svg {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* ========================================
   电子围栏样式
   ======================================== */
.fence-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.fence-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: var(--bg-light);
    border-radius: var(--radius-md);
}

.fence-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.fence-icon {
    width: 40px;
    height: 40px;
    background: var(--primary-bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
}

.fence-details h4 {
    margin: 0 0 4px 0;
    font-size: 0.95rem;
}

.fence-details p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ========================================
   审核状态选择
   ======================================== */
.audit-status-selector {
    display: flex;
    gap: 12px;
    margin: 16px 0;
}

.audit-status-option {
    flex: 1;
    padding: 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    text-align: center;
    transition: all var(--transition-fast);
}

.audit-status-option:hover {
    border-color: var(--primary-color);
}

.audit-status-option.selected {
    border-color: var(--primary-color);
    background: var(--primary-bg);
}

.audit-status-option.approve {
    --status-color: var(--success-color);
}

.audit-status-option.reject {
    --status-color: var(--danger-color);
}

.audit-status-option.selected.approve {
    border-color: var(--success-color);
    background: #f0fdf4;
}

.audit-status-option.selected.reject {
    border-color: var(--danger-color);
    background: #fef2f2;
}

.audit-status-option svg {
    width: 32px;
    height: 32px;
    margin-bottom: 8px;
}

.audit-status-option.approve svg {
    color: var(--success-color);
}

.audit-status-option.reject svg {
    color: var(--danger-color);
}

/* ========================================
   退货/报损图片上传
   ======================================== */
.damage-image-upload {
    margin-top: 16px;
}

.damage-images {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.damage-image-item {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-md);
    overflow: hidden;
    position: relative;
}

.damage-image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.damage-image-item .remove-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    background: rgba(239, 68, 68, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ========================================
   药品详细信息表单
   ======================================== */
.product-detail-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.product-detail-tab {
    padding: 12px 20px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.product-detail-tab:hover {
    color: var(--text-primary);
}

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

.product-detail-content {
    display: none;
}

.product-detail-content.active {
    display: block;
}

/* ========================================
   库位管理样式
   ======================================== */
.location-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
}

.location-cell {
    aspect-ratio: 1;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.location-cell:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.location-cell.occupied {
    background: #fef3c7;
    border-color: #f59e0b;
}

.location-cell.empty {
    background: #f0fdf4;
    border-color: #10b981;
}

.location-cell .code {
    font-weight: 600;
    font-size: 0.9rem;
}

.location-cell .status {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ========================================
   盘点录入样式
   ======================================== */
.count-input-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.count-input-row:last-child {
    border-bottom: none;
}

.count-product-info {
    flex: 1;
}

.count-input-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.count-input-group input {
    width: 80px;
    text-align: center;
}

.count-variance {
    width: 80px;
    text-align: right;
    font-weight: 500;
}

.count-variance.positive {
    color: var(--success-color);
}

.count-variance.negative {
    color: var(--danger-color);
}

/* ========================================
   报表图表增强
   ======================================== */
.chart-legend {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-top: 16px;
}

.chart-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chart-legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.chart-legend-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ========================================
   工具栏搜索按钮对齐
   ======================================== */
.toolbar-left .btn,
.toolbar-left .form-control,
.toolbar-left .search-box input {
    height: 38px;
}

.toolbar-left .search-box {
    display: flex;
    align-items: center;
}

.toolbar-left .search-box input {
    padding-right: 36px;
}

/* ========================================
   全选复选框样式
   ======================================== */
.select-all-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
}

.select-all-wrapper label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    cursor: pointer;
}

/* ========================================
   日期输入框颜色修复 - 全局优化
   ======================================== */
input[type="date"],
input[type="datetime-local"],
input[type="month"],
input[type="week"],
input[type="time"] {
    color: var(--text-primary) !important;
    color-scheme: light;
    background-color: var(--bg-white);
}

input[type="date"]::-webkit-datetime-edit,
input[type="datetime-local"]::-webkit-datetime-edit {
    color: var(--text-primary);
}

input[type="date"]::-webkit-datetime-edit-year-field,
input[type="date"]::-webkit-datetime-edit-month-field,
input[type="date"]::-webkit-datetime-edit-day-field,
input[type="date"]::-webkit-datetime-edit-text,
input[type="datetime-local"]::-webkit-datetime-edit-year-field,
input[type="datetime-local"]::-webkit-datetime-edit-month-field,
input[type="datetime-local"]::-webkit-datetime-edit-day-field,
input[type="datetime-local"]::-webkit-datetime-edit-hour-field,
input[type="datetime-local"]::-webkit-datetime-edit-minute-field,
input[type="datetime-local"]::-webkit-datetime-edit-text {
    color: var(--text-primary) !important;
    -webkit-text-fill-color: var(--text-primary);
}

input[type="date"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.6;
    transition: opacity var(--transition-fast);
    filter: none;
}

input[type="date"]::-webkit-calendar-picker-indicator:hover,
input[type="datetime-local"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

/* 修复日期输入框placeholder颜色 */
input[type="date"]:not(:valid)::-webkit-datetime-edit,
input[type="date"]::placeholder {
    color: var(--text-muted);
    -webkit-text-fill-color: var(--text-muted);
}

/* 深色模式 */
[data-theme="dark"] input[type="date"],
[data-theme="dark"] input[type="datetime-local"],
[data-theme="dark"] input[type="month"],
[data-theme="dark"] input[type="week"],
[data-theme="dark"] input[type="time"] {
    color-scheme: dark;
    color: var(--text-primary) !important;
}

[data-theme="dark"] input[type="date"]::-webkit-datetime-edit-year-field,
[data-theme="dark"] input[type="date"]::-webkit-datetime-edit-month-field,
[data-theme="dark"] input[type="date"]::-webkit-datetime-edit-day-field,
[data-theme="dark"] input[type="date"]::-webkit-datetime-edit-text {
    color: var(--text-primary) !important;
    -webkit-text-fill-color: var(--text-primary);
}

/* ========================================
   响应式增强
   ======================================== */
@media (max-width: 1024px) {
    .image-preview-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .location-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 768px) {
    .image-preview-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .location-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .audit-status-selector {
        flex-direction: column;
    }
    
    .chart-legend {
        flex-direction: column;
        gap: 8px;
    }
}

/* ========================================
   附件上传样式
   ======================================== */

/* 附件上传区域 */
.attachment-upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    background: var(--bg-light);
}

.attachment-upload-area:hover,
.attachment-upload-area.dragover {
    border-color: var(--primary-color);
    background: var(--primary-bg);
}

.attachment-upload-area svg {
    color: var(--text-muted);
}

.attachment-upload-area:hover svg,
.attachment-upload-area.dragover svg {
    color: var(--primary-color);
}

.attachment-upload-area p {
    margin: 0;
    color: var(--text-secondary);
}

/* 附件筛选按钮 */
.attachment-filter {
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 6px 14px;
    border-radius: var(--radius-md);
    font-size: 13px;
    transition: all var(--transition-fast);
}

.attachment-filter:hover {
    background: var(--bg-white);
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.attachment-filter.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* 附件网格 */
.attachment-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

/* 附件项 */
.attachment-item {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all var(--transition-fast);
}

.attachment-item:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

/* 附件预览 */
.attachment-preview {
    position: relative;
    aspect-ratio: 16/10;
    background: var(--bg-light);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
}

.attachment-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.attachment-preview .attachment-icon {
    width: 48px;
    height: 48px;
    color: var(--text-muted);
}

.attachment-preview .attachment-icon svg {
    width: 100%;
    height: 100%;
}

/* 播放覆盖层 */
.play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 48px;
    height: 48px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.attachment-preview:hover .play-overlay {
    background: var(--primary-color);
    transform: translate(-50%, -50%) scale(1.1);
}

.play-overlay svg {
    width: 20px;
    height: 20px;
    margin-left: 3px;
}

/* 附件信息 */
.attachment-info {
    padding: 12px;
}

.attachment-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 4px;
}

.attachment-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

.attachment-type {
    background: var(--bg-light);
    padding: 2px 6px;
    border-radius: 4px;
}

/* 附件操作按钮 */
.attachment-actions {
    display: flex;
    gap: 4px;
    padding: 0 12px 12px;
}

.attachment-actions .btn {
    flex: 1;
    justify-content: center;
}

/* 附件预览模态框 */
.attachment-preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.attachment-preview-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.attachment-preview-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    transition: all var(--transition-fast);
}

.attachment-preview-close:hover {
    background: var(--danger-color);
}

#attachmentPreviewBody {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 300px;
    min-height: 200px;
}

#attachmentPreviewBody img,
#attachmentPreviewBody video {
    max-width: 100%;
    max-height: 80vh;
    display: block;
}

/* 响应式调整 */
@media (max-width: 1200px) {
    .attachment-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .attachment-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .attachment-upload-area {
        padding: 20px;
    }
}

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