/* ==========================================================================
   公共样式文件
   Author: hujilong
   ========================================================================== */

/* 图标字体（预留，可替换为iconfont或Font Awesome） */
.icon {
    display: inline-block;
    font-style: normal;
    vertical-align: middle;
    line-height: 1;
}

/* 简单的图标占位样式 */
.icon::before {
    content: '';
    display: inline-block;
    width: 1em;
    height: 1em;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

/* ==================== 工具类 ==================== */

/* 文本对齐 */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* 浮动 */
.float-left { float: left; }
.float-right { float: right; }
.clearfix::after {
    content: '';
    display: block;
    clear: both;
}

/* 显示/隐藏 */
.hide { display: none !important; }
.show { display: block !important; }
.invisible { visibility: hidden; }
.visible { visibility: visible; }

/* 文本溢出 */
.text-ellipsis {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.text-ellipsis-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.text-ellipsis-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 间距 */
.mt-5 { margin-top: 5px; }
.mt-10 { margin-top: 10px; }
.mt-15 { margin-top: 15px; }
.mt-20 { margin-top: 20px; }
.mt-30 { margin-top: 30px; }

.mb-5 { margin-bottom: 5px; }
.mb-10 { margin-bottom: 10px; }
.mb-15 { margin-bottom: 15px; }
.mb-20 { margin-bottom: 20px; }
.mb-30 { margin-bottom: 30px; }

.ml-5 { margin-left: 5px; }
.ml-10 { margin-left: 10px; }
.ml-15 { margin-left: 15px; }
.ml-20 { margin-left: 20px; }

.mr-5 { margin-right: 5px; }
.mr-10 { margin-right: 10px; }
.mr-15 { margin-right: 15px; }
.mr-20 { margin-right: 20px; }

.p-5 { padding: 5px; }
.p-10 { padding: 10px; }
.p-15 { padding: 15px; }
.p-20 { padding: 20px; }

/* 颜色 */
.text-primary { color: #1890ff; }
.text-success { color: #52c41a; }
.text-warning { color: #faad14; }
.text-error { color: #ff4d4f; }
.text-info { color: #13c2c2; }
.text-muted { color: #999; }

/* 背景色 */
.bg-primary { background-color: #1890ff; }
.bg-success { background-color: #52c41a; }
.bg-warning { background-color: #faad14; }
.bg-error { background-color: #ff4d4f; }
.bg-info { background-color: #13c2c2; }

/* ==================== 按钮 ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 20px;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.5;
    text-align: center;
    white-space: nowrap;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
    user-select: none;
}

.btn:hover {
    opacity: 0.85;
}

.btn-primary {
    background-color: #1890ff;
    color: #fff;
    border-color: #1890ff;
}

.btn-success {
    background-color: #52c41a;
    color: #fff;
    border-color: #52c41a;
}

.btn-warning {
    background-color: #faad14;
    color: #fff;
    border-color: #faad14;
}

.btn-error {
    background-color: #ff4d4f;
    color: #fff;
    border-color: #ff4d4f;
}

.btn-default {
    background-color: #fff;
    color: #333;
    border-color: #d9d9d9;
}

.btn-default:hover {
    color: #1890ff;
    border-color: #1890ff;
}

.btn-sm {
    padding: 4px 12px;
    font-size: 12px;
}

.btn-lg {
    padding: 12px 30px;
    font-size: 16px;
}

.btn-block {
    display: flex;
    width: 100%;
}

/* ==================== 表单 ==================== */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.form-control {
    width: 100%;
    height: 38px;
    padding: 6px 12px;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    background-color: #fff;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.form-control:focus {
    border-color: #1890ff;
    box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
}

textarea.form-control {
    height: auto;
    min-height: 100px;
    resize: vertical;
}

.form-text {
    margin-top: 5px;
    font-size: 12px;
    color: #999;
}

/* ==================== 分页 ==================== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
    margin: 20px 0;
}

.pagination .page-item {
    min-width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    font-size: 14px;
    color: #666;
    cursor: pointer;
    transition: all 0.3s;
}

.pagination .page-item:hover {
    color: #1890ff;
    border-color: #1890ff;
}

.pagination .page-item.active {
    background-color: #1890ff;
    color: #fff;
    border-color: #1890ff;
}

.pagination .page-item.disabled {
    color: #ccc;
    cursor: not-allowed;
}

.pagination .page-item.disabled:hover {
    color: #ccc;
    border-color: #d9d9d9;
}

/* ==================== 消息提示 ==================== */
.message {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    padding: 12px 20px;
    background-color: #fff;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    z-index: 9999;
    opacity: 0;
    transition: all 0.3s;
}

.message.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.message-success {
    color: #52c41a;
    border: 1px solid #b7eb8f;
    background-color: #f6ffed;
}

.message-error {
    color: #ff4d4f;
    border: 1px solid #ffccc7;
    background-color: #fff2f0;
}

.message-warning {
    color: #faad14;
    border: 1px solid #ffe58f;
    background-color: #fffbe6;
}

.message-info {
    color: #1890ff;
    border: 1px solid #91d5ff;
    background-color: #e6f7ff;
}

/* ==================== 加载动画 ==================== */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f0f0f0;
    border-top-color: #1890ff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==================== 响应式 ==================== */
@media (max-width: 768px) {
    .hidden-sm {
        display: none !important;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .hidden-md {
        display: none !important;
    }
}

@media (min-width: 1025px) {
    .hidden-lg {
        display: none !important;
    }
}
