/* 避雷系统管理后台样式 */
:root {
    --primary-color: #3a6ea5;
    --primary-hover: #2c5282;
    --danger-color: #e53e3e;
    --danger-hover: #c53030;
    --success-color: #38a169;
    --success-hover: #2f855a;
    --text-color: #333;
    --text-muted: #6c757d;
    --light-bg: #f8f9fa;
    --border-color: #ced4da;
    --card-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --header-bg: #343a40;
}

/* 基础样式 */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    background-color: var(--light-bg);
    margin: 0;
    padding: 0;
    color: var(--text-color);
    line-height: 1.5;
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1rem;
}

/* 头部导航 */
.navbar {
    background-color: var(--header-bg);
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.navbar h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 500;
}

.navbar-user {
    display: flex;
    align-items: center;
}

.navbar-user span {
    margin-right: 1rem;
}

.navbar-user a, .navbar-user .btn-link {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    background-color: rgba(255, 255, 255, 0.1);
    transition: background-color 0.2s;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    margin-left: 0.5rem;
}

.navbar-user a:hover, .navbar-user .btn-link:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* 按钮样式 */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    transition: all 0.15s ease-in-out;
    white-space: nowrap;
}

/* 操作按钮容器 */
.action-buttons {
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 2px;
}

.action-buttons .btn {
    flex: 0 0 auto;
    padding: 0.5rem 0.75rem;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-success:hover {
    background-color: var(--success-hover);
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: var(--danger-hover);
}

.btn-default {
    background-color: #f8f9fa;
    color: #212529;
    border-color: #ced4da;
}

.btn-default:hover {
    background-color: #e9ecef;
}

/* 表单样式 */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #495057;
}

.form-control {
    display: block;
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    color: #495057;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    transition: border-color 0.15s ease-in-out;
}

.form-control:focus {
    border-color: var(--primary-color);
    outline: 0;
    box-shadow: 0 0 0 3px rgba(58, 110, 165, 0.2);
}

/* 搜索容器 */
.search-container {
    display: flex;
    margin-bottom: 1.5rem;
    gap: 10px;
    align-items: center;
}

.search-container .form-control {
    flex: 1;
}

.search-container .btn {
    flex: 0 0 auto;
}

/* 分页容器 */
.pagination-container {
    display: flex;
    justify-content: center;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
}

.pagination {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
    flex-wrap: nowrap;
    align-items: center;
}

.pagination li {
    margin: 0 2px;
    display: flex;
    align-items: center;
}

.pagination a {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 36px;
    height: 36px;
    border-radius: 4px;
    text-decoration: none;
    color: var(--text-color);
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.pagination a:hover {
    background-color: #e9ecef;
}

.pagination .active a {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.pagination .disabled a {
    color: #6c757d;
    pointer-events: none;
    background-color: #f8f9fa;
    border-color: #dee2e6;
}

.pagination .ellipsis {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    color: #6c757d;
}

/* 分页图标 */
.pagination-icon {
    display: inline-block;
    width: 10px;
    height: 10px;
    position: relative;
}

.prev-icon:before {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    border-left: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    left: 4px;
    top: 1px;
}

.next-icon:before {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    border-right: 2px solid currentColor;
    border-top: 2px solid currentColor;
    transform: rotate(45deg);
    left: 0;
    top: 1px;
}

/* 搜索信息 */
.search-info {
    margin-bottom: 1rem;
}

.search-summary {
    padding: 0.75rem;
    background-color: #f8f9fa;
    border-radius: 4px;
    border-left: 4px solid var(--primary-color);
    color: var(--text-color);
    font-weight: 500;
}

.search-summary .count {
    font-weight: 600;
    color: var(--primary-color);
}

.search-summary .term {
    font-style: italic;
    background-color: rgba(58, 110, 165, 0.1);
    padding: 2px 4px;
    border-radius: 3px;
}

/* 状态标签 */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
    font-size: 0.85rem;
    font-weight: 500;
}

.status-pending {
    background-color: #ffeeba;
    color: #856404;
}

.status-approved {
    background-color: #d4edda;
    color: #155724;
}

.status-rejected {
    background-color: #f8d7da;
    color: #721c24;
}

/* 表格样式 */
.table-container {
    overflow-x: auto;
    margin-bottom: 1rem;
    border-radius: 8px;
    box-shadow: var(--card-shadow);
}

.table {
    width: 100%;
    border-collapse: collapse;
    background-color: white;
    /* 移除固定布局，允许表格自然扩展 */
    table-layout: auto;
}

.table th,
.table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
    /* 允许内容换行 */
    white-space: normal;
    overflow: visible;
}

/* 设置最小列宽，允许自动扩展 */
.table th:nth-child(1), .table td:nth-child(1) { /* ID列 */
    min-width: 80px;
}
.table th:nth-child(2), .table td:nth-child(2) { /* 原因列 */
    min-width: 120px;
}
.table th:nth-child(3), .table td:nth-child(3) { /* 联系方式列 */
    min-width: 100px;
}
.table th:nth-child(4), .table td:nth-child(4) { /* 帖子列 */
    min-width: 120px;
}
.table th:nth-child(5), .table td:nth-child(5) { /* 时间列 */
    min-width: 100px;
}
.table th:nth-child(6), .table td:nth-child(6) { /* 操作/拒绝理由列 */
    min-width: 100px;
}
.table th:nth-child(7), .table td:nth-child(7) { /* 操作列(拒绝记录) */
    min-width: 100px;
}

.table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #495057;
}

.table tr:last-child td {
    border-bottom: none;
}

.table tr:hover {
    background-color: #f8f9fa;
}

/* 卡片样式 */
.card {
    background-color: white;
    border-radius: 8px;
    box-shadow: var(--card-shadow);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.card-header {
    padding: 1rem 1.5rem;
    background-color: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    font-weight: 600;
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    padding: 1rem 1.5rem;
    background-color: #f8f9fa;
    border-top: 1px solid #e9ecef;
}

/* 标签页样式 */
.tabs {
    display: flex;
    border-bottom: 1px solid #e9ecef;
    margin-bottom: 1.5rem;
}

.tab {
    padding: 1rem 1.5rem;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-muted);
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
}

.tab:hover {
    color: var(--primary-color);
}

.tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* 提示框样式 */
.alert {
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-radius: 4px;
    border-left: 4px solid transparent;
}

.alert-success {
    background-color: #f0fff4;
    color: #2f855a;
    border-left-color: #38a169;
}

.alert-danger {
    background-color: #fff5f5;
    color: #c53030;
    border-left-color: #e53e3e;
}

.alert-info {
    background-color: #ebf8ff;
    color: #2b6cb0;
    border-left-color: #3182ce;
}

/* 自定义弹窗 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-container {
    background-color: white;
    border-radius: 8px;
    max-width: 500px;
    width: 100%;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    transform: translateY(-20px);
    transition: transform 0.3s;
}

.modal-overlay.active .modal-container {
    transform: translateY(0);
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-weight: 600;
    font-size: 1.25rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #6c757d;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e9ecef;
    display: flex;
    justify-content: flex-end;
}

.modal-footer .btn {
    margin-left: 0.5rem;
}

/* 截断内容样式 */
.truncated-content {
    cursor: pointer;
    position: relative;
    padding: 2px 4px;
    border-radius: 3px;
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    transition: background-color 0.2s;
    display: inline-block;
}

.truncated-content:hover {
    background-color: #e9ecef;
}

.truncated-content::after {
    content: '...';
    margin-left: 2px;
    font-size: 0.9em;
}

/* 加载动画 */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(58, 110, 165, 0.2);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 响应式调整 */
@media (max-width: 768px) {
    .navbar {
        padding: 1rem;
        flex-direction: column;
    }
    
    .navbar-user {
        margin-top: 1rem;
    }
    
    .table th,
    .table td {
        padding: 0.5rem;
        font-size: 0.85rem;
    }
    
    .btn {
        padding: 0.3rem 0.5rem;
        font-size: 0.8rem;
        margin: 1px;
    }
    
    .action-buttons .btn {
        padding: 0.25rem 0.4rem;
        font-size: 0.75rem;
    }
    
    /* 移动端分页样式 */
    .pagination a {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
    }
    
    .pagination .ellipsis {
        width: 32px;
        height: 32px;
    }
    
    /* 移动端表格布局调整 */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch; /* 为iOS设备提供平滑滚动 */
    }
    
    .table {
        width: auto;
        min-width: 100%; /* 确保表格至少与容器一样宽 */
    }
    
    .table th:nth-child(1), .table td:nth-child(1) { /* ID列 */
        min-width: 60px;
    }
    .table th:nth-child(2), .table td:nth-child(2) { /* 原因列 */
        min-width: 100px;
    }
    .table th:nth-child(3), .table td:nth-child(3) { /* 联系方式列 */
        min-width: 80px;
    }
    .table th:nth-child(4), .table td:nth-child(4) { /* 帖子列 */
        min-width: 100px;
    }
    .table th:nth-child(5), .table td:nth-child(5) { /* 时间列 */
        min-width: 80px;
    }
    .table th:nth-child(6), .table td:nth-child(6) { /* 操作/拒绝理由列 */
        min-width: 80px;
    }
    .table th:nth-child(7), .table td:nth-child(7) { /* 操作列(拒绝记录) */
        min-width: 100px;
    }
}
