/* 
 * 通用页面样式 - 所有内部页面共享
 * 注意：所有HTML文件需在<head>中引入Font Awesome：
 * <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
 */

/* 图标样式 */
i.fas, i.far, i.fab, i.fa {
    margin-right: 8px;
}

.btn i, button i {
    margin-right: 6px;
}

i.icon-only {
    margin-right: 0;
}

/* 基础样式 */

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #ffffff;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    /* 性能优化 */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.header {
    background: #2563eb;
    padding: 16px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    /* 性能优化 */
    will-change: transform;
    transform: translateZ(0);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ffffff 0%, #e0e7ff 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #2563eb;
    font-size: 14px;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
}

.logout-btn {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
}

.header-logo {
    width: 32px;
    height: 32px;
}

.header h1 {
    margin: 0;
    font-size: 20px;
    color: white;
    font-weight: 600;
}

.nav-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
    margin-left: 16px;
    white-space: nowrap;
    flex-shrink: 0;
}

.nav-breadcrumb a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    transition: color 0.3s;
}

.nav-breadcrumb a:hover {
    color: white;
}

.nav-breadcrumb span {
    color: rgba(255, 255, 255, 0.6);
}

.sub-nav {
    background: #f8fafc;
    padding: 12px 32px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    gap: 16px;
}

.sub-nav a {
    padding: 8px 16px;
    border-radius: 8px;
    text-decoration: none;
    color: #64748b;
    transition: all 0.3s;
    font-weight: 500;
}

.sub-nav a:hover {
    background: #e2e8f0;
    color: #1e293b;
}

.sub-nav a.active {
    background: #2563eb;
    color: white;
}

.container {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 20px;
    width: 100%;
}

.page-title {
    font-size: 28px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 24px 0;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
}

.btn-primary {
    background: #2563eb;
    color: white;
}

.btn-primary:hover {
    background: #1d4ed8;
}

.btn-secondary {
    background: #2563eb;
    color: white;
    margin-left: 12px;
    cursor: pointer;
}

.btn-secondary:hover {
    background: #1d4ed8;
}

.form-group {
    margin-bottom: 20px;
}

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

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #2563eb;
}

.form-hint {
    font-size: 13px;
    color: #64748b;
    margin-top: 4px;
}

/* 页面布局 - 使用 Flexbox 让页脚固定在底部 */
html {
    height: 100%;
}

body {
    min-height: 100%;
    display: flex;
    flex-direction: column;
}

/* 主容器自动占据剩余空间 */
.container,
.main-container {
    flex: 1;
}

.footer {
    background: #f8fafc;
    padding: 24px 32px;
    text-align: center;
    color: #64748b;
    font-size: 13px;
    border-top: 1px solid #e2e8f0;
    margin-top: auto;
}

.version-tag {
    display: inline-block;
    background: #2563eb;
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    cursor: pointer;
    margin-left: 8px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.version-tag:hover {
    background: #1d4ed8;
    transform: scale(1.05);
}

/* 加载动画 */
.loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid #f3f4f6;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: spinner-rotate 0.8s linear infinite;
}

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

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    z-index: 9998;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.loading-content {
    text-align: center;
}

.loading-text {
    margin-top: 16px;
    color: #64748b;
    font-size: 14px;
    font-weight: 500;
}

/* 卡片加载状态 */
.card-loading {
    position: relative;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.card-loading-spinner .loading-spinner {
    width: 32px;
    height: 32px;
    border-width: 3px;
}

.card-loading-text {
    color: #94a3b8;
    font-size: 13px;
}

/* ========== 返回顶部按钮 ========== */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) translateZ(0);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    /* 性能优化 */
    will-change: transform, opacity;
    backface-visibility: hidden;
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) translateZ(0);
}

.back-to-top:hover {
    transform: translateY(-3px) translateZ(0);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.5);
}

.back-to-top:active {
    transform: translateY(-1px) scale(0.95) translateZ(0);
}

.back-to-top i {
    margin: 0;
}

/* 移动端优化 */
@media (max-width: 768px) {
    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
        font-size: 18px;
    }
}
