/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f4f4f4;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 头部样式 */
header {
    background-color: #333;
    color: #fff;
    padding: 10px 0;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    font-size: 24px;
}

nav {
    display: flex;
    align-items: center;
    gap: 20px;
}

nav a {
    color: #fff;
    text-decoration: none;
}

nav a:hover {
    text-decoration: underline;
}

nav span {
    color: #fff;
    font-weight: bold;
}

/* 主要内容样式 */
main {
    margin: 20px 0;
}

.ticket-form {
    background-color: #fff;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.ticket-form h2 {
    margin-bottom: 20px;
    color: #333;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

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

.btn {
    display: inline-block;
    padding: 10px 20px;
    background-color: #333;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s ease;
}

.btn:hover {
    background-color: #555;
}

.btn-edit {
    background-color: #2196f3;
}

.btn-edit:hover {
    background-color: #1976d2;
}

.btn-delete {
    background-color: #f44336;
}

.btn-delete:hover {
    background-color: #d32f2f;
}

.error {
    background-color: #ffebee;
    color: #c62828;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 15px;
}

.success {
    background-color: #e8f5e8;
    color: #2e7d32;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 15px;
}

/* 登录和注册表单 */
.login-form,
.register-form {
    max-width: 400px;
    margin: 50px auto;
    background-color: #fff;
    padding: 30px;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.login-form h2,
.register-form h2 {
    text-align: center;
    margin-bottom: 20px;
    color: #333;
}

/* 工单列表样式 */
.ticket-list {
    background-color: #fff;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.ticket-list h2,
.ticket-list h3 {
    margin-bottom: 20px;
    color: #333;
}

.ticket-item {
    padding: 15px;
    border-bottom: 1px solid #eee;
}

.ticket-item:last-child {
    border-bottom: none;
}

.ticket-item h3 {
    margin-bottom: 5px;
    color: #333;
}

.ticket-meta {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
}

.ticket-actions {
    margin-top: 10px;
    display: flex;
    gap: 10px;
}

.ticket-actions a {
    display: inline-block;
    padding: 5px 10px;
    background-color: #333;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    transition: background-color 0.3s ease;
}

.ticket-actions a:hover {
    background-color: #555;
}

/* 工单详情样式 */
.ticket-detail {
    background-color: #fff;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.ticket-detail h2 {
    margin-bottom: 20px;
    color: #333;
}

.ticket-info {
    margin-bottom: 20px;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 4px;
}

.ticket-description {
    margin-bottom: 20px;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 4px;
}

.assign-ticket {
    margin-bottom: 20px;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 4px;
}

.comments-section {
    margin-top: 30px;
}

.comments-section h3 {
    margin-bottom: 15px;
    color: #333;
}

.comment-item {
    padding: 15px;
    border-bottom: 1px solid #eee;
    margin-bottom: 10px;
}

.comment-meta {
    font-size: 14px;
    color: #666;
    margin-bottom: 5px;
}

.comment-form {
    margin-top: 20px;
    padding: 20px;
    background-color: #f9f9f9;
    border-radius: 4px;
}

/* 用户管理样式 */
.user-list {
    background-color: #fff;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.user-item {
    padding: 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.user-item:last-child {
    border-bottom: none;
}

.user-info {
    flex: 1;
}

.user-info h4 {
    margin-bottom: 5px;
    color: #333;
}

.user-info p {
    font-size: 14px;
    color: #666;
    margin-bottom: 5px;
}

.user-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: #fff;
    margin: 15% auto;
    padding: 20px;
    border-radius: 5px;
    width: 400px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.close {
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #999;
}

.close:hover {
    color: #333;
}

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

.status-pending {
    background-color: #ffeb3b;
    color: #f57f17;
}

.status-in_progress {
    background-color: #2196f3;
    color: #fff;
}

.status-completed {
    background-color: #4caf50;
    color: #fff;
}

/* 优先级标签样式 */
.priority-tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
}

.priority-low {
    background-color: #4caf50;
    color: #fff;
}

.priority-medium {
    background-color: #ff9800;
    color: #fff;
}

.priority-high {
    background-color: #f44336;
    color: #fff;
}

/* ========================================
   全局表格样式模板 - 响应式布局优化
   ======================================== */

/* 基础表格样式 */
.data-table,
.logs-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto; /* 自动调整列宽 */
    background-color: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border-radius: 6px;
    overflow: hidden;
}

/* 表头样式 */
.data-table thead,
.logs-table thead {
    background: linear-gradient(to bottom, #f8f9fa, #e9ecef);
}

.data-table th,
.logs-table th {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
    white-space: nowrap;
    vertical-align: middle;
}

/* 特殊列对齐方式 */
.data-table th.col-order,
.data-table th.col-id,
.data-table th.col-status {
    text-align: center;
}

.data-table td.col-order,
.data-table td.col-id,
.data-table td.col-status {
    text-align: center;
}

/* 单元格样式 */
.data-table td,
.logs-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
    vertical-align: middle;
    font-size: 14px;
    line-height: 1.6; /* 行高为文本高度的 1.6 倍 */
    color: #495057;
}

/* 文本对齐规则：数值型右对齐，文本型左对齐 */
.data-table td.text-right,
.logs-table td.text-right,
.data-table td[style*="text-align: right"],
.logs-table td[style*="text-align: right"] {
    text-align: right;
}

.data-table td.text-center,
.logs-table td.text-center {
    text-align: center;
}

/* 内容自动换行 - 默认允许换行 */
.data-table td,
.logs-table td {
    white-space: normal;
    word-wrap: break-word;
    word-break: break-word;
    max-width: 400px; /* 限制最大宽度，促进换行 */
}

/* 表头不换行 */
.data-table th,
.logs-table th {
    white-space: nowrap;
}

/* 特殊列的换行控制 */
/* 数据表格：第 3、4 列（分类名称、描述）允许更宽松的换行 */
.data-table td:nth-child(3),
.data-table td:nth-child(4),
.data-table th:nth-child(3),
.data-table th:nth-child(4) {
    max-width: 350px;
    min-width: 150px;
}

/* 日志表格：第 5 列（操作详情）允许换行 */
.logs-table td:nth-child(5),
.logs-table th:nth-child(5) {
    max-width: 450px;
    min-width: 150px;
}

/* 操作列不换行 */
.data-table td:last-child,
.logs-table td:last-child,
.data-table td.col-action,
.logs-table td.col-action {
    white-space: nowrap;
    max-width: none;
    min-width: 140px;
}

/* 工单分类表格特殊列控制 */
.data-table .col-order,
.data-table .col-id {
    width: 1%;
    white-space: nowrap;
    text-align: center;
}

.data-table .col-status {
    width: 1%;
    white-space: nowrap;
    text-align: center;
}

.data-table .col-name,
.data-table .col-desc {
    min-width: 180px;
    max-width: 400px;
}

/* 输入框样式优化 */
.data-table .order-input {
    width: 100%;
    min-width: 45px;
    max-width: 55px;
    padding: 4px 6px;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 13px;
}

/* 交替行背景色 */
.data-table tbody tr:nth-child(even),
.logs-table tbody tr:nth-child(even) {
    background-color: #fafbfc;
}

.data-table tbody tr:nth-child(odd),
.logs-table tbody tr:nth-child(odd) {
    background-color: #ffffff;
}

/* 悬停高亮效果 */
.data-table tbody tr:hover,
.logs-table tbody tr:hover {
    background-color: #f1f3f5;
    transition: background-color 0.2s ease;
}

/* 表格滚动容器（用于移动端） */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 6px;
}

/* 状态徽章样式 */
.status-badge {
    display: inline-block;
    padding: 5px 14px;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    line-height: 1.5;
}

.status-badge.active {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status-badge.inactive {
    background-color: #e2e3e5;
    color: #383d41;
    border: 1px solid #d6d8db;
}

/* 操作按钮组样式 */
.action-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
}

.action-buttons .btn {
    padding: 6px 12px;
    font-size: 13px;
    white-space: nowrap;
}

/* 页脚样式 */
footer {
    background-color: #333;
    color: #fff;
    padding: 10px 0;
    text-align: center;
    margin-top: 30px;
}

/* 响应式设计 - 大屏移动设备 */
@media (max-width: 768px) {
    html {
        font-size: 16px;
    }
    
    .container {
        padding: 15px;
    }
    
    header .container {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    header h1 {
        font-size: 1.5rem;
        margin: 0;
    }
    
    nav {
        flex-wrap: wrap;
        gap: 10px;
        width: 100%;
    }
    
    nav a {
        padding: 8px 16px;
        border-radius: 4px;
        background-color: rgba(255, 255, 255, 0.1);
        font-size: 1rem;
    }
    
    .login-form,
    .register-form {
        max-width: 95%;
        margin: 20px auto;
        padding: 25px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    }
    
    .login-form h2,
    .register-form h2 {
        font-size: 1.5rem;
        margin-bottom: 25px;
    }
    
    .ticket-form {
        padding: 20px;
    }
    
    .form-group {
        margin-bottom: 20px;
    }
    
    .form-group label {
        font-size: 1rem;
        margin-bottom: 8px;
    }
    
    .form-group input,
    .form-group textarea,
    .form-group select {
        padding: 15px;
        font-size: 1rem;
        border-radius: 6px;
        border: 1px solid #ddd;
        transition: border-color 0.3s ease;
    }
    
    .form-group input:focus,
    .form-group textarea:focus,
    .form-group select:focus {
        outline: none;
        border-color: #333;
        box-shadow: 0 0 0 2px rgba(51, 51, 51, 0.1);
    }
    
    .btn {
        padding: 15px 30px;
        font-size: 1.1rem;
        border-radius: 6px;
        transition: all 0.3s ease;
        min-height: 48px;
    }
    
    .user-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
        padding: 20px;
    }
    
    .user-info h4 {
        font-size: 1.1rem;
    }
    
    .user-actions {
        align-self: flex-start;
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }
    
    .user-actions .btn {
        width: 100%;
        text-align: center;
    }
    
    .ticket-actions {
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }
    
    .ticket-actions a {
        padding: 12px 24px;
        font-size: 1rem;
        text-align: center;
        border-radius: 6px;
        width: 100%;
    }
    
    .modal-content {
        width: 95%;
        margin: 20% auto;
        padding: 25px;
        border-radius: 8px;
    }
    
    .ticket-list {
        padding: 20px;
    }
    
    .ticket-item {
        padding: 20px;
        margin-bottom: 15px;
        border-radius: 8px;
        border: 1px solid #eee;
    }
    
    .ticket-item h3 {
        font-size: 1.1rem;
        margin-bottom: 10px;
    }
    
    .ticket-meta {
        font-size: 0.9rem;
        margin-bottom: 15px;
    }
    
    .ticket-detail {
        padding: 20px;
    }
    
    .ticket-info,
    .ticket-description {
        padding: 15px;
        border-radius: 6px;
        margin-bottom: 20px;
    }
    
    .comment-item {
        padding: 15px;
        border-radius: 6px;
        margin-bottom: 15px;
    }
    
    .comment-meta {
        font-size: 0.9rem;
        margin-bottom: 10px;
    }
    
    .comment-form {
        padding: 20px;
        border-radius: 6px;
    }
    
    .footer-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 25px;
        padding: 20px;
    }
    
    .footer-section {
        width: 100%;
    }
    
    .footer-section h3 {
        font-size: 1.1rem;
        margin-bottom: 15px;
    }
    
    .footer-section ul li {
        margin-bottom: 12px;
    }
    
    .footer-section ul li a {
        font-size: 1rem;
    }
    
    .footer-bottom {
        margin-top: 25px;
        padding-top: 20px;
    }
    
    .footer-bottom p {
        font-size: 0.9rem;
    }
    
    /* 状态和优先级标签 */
    .status-tag,
    .priority-tag {
        padding: 6px 12px;
        font-size: 0.9rem;
    }
    
    /* 表格响应式优化 - 平板设备 */
    .data-table,
    .logs-table {
        font-size: 0.9rem;
    }
    
    .data-table th,
    .data-table td,
    .logs-table th,
    .logs-table td {
        padding: 10px 12px;
    }
    
    .data-table td:nth-child(3),
    .data-table td:nth-child(4) {
        max-width: 250px;
        min-width: 120px;
    }
    
    .logs-table td:nth-child(5) {
        max-width: 300px;
        min-width: 120px;
    }
    
    /* 工单分类表格移动端优化 */
    .data-table .col-name,
    .data-table .col-desc {
        min-width: 140px;
        max-width: 250px;
    }
    
    /* 表格容器添加横向滚动 */
    .table-responsive {
        overflow-x: auto;
    }
}

/* 响应式设计 - 小屏移动设备 */
@media (max-width: 480px) {
    html {
        font-size: 15px;
    }
    
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 1.3rem;
    }
    
    nav {
        gap: 8px;
    }
    
    nav a {
        padding: 6px 12px;
        font-size: 0.9rem;
    }
    
    .login-form,
    .register-form {
        max-width: 98%;
        margin: 15px auto;
        padding: 20px;
    }
    
    .login-form h2,
    .register-form h2 {
        font-size: 1.3rem;
        margin-bottom: 20px;
    }
    
    .form-group input,
    .form-group textarea,
    .form-group select {
        padding: 12px;
    }
    
    .btn {
        padding: 12px 24px;
        font-size: 1rem;
    }
    
    .ticket-item {
        padding: 15px;
    }
    
    .ticket-detail {
        padding: 15px;
    }
    
    .ticket-info,
    .ticket-description {
        padding: 12px;
    }
    
    .comment-item {
        padding: 12px;
    }
    
    .comment-form {
        padding: 15px;
    }
    
    .footer-content {
        padding: 15px;
    }
    
    /* 表格响应式优化 - 小屏移动设备 */
    .data-table,
    .logs-table {
        font-size: 0.85rem;
    }
    
    .data-table th,
    .data-table td,
    .logs-table th,
    .logs-table td {
        padding: 8px 10px;
    }
    
    /* 移动端表格启用横向滚动 */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* 移动端优化按钮大小 */
    .data-table .btn,
    .logs-table .btn {
        padding: 5px 10px;
        font-size: 12px;
    }
    
    /* 移动端状态徽章优化 */
    .status-badge {
        padding: 4px 10px;
        font-size: 11px;
    }
    
    /* 移动端输入框优化 */
    .data-table .order-input {
        min-width: 40px;
        max-width: 50px;
        padding: 3px 5px;
        font-size: 12px;
    }
    
    /* 移动端列宽优化 */
    .data-table .col-name,
    .data-table .col-desc {
        min-width: 120px;
        max-width: 200px;
    }
}