/* 通用样式文件 */
/* 更新日期: 2026-04-18 - 与 unified-styles.css 保持一致 */

/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
        'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
        sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
    font-size: 15px; /* PC端使用稍大的字体 */
}

/* 颜色变量定义 - 与 unified-styles.css 保持一致 */
:root {
    --primary-color: #4CAF50; /* 绿色主题色（安全管理系统） */
    --primary-color-dark: #388E3C;
    --secondary-color: #2196F3;
    --secondary-color-dark: #1976D2;
    --danger-color: #F44336;
    --success-color: #4CAF50;
    --warning-color: #FFC107;
    --info-color: #03A9F4;
    --light-gray: #f8f9fa;
    --medium-gray: #e9ecef;
    --dark-gray: #6c757d;
    --border-color: #e0e0e0;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.2);
    
    /* 响应式尺寸变量 - PC端优化 */
    --sidebar-width: 260px; /* PC端侧边栏稍宽 */
    --sidebar-width-md: 200px;
    --card-padding: 20px; /* PC端卡片内边距更大 */
    --btn-padding: 10px 20px; /* PC端按钮内边距更大 */
    --input-padding: 12px; /* PC端输入框内边距更大 */
}

/* 布局样式 */
.container {
    display: flex;
    min-height: 100vh;
    transition: all 0.3s ease;
}

/* 侧边栏样式 - PC端优化 */
.sidebar {
    width: var(--sidebar-width);
    background-color: #2c3e50;
    color: white;
    padding: 25px 0; /* PC端侧边栏内边距更大 */
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    transition: all 0.3s ease;
    z-index: 1000;
    transform: translateX(0);
    left: 0; /* PC端确保侧边栏始终在左侧显示 */
}

/* 移动端侧边栏切换按钮 - PC端隐藏 */
.sidebar-toggle {
    display: none; /* PC端默认隐藏 */
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 1100;
    padding: 10px;
    background-color: #2c3e50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 20px;
}

.sidebar-header {
    padding: 0 20px 20px;
    border-bottom: 1px solid #34495e;
    margin-bottom: 20px;
}

.sidebar-header h2 {
    margin: 0;
    font-size: 18px;
}

.sidebar-header p {
    font-size: 14px;
    color: #bdc3c7;
}

.sidebar-nav {
    margin-top: 20px;
}

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

.nav-item {
    padding: 0;
}

/* 导航分类标题 */
.nav-item.nav-category {
    margin-top: 0;
    padding: 0;
}

.nav-category-title {
    display: block;
    padding: 14px 22px;
    color: #bdc3c7;
    font-size: 13px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-top: 1px solid #34495e;
    margin-top: 0;
    background-color: rgba(52, 73, 94, 0.3);
    cursor: pointer !important;
    transition: background-color 0.3s ease;
    user-select: none;
}

.nav-category-title:hover {
    background-color: rgba(52, 73, 94, 0.5);
}

.nav-category-title .arrow {
    display: inline-block;
    font-size: 10px;
    margin-right: 5px;
    transition: transform 0.3s ease;
}

/* 子菜单容器 */
.nav-submenu {
    list-style: none;
    padding: 0;
    margin: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    max-height: 1000px;
    opacity: 1;
}

.nav-submenu[style*="display: none"] {
    max-height: 0;
    opacity: 0;
}

/* 导航子项 */
.nav-item.nav-sub-item .nav-link {
    padding-left: 35px !important;
    font-size: 14px !important;
    position: relative !important;
}

.nav-item.nav-sub-item .nav-link:before {
    content: '•';
    position: absolute;
    left: 22px;
    color: #95a5a6;
}

.nav-link {
    display: block !important;
    padding: 14px 22px !important;
    color: #ecf0f1 !important;
    text-decoration: none !important;
    transition: all 0.3s ease !important;
    font-size: 15px !important;
    cursor: pointer !important;
    pointer-events: auto !important;
    position: relative !important;
    z-index: 10 !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    -webkit-tap-highlight-color: transparent !important;
}

.nav-link:hover {
    background-color: #34495e !important;
    color: #fff !important;
}

.nav-link.active {
    background-color: #4CAF50 !important;
    color: #fff !important;
}

/* 确保链接内的文本也可点击 */
.nav-link * {
    pointer-events: none !important;
}

.sidebar-footer {
    position: absolute;
    bottom: 0;
    width: 100%;
    padding: 20px;
    border-top: 1px solid #34495e;
}

.user-info {
    text-align: center;
    margin-bottom: 20px;
}

.user-name {
    font-size: 16px;
    font-weight: bold;
}

.user-role {
    font-size: 12px;
    color: #bdc3c7;
}

.logout-btn {
    display: inline-block;
    padding: 8px 15px;
    text-align: center;
    background-color: #e74c3c;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.3s ease;
    font-size: 14px;
}

.logout-btn:hover {
    background-color: #c0392b;
}

/* 布局容器样式 */
.layout {
    display: flex;
    min-height: 100vh;
}

/* 主内容区样式 - PC端优化 */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width); /* 为固定侧边栏留出空间 */
    padding: 30px 40px; /* PC端使用更大的内边距 */
    transition: all 0.3s ease;
    padding-top: 30px; /* PC端不需要顶部留出空间 */
    min-width: 0; /* 防止内容溢出 */
    overflow-x: auto; /* 添加水平滚动 */
    width: calc(100% - var(--sidebar-width)); /* 确保占满剩余空间 */
    max-width: 1600px; /* PC端限制最大宽度，避免过宽 */
}

/* 头部样式 */
.page-header {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.page-title {
    font-size: 24px;
    margin-bottom: 10px;
    color: #2c3e50;
}

/* 卡片样式 */
.card {
    background-color: white;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    padding: var(--card-padding);
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

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

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #ecf0f1;
}

.card-title {
    font-size: 18px;
    font-weight: bold;
    color: #2c3e50;
}

/* 按钮样式 */
.btn {
    display: inline-block;
    padding: var(--btn-padding);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    outline: none;
}

.btn:active {
    transform: scale(0.98);
}

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

.btn-primary:hover {
    background-color: #1976D2;
}

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

.btn-danger:hover {
    background-color: #D32F2F;
}

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

.btn-success:hover {
    background-color: #388E3C;
}

.btn-secondary {
    background-color: var(--dark-gray);
    color: white;
}

/* 用户端风格按钮 */
.purple-btn {
    background-color: var(--secondary-color);
    color: white;
}

.purple-btn:hover {
    background-color: #5E35B1;
}

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

.blue-btn:hover {
    background-color: #1976D2;
}

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

.red-btn:hover {
    background-color: #D32F2F;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
}

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

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

.form-control {
    width: 100%;
    padding: var(--input-padding);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.3s ease;
    outline: none;
    background-color: white;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.2);
}

.form-control:focus {
    outline: none;
    border-color: #3498db;
}

.form-control.error {
    border-color: #e74c3c;
}

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

.table {
    width: 100%;
    border-collapse: collapse;
    min-width: 640px;
}

.table th,
.table td {
    padding: 14px 16px; /* PC端表格单元格内边距更大 */
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    font-size: 14px; /* PC端表格字体稍大 */
}

.table th {
    background-color: #f8f9fa;
    font-weight: bold;
    color: #2c3e50;
}

.table tr:hover {
    background-color: #f8f9fa;
}

/* 搜索和筛选样式 */
.search-filter {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.search-box {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 200px;
}

.search-input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px 0 0 4px;
    font-size: 14px;
    outline: none;
}

.search-input:focus {
    border-color: var(--primary-color);
}

.search-btn {
    padding: 10px 16px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s ease;
}

.search-btn:hover {
    background-color: #1976D2;
}


/* 分页样式 */
.pagination {
    display: flex;
    justify-content: center;
    margin-top: 20px;
    flex-wrap: wrap;
    gap: 4px;
}

.page-btn {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: white;
    color: #333;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.3s ease;
    min-width: 36px;
    text-align: center;
}

.page-btn:hover {
    background-color: #f8f9fa;
}

.page-btn.active {
    background-color: #3498db;
    color: white;
    border-color: #3498db;
}

/* 通知消息样式 */
.success-message,
.error-message {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;
    position: relative;
    animation: slideDown 0.3s ease;
}

.success-message {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.error-message {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* 动画 */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 状态标签样式 */
.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
}

.status-pending {
    background-color: #fff3cd;
    color: #856404;
}

.status-completed {
    background-color: #d4edda;
    color: #155724;
}

.status-failed {
    background-color: #f8d7da;
    color: #721c24;
}

.status-active {
    background-color: #d1ecf1;
    color: #0c5460;
}

.status-inactive {
    background-color: #e2e3e5;
    color: #383d41;
}

/* 角色标签样式 */
.role-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
}

.role-super {
    background-color: #e91e63;
    color: white;
}

.role-admin {
    background-color: #9c27b0;
    color: white;
}

.role-user {
    background-color: #607d8b;
    color: white;
}

/* PC端优化 - 确保在较大屏幕上使用PC样式 */
@media (min-width: 1200px) {
    .main-content {
        padding: 30px 50px;
    }
    
    .table th,
    .table td {
        padding: 16px 20px;
        font-size: 15px;
    }
    
    .btn {
        padding: 10px 22px;
        font-size: 15px;
    }
    
    .form-control {
        padding: 12px 16px;
        font-size: 15px;
    }
    
    .card {
        padding: 25px;
    }
    
    .page-title {
        font-size: 28px;
    }
    
    .card-title {
        font-size: 20px;
    }
}

/* 响应式设计 - 平板端 */
@media (max-width: 1199px) and (min-width: 769px) {
    :root {
        --sidebar-width: var(--sidebar-width-md);
        --card-padding: 12px;
        --btn-padding: 7px 12px;
    }
    
    .sidebar {
        width: var(--sidebar-width-md);
    }
    
    .main-content {
        margin-left: var(--sidebar-width-md);
    }
    
    .search-filter {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-box {
        margin-bottom: 10px;
    }
    
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}

/* 响应式设计 - 移动端（仅在必要时应用，PC端不应用） */
@media (max-width: 768px) {
    :root {
        --card-padding: 8px;
        --btn-padding: 6px 10px;
        --input-padding: 8px;
    }
    body { font-size: 13px; }
    
    /* 显示侧边栏切换按钮 */
    .sidebar-toggle {
        display: block;
        position: fixed;
        top: 15px;
        left: 15px;
        z-index: 1001;
        background: var(--primary-color);
        color: white;
        border: none;
        border-radius: 4px;
        padding: 8px 12px;
        font-size: 16px;
        cursor: pointer;
    }
    
    /* 默认隐藏侧边栏 */
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
        z-index: 1000;
        transition: transform 0.3s ease;
    }
    
    /* 显示侧边栏时的样式 */
    .sidebar.open {
        transform: translateX(0);
    }
    
    /* 侧边栏遮罩层 */
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        display: none;
    }
    
    .sidebar.open + .sidebar-overlay {
        display: block;
    }
    
    /* 主内容区适应全屏 */
    .main-content {
        margin-left: 0;
        padding-top: 60px;
        padding-left: 12px;
        padding-right: 12px;
        width: 100%;
        max-width: 100%; /* 移动端取消最大宽度限制 */
    }
    
    /* 页面标题优化 */
    .page-title {
        font-size: 18px;
        margin-bottom: 12px;
        text-align: center;
    }
    
    /* 卡片标题优化 */
    .card-title {
        font-size: 16px;
        margin-bottom: 10px;
    }
    
    /* 按钮组垂直排列 */
    .action-buttons {
        flex-direction: column;
        gap: 8px;
    }
    
    /* 按钮样式优化 */
    .btn { width: 100%; text-align: center; font-size: 13px; padding: var(--btn-padding); }
    
    /* 搜索筛选区域优化 */
    .search-filter {
        flex-direction: column;
        gap: 10px;
    }
    
    .search-box {
        width: 100%;
        min-width: auto;
    }
    
    /* 统计卡片样式调整 */
    .stats-container {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
    
    .stat-card { width: 100%; min-width: auto; height: auto; padding: 14px 12px; text-align: center; }
    
    .stat-value { font-size: 22px; margin-bottom: 6px; }
    
    .stat-label { font-size: 12px; }
    
    /* 表格容器优化 */
    .table-container {
        margin: 0 -12px;
        width: calc(100% + 24px);
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* 表格样式优化 */
    .table { min-width: 520px; }
    
    .table th,
    .table td { padding: 10px 6px; font-size: 12px; white-space: nowrap; }
    
    /* 表单元素优化 */
    .form-group { margin-bottom: 12px; }
    
    .form-label { font-size: 13px; margin-bottom: 6px; }
    
    .form-control { font-size: 13px; padding: var(--input-padding); height: 38px; -webkit-appearance: none; appearance: none; border-radius: 6px; }
    
    /* 分页优化 */
    .pagination { flex-wrap: wrap; gap: 4px; justify-content: center; }
    
    .page-btn { padding: 8px 10px; font-size: 12px; min-width: 34px; margin: 1px; }
    
    /* 内容卡片优化 */
    .content-card { width: 100%; margin: 0; padding: 12px; }
    
    /* 卡片头部优化 */
    .card-header { flex-direction: column; align-items: stretch; gap: 10px; padding-bottom: 10px; }
    
    /* 响应式图片 */
    img { max-width: 100%; height: auto; }
    
    /* 隐藏不必要的元素 */
    .desktop-only { display: none !important; }
    
    /* 显示移动端专用元素 */
    .mobile-only {
        display: block !important;
    }
}

/* 超小屏紧凑模式（进一步缩小） */
@media (max-width: 420px) {
    body { font-size: 12px; }
    :root { --card-padding: 6px; --btn-padding: 5px 8px; --input-padding: 6px; }
    .page-title { font-size: 16px; }
    .card-title { font-size: 14px; }
    .stat-card { padding: 10px 8px; }
    .stat-value { font-size: 18px; }
    .btn { font-size: 12px; }
    .form-control { height: 34px; font-size: 12px; }
    .table { min-width: 440px; }
    .table th, .table td { font-size: 11px; padding: 8px 6px; }
}

/* ============================================
   统一图片上传和预览样式（与 unified-styles.css 保持一致）
   ============================================ */

.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    background-color: #fafafa;
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background-color: rgba(76, 175, 80, 0.05);
}

.image-preview-container {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 12px 0;
}

.image-preview-item {
    position: relative;
    width: 120px;
    height: 90px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.image-preview-item:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.preview-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
    display: block;
}

.delete-image-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    background-color: var(--danger-color);
    color: white;
    border: 2px solid white;
    border-radius: 50%;
    font-size: 14px;
    font-weight: bold;
    line-height: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s ease;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.delete-image-btn:hover {
    background-color: #d32f2f;
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.delete-image-btn:active {
    transform: scale(0.95);
}

/* 手写签名样式 */
.signature-container {
    margin: 16px 0;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: white;
}

.signature-canvas {
    border: 2px solid var(--border-color);
    border-radius: 4px;
    background-color: white;
    cursor: crosshair;
    touch-action: none;
    max-width: 100%;
    width: 100%;
    height: auto;
}

.signature-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}