/* 文本管理系统样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

.container {
    width: 55%; /* 占据页面宽度的五分之四 */
    margin: 0 auto; /* 居中显示 */
    min-height: 100vh;
    background: #fff;
    padding: 20px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

header {
    background-color: #3498db;
    color: white;
    padding: 15px;
    margin-bottom: 20px;
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.back-home {
    background-color: #2980b9;
    color: white;
    padding: 8px 15px;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    transition: background-color 0.3s;
}

.back-home:hover {
    background-color: #1f6dad;
}

h1 {
    color: #2c3e50;
    margin-bottom: 20px;
    text-align: center;
    padding-bottom: 10px;
    border-bottom: 2px solid #2c5f2d;
}

h2 {
    color: #34495e;
    margin: 15px 0;
    font-size: 18px;
}

/* 表单样式 */
.form-section {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 5px;
    margin-bottom: 30px;
}

form {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.form-group {
    flex: 1;
    min-width: 200px;
}

.full-width {
    flex: 100%;
}

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

input[type="text"],
select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    min-height: 100px;
    resize: vertical;
}

button {
    padding: 8px 15px;
    background-color: #2980b9;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #1f6dad;
}

button[type="submit"] {
    background: #27ae60;
}

button[type="submit"]:hover {
    background: #229954;
}

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

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

/* 设置分类列th元素的宽度为3-5厘米 */
table th:nth-child(2) {
    min-width: 3cm;
    max-width: 5cm;
    width: 4cm;
}

th, td {
    padding: 6px 5px; /* 减小水平和垂直内边距 */
    text-align: left;
    border-bottom: 1px solid #ddd;
    max-height: 60px; /* 减小最大高度 */
    overflow: hidden;
}

/* 限制td文本最多显示35个字符 */
td {
    max-width: 500px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

/* 设置信息列和文本内容列的最大宽度 */
.text-content, .info-column {
    max-width: 550px;
  }
table td:nth-child(3) { /* 信息列 */
    max-width: 350px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-right: 5px; /* 减小右边距 */
}

table td:nth-child(4) { /* 复制次数列 */
    width: 70px;
    text-align: center;
    padding-left: 5px; /* 减小左边距 */
}

/* 复制次数不同值的颜色样式 */
.copy-count-value {
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: bold;
    color: white;
}

.copy-green {
    background-color: #2ecc71;
}

.copy-yellow {
    background-color: #f1c40f;
}

.copy-red {
    background-color: #e74c3c;
}

table td:nth-child(5),
table td:nth-child(6) { /* 时间列 */
    width: 120px;
}

table td:nth-child(7) { /* 操作列 */
    width: 100px;
}

th {
    background-color: #2c5f2d;
    color: white;
    font-weight: bold;
    position: sticky;
    top: 0;
}

tr:hover {
    background-color: #f5f5f5;
}

/* 文本内容截断 */
.text-content {
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: help;
}

/* 操作按钮 */
.action-buttons {
    display: flex;
    gap: 5px;
}

.btn-edit {
    background: #f39c12;
    padding: 5px 10px;
    border-radius: 4px;
    color: white;
    text-decoration: none;
    font-size: 12px;
}

.btn-edit:hover {
    background: #e67e22;
}

.btn-delete {
    background: #e74c3c;
    padding: 5px 10px;
    border-radius: 4px;
    color: white;
    text-decoration: none;
    font-size: 12px;
}

.btn-delete:hover {
    background: #c0392b;
}

/* 消息提示 */
.message {
    padding: 10px;
    margin-bottom: 15px;
    border-radius: 4px;
    font-weight: bold;
}

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

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

/* 链接 */
.back-link {
    display: inline-block;
    margin-top: 20px;
    color: #2c5f2d;
    text-decoration: none;
}

.back-link:hover {
    text-decoration: underline;
    color: #3e7c3f;
}

/* 添加按钮样式 */
.add-button {
    padding: 8px 15px;
    border-radius: 4px;
    font-size: 14px;
    transition: background-color 0.3s;
}

/* 模态框样式 */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    width: 90%;
    max-width: 750px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    position: relative;
}

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

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

.close-modal {
    font-size: 24px;
    cursor: pointer;
    color: #666;
    transition: color 0.2s;
}

.close-modal:hover {
    color: #333;
}

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

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.cancel-btn {
    padding: 8px 16px;
    background-color: #f5f5f5;
    color: #333;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.cancel-btn:hover {
    background-color: #e0e0e0;
}

/* 调试信息 */
.debug-info {
    background-color: #f8f9fa;
    padding: 10px;
    margin-top: 20px;
    border-radius: 5px;
    font-family: monospace;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .form-group {
        flex: 100%;
    }
    
    /* 保持按钮横向显示，不使用纵向排列 */
    .btn-edit, .btn-delete {
        text-align: center;
        white-space: nowrap;
    }
}