/**
 * 后台管理系统样式
 */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    font-size: 14px;
    color: #333;
    background-color: #f0f2f5;
    line-height: 1.6;
}

a {
    color: #1890ff;
    text-decoration: none;
}

a:hover {
    color: #40a9ff;
}

/* 清除浮动 */
.clearfix::after {
    content: '';
    display: table;
    clear: both;
}

/* 布局容器 */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 卡片样式 */
.card {
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e8e8e8;
    font-size: 16px;
    font-weight: 500;
}

.card-body {
    padding: 20px;
}

/* 按钮样式 */
.btn {
    display: inline-block;
    padding: 8px 16px;
    font-size: 14px;
    border-radius: 4px;
    border: 1px solid #d9d9d9;
    background: #fff;
    color: #333;
    cursor: pointer;
    transition: all 0.3s;
    outline: none;
}

.btn:hover {
    border-color: #1890ff;
    color: #1890ff;
}

.btn-primary {
    background: #1890ff;
    border-color: #1890ff;
    color: #fff;
}

.btn-primary:hover {
    background: #40a9ff;
    border-color: #40a9ff;
    color: #fff;
}

.btn-danger {
    background: #ff4d4f;
    border-color: #ff4d4f;
    color: #fff;
}

.btn-danger:hover {
    background: #ff7875;
    border-color: #ff7875;
    color: #fff;
}

.btn-success {
    background: #52c41a;
    border-color: #52c41a;
    color: #fff;
}

.btn-success:hover {
    background: #73d13d;
    border-color: #73d13d;
    color: #fff;
}

.btn-small {
    padding: 4px 12px;
    font-size: 12px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 输入框样式 */
.input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.input:focus {
    outline: none;
    border-color: #1890ff;
    box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
}

.input-error {
    border-color: #ff4d4f;
}

textarea.input {
    min-height: 80px;
    resize: vertical;
}

/* 选择框样式 */
.select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    font-size: 14px;
    background: #fff;
    cursor: pointer;
}

.select:focus {
    outline: none;
    border-color: #1890ff;
}

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

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

.form-label.required::before {
    content: '*';
    color: #ff4d4f;
    margin-right: 4px;
}

.form-hint {
    margin-top: 4px;
    font-size: 12px;
    color: #999;
}

.form-error {
    margin-top: 4px;
    font-size: 12px;
    color: #ff4d4f;
}

/* 表格样式 */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #e8e8e8;
}

.table th {
    background: #fafafa;
    font-weight: 500;
    color: #333;
}

.table tr:hover {
    background: #f5f5f5;
}

.table img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
}

/* 分页样式 */
.pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-top: 20px;
}

.pagination-item {
    display: inline-block;
    padding: 6px 12px;
    margin-left: -1px;
    border: 1px solid #d9d9d9;
    background: #fff;
    color: #333;
    cursor: pointer;
    transition: all 0.3s;
}

.pagination-item:hover {
    color: #1890ff;
    border-color: #1890ff;
}

.pagination-item.active {
    background: #1890ff;
    border-color: #1890ff;
    color: #fff;
}

.pagination-item.disabled {
    color: #d9d9d9;
    cursor: not-allowed;
}

.pagination-info {
    margin-right: 16px;
    color: #666;
}

/* 状态标签 */
.status-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.status-tag-success {
    background: #f6ffed;
    color: #52c41a;
    border: 1px solid #b7eb8f;
}

.status-tag-warning {
    background: #fffbe6;
    color: #faad14;
    border: 1px solid #ffe58f;
}

.status-tag-danger {
    background: #fff2f0;
    color: #ff4d4f;
    border: 1px solid #ffccc7;
}

.status-tag-info {
    background: #f0f5ff;
    color: #1890ff;
    border: 1px solid #91caff;
}

/* 搜索栏 */
.search-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
    padding: 16px;
    background: #fafafa;
    border-radius: 4px;
}

.search-item {
    display: flex;
    align-items: center;
}

.search-item label {
    margin-right: 8px;
    white-space: nowrap;
}

.search-item .input,
.search-item .select {
    width: auto;
    min-width: 150px;
}

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

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

/* 加载动画 */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #1890ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Toast提示 */
.global-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    padding: 12px 24px;
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    border-radius: 4px;
    font-size: 14px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    z-index: 9999;
}

.global-toast.show {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

/* 加载遮罩 */
.global-loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    z-index: 9998;
}

.global-loading.show {
    opacity: 1;
    visibility: visible;
}

.global-loading .loading-text {
    margin-top: 16px;
    color: #fff;
    font-size: 14px;
}

/* 模态框 */
.global-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    z-index: 9997;
}

.global-modal.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: #fff;
    border-radius: 4px;
    min-width: 400px;
    max-width: 90%;
    animation: modalIn 0.3s;
}

@keyframes modalIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #e8e8e8;
    text-align: right;
}

.modal-footer .btn {
    margin-left: 8px;
}

/* 警告框 */
.global-alert {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    z-index: 9996;
}

.global-alert.show {
    opacity: 1;
    visibility: visible;
}

.alert-content {
    background: #fff;
    border-radius: 4px;
    min-width: 300px;
    max-width: 90%;
    animation: modalIn 0.3s;
}

.alert-body {
    padding: 24px;
}

.alert-footer {
    padding: 16px 24px;
    border-top: 1px solid #e8e8e8;
    text-align: center;
}

/* 响应式 */
@media (max-width: 768px) {
    .search-bar {
        flex-direction: column;
    }
    
    .search-item {
        width: 100%;
    }
    
    .search-item .input,
    .search-item .select {
        width: 100%;
    }
    
    .table {
        font-size: 12px;
    }
    
    .table th,
    .table td {
        padding: 8px;
    }
}
