/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

.container {
    max-width: 900px;
    margin: 30px auto;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* 标签页样式 */
.tabs {
    display: flex;
    background-color: #2c3e50;
}

.tab-item {
    padding: 15px 25px;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.tab-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.tab-item.active {
    background-color: #3498db;
    color: #fff;
}

.tab-content {
    min-height: 500px;
}

.tab-pane {
    display: none;
    padding: 20px;
}

.tab-pane.active {
    display: block;
}

/* 面板样式 */
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.panel-header h2 {
    font-size: 22px;
    color: #2c3e50;
}

.panel-body {
    padding: 10px 0;
}

/* 表单样式 */
.form-group {
    margin-bottom: 15px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

input, select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    flex: 1;
    min-width: 50px;
    max-width: 150px;
}

input:focus, select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

label {
    font-weight: 500;
    margin-right: 10px;
    min-width: 100px;
}

/* 特定元素宽度调整 */
#account-input {
    max-width: 200px;
    min-width: 120px;
}

#days-input {
    max-width: 110px;
    min-width: 90px;
}

#start-date-input {
    max-width: 200px;
    min-width: 160px;
}

/* 系统设置页面输入框宽度差异化 */
#token-input {
    max-width: 59%;
    min-width: 230px;
}

#title-input, #sha1-input {
    max-width: 75%;
    min-width: 300px;
}

#extend-days {
    max-width: 80px;
}

/* 表格容器宽度 */
.table-container, 
.sha1-list-container {
    max-width: 100%;
    margin: 0 auto;
}

/* 按钮样式 */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.btn-primary {
    background-color: #3498db;
    color: #fff;
}

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-success {
    background-color: #2ecc71;
    color: #fff;
}

.btn-success:hover {
    background-color: #27ae60;
}

.btn-danger {
    background-color: #e74c3c;
    color: #fff;
}

.btn-danger:hover {
    background-color: #c0392b;
}

.btn-secondary {
    background-color: #95a5a6;
    color: #fff;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
}

/* 表格样式 */
.table-container {
    margin-top: 20px;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    table-layout: fixed;
}

th, td {
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid #ddd;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #2c3e50;
}

tr:hover {
    background-color: #f5f5f5;
}

/* SHA1列表样式 */
.sha1-list-container {
    margin-top: 20px;
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #eee;
    border-radius: 4px;
}

.sha1-list {
    list-style: none;
}

.sha1-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
}

.sha1-item:last-child {
    border-bottom: none;
}

.sha1-item:hover {
    background-color: #f8f9fa;
}

.sha1-value {
    flex: 1;
    word-break: break-all;
}

.sha1-actions {
    display: flex;
    align-items: center;
}

.sha1-checkbox {
    margin-right: 10px;
}

/* 模态框样式 */
.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: 10% auto;
    padding: 25px;
    border-radius: 8px;
    width: 480px;
    max-width: 90%;
    position: relative;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.close {
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
}

.close:hover {
    color: #333;
}

.modal-footer {
    margin-top: 25px;
    display: flex;
    justify-content: center;
    gap: 15px;
}

.modal-footer .btn {
    min-width: 100px;
    padding: 10px 20px;
}

/* 模态框输入框加长 */
.modal .form-group input,
.modal .form-group select {
    max-width: 100%;
    width: 100%;
    padding: 10px 12px;
    font-size: 15px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .tabs {
        flex-wrap: wrap;
    }
    
    .tab-item {
        flex: 1 1 50%;
        text-align: center;
    }
    
    .modal-content {
        width: 90%;
    }
    
    .form-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    input, select, .btn {
        width: 100%;
    }
    
    th, td {
        padding: 6px 8px;
        font-size: 13px;
    }
    
    /* 解决按钮拉伸问题 */
    .btn {
        padding: 8px 10px;
        font-size: 13px;
        white-space: nowrap;
        min-width: auto;
        max-width: none;
        flex: none;
        width: auto !important;
        display: inline-block;
    }
    
    /* 保持按钮组紧凑 */
    .button-group {
        display: flex;
        flex-wrap: nowrap;
        gap: 5px;
        margin-left: 0;
    }
    
    /* 修复操作按钮列宽度问题 */
    #user-table td:last-child {
        white-space: nowrap;
        width: auto !important;
        min-width: 90px;
        padding: 6px 5px;
    }
    
    /* 调整输入框在移动端的宽度 */
    input, select, .btn {
        width: auto !important;
        max-width: 100%;
        min-width: 0;
    }
    
    /* 系统设置页面响应式调整 */
    .section .form-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .section .input-with-buttons {
        flex-direction: column;
        align-items: start;
    }
    
    .section .input-with-buttons input {
        width: 100% !important;
        max-width: 100% !important;
        margin-bottom: 10px;
    }
    
    /* SHA1列表样式优化 */
    .sha1-item {
        flex-wrap: wrap;
        padding: 8px;
    }
    
    .sha1-value {
        width: 100%;
        word-break: break-all;
        margin-bottom: 5px;
        margin-top: 5px;
        overflow-wrap: break-word;
    }
    
    .sha1-item .btn {
        margin-left: auto;
    }
    
    /* 用户操作按钮优化 */
    .user-control .form-group {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    /* 输入框大小调整 */
    #account-input, #start-date-input, #days-input, #role-select {
        width: 100% !important;
        max-width: 100%;
        margin-bottom: 5px;
    }
    
    /* 表格滚动优化 */
    .table-container {
        overflow-x: auto;
    }
    
    table {
        min-width: 600px;
    }
    
    /* 防止清理按钮拉伸 */
    #clean-expired-users {
        height: auto !important;
        line-height: normal;
    }
}

/* 计数标签样式 */
.count-badge {
    display: inline-block;
    background-color: #3498db;
    color: white;
    font-size: 14px;
    padding: 2px 8px;
    border-radius: 12px;
    margin-left: 10px;
    font-weight: normal;
}

/* 警告按钮样式 */
.btn-warning {
    background-color: #f39c12;
    color: #fff;
}

.btn-warning:hover {
    background-color: #e67e22;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

/* 复选框样式优化 */
.user-checkbox, #user-check-all {
    margin: 0;
    display: inline-block;
    vertical-align: middle;
    position: relative;
    z-index: 5;
    width: 18px;
    height: 18px;
}

/* 确保表格中的复选框可见 */
table td:first-child, th:first-child {
    text-align: center;
    vertical-align: middle;
    position: relative;
    padding-left: 8px;
    padding-right: 8px;
    width: 25px;
}

/* 输入框文字溢出时显示省略号 */
input::placeholder {
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}

/* 用户表格第一列样式覆盖 */
#user-table th:first-child, 
#user-table td:first-child {
    background-color: white;
    z-index: 2;
    width: 30px !important;
}

/* 输入框布局优化 */
.user-control .form-group {
    gap: 15px;
    flex-wrap: wrap;
}

/* 消息提示区域样式 */
.message-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1100;
    width: 300px;
}

.message {
    padding: 15px 20px;
    margin-bottom: 15px;
    border-radius: 5px;
    position: relative;
    animation: fadeIn 0.3s ease-out;
    color: #fff;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    border-left: 5px solid;
    transition: opacity 0.5s;
    opacity: 1;
    overflow: hidden;
}

.message-success {
    background-color: #27ae60;
    border-left-color: #2ecc71;
}

.message-error {
    background-color: #c0392b;
    border-left-color: #e74c3c;
}

.message-info {
    background-color: #2980b9;
    border-left-color: #3498db;
}

.message-warning {
    background-color: #f39c12;
    border-left-color: #f1c40f;
}

.message-close {
    position: absolute;
    top: 5px;
    right: 5px;
    cursor: pointer;
    font-size: 16px;
    color: rgba(0,0,0,0.5);
}

.message-close:hover {
    color: rgba(0,0,0,0.8);
}

.message-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    background-color: rgba(255, 255, 255, 0.4);
    width: 100%;
    animation: progress 3s linear forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-20px); }
}

@keyframes progress {
    from { width: 100%; }
    to { width: 0; }
}

/* 小标签样式 */
small {
    display: block;
    color: #777;
    font-size: 12px;
    margin-top: 5px;
}

/* 按钮间距 */
.btn + .btn {
    margin-left: 5px;
}

/* 日期输入框样式 */
input[type="date"] {
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    flex: 1;
    min-width: 100px;
}

input[type="date"]:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

/* 搜索框样式 */
.search-container {
    position: relative;
    display: flex;
    flex: 1;
    min-width: 200px;
}

.search-container input {
    flex: 1;
    padding-right: 40px;
    border-radius: 4px;
    transition: all 0.3s;
}

.search-container input:focus {
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.3);
}

.search-btn {
    position: absolute;
    right: 2px;
    top: 2px;
    bottom: 2px;
    width: 36px;
    height: calc(100% - 4px);
    border-radius: 4px;
    background-color: transparent;
    color: #3498db;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.3s;
}

.search-btn:hover {
    background-color: rgba(52, 152, 219, 0.1);
}

.btn-icon {
    padding: 5px;
    min-width: 36px;
}

/* 可排序表头样式 */
.sortable {
    cursor: pointer;
    position: relative;
    padding-right: 20px;
}

.sortable:hover {
    background-color: #f0f0f0;
}

.sortable::after {
    content: "⇅";
    position: absolute;
    right: 5px;
    color: #999;
    font-size: 12px;
}

.sortable.asc::after {
    content: "↑";
    color: #3498db;
}

.sortable.desc::after {
    content: "↓";
    color: #3498db;
}

/* 管理员样式 */
.admin-account {
    color: #e74c3c;
    font-weight: 600;
}

/* 日志表格样式 */
.logs-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.logs-table th,
.logs-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.logs-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #2c3e50;
}

.logs-table tr:hover {
    background-color: #f5f5f5;
}

.logs-table tr:last-child td {
    border-bottom: none;
}

/* 日志详情样式 */
.log-details-cell {
    max-width: 300px;
    word-break: break-word;
    white-space: normal;
}

.log-account {
    font-weight: 600;
    color: #3498db;
    margin-bottom: 5px;
}

.log-detail {
    margin: 5px 0;
    line-height: 1.4;
}

.old-value {
    color: #e74c3c;
    text-decoration: line-through;
    margin-right: 5px;
}

.new-value {
    color: #2ecc71;
}

/* 撤销按钮样式 */
.undo-action {
    padding: 5px 10px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.undo-action:hover {
    background-color: #2980b9;
}

/* 日志面板工具栏 */
.logs-toolbar {
    display: flex;
    gap: 10px;
    margin: 20px 0;
}

/* 自动日期标记样式 */
.auto-date {
    font-size: 0.85em;
    color: #666;
    font-style: italic;
    margin-left: 5px;
}

/* 新增合并设置页样式 */
.section {
    margin-bottom: 30px;
    border-bottom: 1px solid #eee;
    padding-bottom: 20px;
}

.section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.section h3 {
    font-size: 18px;
    color: #2c3e50;
    margin-bottom: 15px;
}

/* 系统设置页面布局 */
.section .form-group {
    justify-content: flex-start;
    display: flex;
    flex-wrap: nowrap;
}

.button-group {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-left: 8px;
}

.input-with-buttons {
    display: flex;
    align-items: center;
    flex: 1;
}

.input-with-buttons input {
    flex: 1;
}

/* 搜索按钮定位 */
.search-container {
    max-width: 180px;
}

/* 表单布局调整 */
.user-control .form-group {
    justify-content: flex-start;
    align-items: center;
}

/* 按钮组调整 */
.button-group {
    display: flex;
    gap: 8px;
}

/* 复选框容器调整 */
td input[type="checkbox"], th input[type="checkbox"] {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
    z-index: 10;
}

/* 复选框单元格调整，确保足够宽度 */
#user-table th:first-child, 
#user-table td:first-child {
    position: relative;
    width: 40px !important;
    min-width: 40px;
    background-color: #f8f9fa;
    border-right: 1px solid #ddd;
    padding: 0;
}

/* 表格中复选框的样式 */
.user-checkbox, #user-check-all {
    appearance: auto !important; /* 使用浏览器默认样式 */
    opacity: 1 !important;
    pointer-events: auto !important;
    width: 16px !important;
    height: 16px !important;
    display: block;
    position: relative;
    margin: 0 auto;
    padding: 0;
}

/* 确保保存按钮对齐 */
.section .input-with-buttons {
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.section .input-with-buttons input {
    flex: 1;
    max-width: calc(100% - 140px);
}

.section .button-group {
    white-space: nowrap;
    min-width: 130px;
    justify-content: flex-end;
}

/* 日志表格时间列样式 */
.logs-table th:first-child,
.logs-table td:first-child {
    min-width: 180px !important;
    width: 180px !important;
    white-space: normal;
    line-height: 1.3;
    padding: 8px 10px;
    vertical-align: middle;
}

/* 调整日志表格的行高 */
.logs-table tr {
    min-height: 50px;
}

.logs-table td {
    padding: 10px;
}

/* 操作按钮列样式 */
#user-table th:last-child,
#user-table td:last-child {
    min-width: 80px !important;
    width: 80px !important;
}

/* 操作按钮组样式 */
#user-table .button-group {
    display: flex;
    flex-wrap: nowrap;
    gap: 5px;
    justify-content: flex-start;
}

/* 表格横向滚动优化 */
.table-responsive {
    overflow-x: auto;
    width: 100%;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 5px;
}

@media (max-width: 768px) {
    /* 优化操作按钮列宽度 */
    #user-table th:last-child, 
    #user-table td:last-child {
        min-width: 80px !important;
        width: 80px !important;
    }
    
    /* 强制表格足够宽以显示所有内容 */
    #user-table {
        min-width: 750px;
    }
    
    /* 日志表格优化 */
    .logs-table {
        min-width: 650px;
    }
    
    /* 操作按钮样式优化 */
    .btn-sm {
        padding: 4px 8px;
        font-size: 12px;
    }
    
    /* 按钮组样式优化 */
    .button-group {
        display: flex;
        flex-wrap: nowrap !important;
        gap: 3px !important;
    }
    
    /* 优化日志表格中时间列的宽度 */
    .logs-table th:first-child,
    .logs-table td:first-child {
        min-width: 180px !important;
        width: 180px !important;
        padding: 8px;
    }
}

/* 移动端消息提示优化 */
@media (max-width: 768px) {
    .message-container {
        width: 90%;
        max-width: 300px;
        top: auto;
        bottom: 20px;
        right: 10px;
        left: auto;
    }
    
    .message {
        padding: 10px 15px;
        margin-bottom: 10px;
        font-size: 14px;
        opacity: 0.9;
    }
    
    /* 减少动画时间，更快消失 */
    @keyframes progress {
        from { width: 100%; }
        to { width: 0; }
    }
    
    .message-progress {
        animation-duration: 3s;
    }
}

/* 账号点击操作相关样式 */
.clickable-account {
    color: #0066cc;
    text-decoration: none;
    cursor: pointer;
}

.clickable-account:hover {
    color: #004494;
}

/* 确保管理员账号红色显示 */
.admin-account .clickable-account {
    color: #e74c3c;
    font-weight: 600;
}

.admin-account .clickable-account:hover {
    color: #c0392b;
}

/* 删除旧的账号操作菜单样式 */
.account-options-menu, 
.account-options-backdrop, 
.account-options-content, 
.account-options-header, 
.account-options-body,
.account-options-close,
.account-popup-overlay,
.account-popup,
.account-popup-title,
.account-popup-buttons,
.account-popup-close,
.popup-btn,
.popup-btn-blue,
.popup-btn-green,
.popup-btn-red {
    display: none;
}

/* 全新账号操作弹窗样式 */
.account-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.account-modal {
    width: 350px;
    max-width: 90%;
    background-color: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transform: translateY(0);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.account-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #eee;
}

.account-modal-title {
    display: flex;
    align-items: center;
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
}

.account-modal-title i {
    font-size: 22px;
    margin-right: 10px;
    color: #3498db;
}

.account-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: all 0.2s;
}

.account-modal-close:hover {
    color: #333;
    transform: scale(1.1);
}

.account-modal-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.account-action-btn {
    display: flex;
    align-items: center;
    padding: 16px;
    background-color: #f8f9fa;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid #eee;
}

.account-action-btn:hover {
    background-color: #edf6ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
}

#extend-option:hover {
    border-color: #3498db;
}

#edit-option:hover {
    border-color: #2ecc71;
}

#delete-option:hover {
    border-color: #e74c3c;
}

.action-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    margin-right: 15px;
    color: white;
    font-size: 18px;
}

#extend-option .action-icon {
    background-color: #3498db;
}

#edit-option .action-icon {
    background-color: #2ecc71;
}

#delete-option .action-icon {
    background-color: #e74c3c;
}

.action-text {
    font-weight: 500;
    font-size: 15px;
    color: #333;
}

/* 过期账号样式 */
.expired-account {
    background-color: #f5f5f5 !important;
}

.expired-account .clickable-account {
    color: #888 !important;
    text-decoration: line-through !important;
    position: relative;
}

.expired-account .clickable-account::after {
    content: "[已过期]";
    font-size: 12px;
    color: #777;
    margin-left: 5px;
    font-weight: normal;
    text-decoration: none;
}

.expired-account.admin-account .clickable-account {
    color: #999 !important;
}

.expired-date {
    color: #777;
}

/* 过期行样式 */
.expired-row {
    background-color: #f5f5f5 !important;
}

.expired-row:hover {
    background-color: #ececec !important;
}

/* 延期模态框输入框样式 */
#extend-modal .form-group input {
    max-width: 100%;
    width: 100%;
    padding: 10px 12px;
    font-size: 15px;
}

/* 确保两个模态框一致的样式 */
#modal .form-group,
#extend-modal .form-group {
    margin-bottom: 20px;
}

#modal label,
#extend-modal label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

#modal small,
#extend-modal small {
    margin-top: 6px;
    color: #777;
} 