/* static/css/common.css */

/* 基础样式重置与全局设置 - 科技魔塔主题 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    background: linear-gradient(135deg, #0a0e14 0%, #0f1521 100%);
    color: #e0e7ff;
    min-height: 100vh;
    padding-bottom: 60px;
    line-height: 1.6;
    overflow-x: hidden;
}

/* 科技魔塔背景效果 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(circle at 20% 30%, rgba(0, 150, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(138, 43, 226, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 80%, rgba(0, 200, 255, 0.05) 0%, transparent 50%);
    background-size: 100% 100%;
    z-index: -1;
    pointer-events: none;
}

/* 电路板网格背景 */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        linear-gradient(rgba(0, 150, 255, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 150, 255, 0.05) 1px, transparent 1px);
    background-size: 40px 40px;
    z-index: -1;
    pointer-events: none;
    animation: gridMove 20s linear infinite;
}

@keyframes gridMove {
    0% {
        background-position: 0 0;
    }

    100% {
        background-position: 40px 40px;
    }
}

/* 导航栏容器 - 修复布局问题 */
.nav-container {
    background: linear-gradient(135deg,
            rgba(15, 23, 42, 0.95) 0%,
            rgba(30, 41, 59, 0.95) 100%);
    backdrop-filter: blur(10px);
    box-shadow:
        0 4px 25px rgba(0, 150, 255, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border-bottom: 2px solid rgba(0, 150, 255, 0.3);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 70px;
}

/* 移除.nav-content的padding-right，使用flex布局替代 */
.nav-content {
    display: flex;
    align-items: center;
    flex: 1;
    position: relative;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    flex: 1;
}

/* 确保用户登录时左侧内容有足够的空间 */
.nav-left:not(.hidden) {
    max-width: 300px;
}

.char-icon {
    width: 75px;
    height: 75px;
    object-fit: cover;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.char-icon:hover {
    transform: scale(1.05);
    border-color: rgba(138, 43, 226, 0.8);
    box-shadow:
        0 0 25px rgba(138, 43, 226, 0.4),
        inset 0 0 15px rgba(138, 43, 226, 0.2);
}

.user-name {
    color: #e0e7ff;
    font-weight: 600;
    font-size: 1.1rem;
    text-shadow: 0 0 8px rgba(0, 150, 255, 0.4);
    font-family: 'Orbitron', monospace;
    letter-spacing: 0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.nav-left.hidden {
    display: none;
}

/* 右侧导航 - 修复绝对定位导致的错位问题 */
.nav-right {
    display: flex;
    align-items: center;
    margin-left: auto;
    position: static !important;
    transform: none !important;
    top: auto !important;
    right: auto !important;
}

.nav-right ul {
    list-style: none;
    display: flex;
    gap: 0.8rem;
    align-items: center;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.nav-right a {
    text-decoration: none;
    color: #a5b4fc;
    font-weight: 500;
    padding: 0.5rem 0.9rem;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    background: linear-gradient(135deg,
            rgba(30, 41, 59, 0.8),
            rgba(51, 65, 85, 0.8));
    border: 1px solid rgba(0, 150, 255, 0.4);
    box-shadow:
        0 2px 8px rgba(0, 150, 255, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    font-family: 'Orbitron', monospace;
    letter-spacing: 0.5px;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
    display: inline-block;
}

.nav-right a::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
            transparent,
            rgba(0, 150, 255, 0.2),
            transparent);
    transition: left 0.5s;
}

.nav-right a:hover {
    color: #ffffff;
    background: linear-gradient(135deg,
            rgba(0, 150, 255, 0.3),
            rgba(138, 43, 226, 0.2));
    border-color: rgba(138, 43, 226, 0.6);
    transform: translateY(-2px);
    box-shadow:
        0 4px 15px rgba(138, 43, 226, 0.3),
        0 0 15px rgba(0, 150, 255, 0.2);
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

.nav-right a:hover::before {
    left: 100%;
}

/* 内容区 - 科技控制中心 */
.content-container {
    max-width: 900px;
    margin: 2rem auto;
    padding: 2rem;
    background: linear-gradient(135deg,
            rgba(15, 23, 42, 0.9) 0%,
            rgba(30, 41, 59, 0.9) 100%);
    border-radius: 16px;
    box-shadow:
        0 10px 40px rgba(0, 150, 255, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        inset 0 -1px 0 rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(0, 150, 255, 0.4);
    position: relative;
    overflow: hidden;
}

.content-container::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg,
            rgba(0, 150, 255, 0.2),
            rgba(138, 43, 226, 0.2),
            rgba(0, 150, 255, 0.2));
    border-radius: 18px;
    z-index: -1;
    filter: blur(5px);
    opacity: 0.5;
}

.content-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid rgba(0, 150, 255, 0.3);
    position: relative;
}

.content-header::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100px;
    height: 2px;
    background: linear-gradient(90deg,
            rgba(0, 150, 255, 0.8) 0%,
            rgba(138, 43, 226, 0.8) 100%);
    border-radius: 2px;
}

.content-header h1 {
    color: #ffffff;
    font-size: 1.8rem;
    font-weight: 700;
    text-shadow: 0 0 20px rgba(0, 150, 255, 0.5);
    font-family: 'Orbitron', monospace;
    letter-spacing: 1px;
}

.content-header .header-subtitle {
    color: #a5b4fc;
    font-size: 1rem;
    margin-top: 0.5rem;
    font-family: 'Orbitron', monospace;
    opacity: 0.9;
}

/* 提示消息 - 科技警报样式 */
.flash-message {
    padding: 1rem 1.2rem;
    margin: 1rem 0;
    background: linear-gradient(135deg,
            rgba(0, 200, 255, 0.15),
            rgba(0, 150, 255, 0.1));
    color: #60a5fa;
    border-radius: 8px;
    border-left: 3px solid #3b82f6;
    animation: fadeIn 0.5s ease;
    box-shadow:
        0 3px 15px rgba(59, 130, 246, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    font-family: 'Orbitron', monospace;
    position: relative;
    overflow: hidden;
    border-right: 1px solid rgba(59, 130, 246, 0.2);
}

.flash-message::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg,
            transparent,
            rgba(59, 130, 246, 0.5),
            transparent);
    animation: scanLine 2s infinite;
}

@keyframes scanLine {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

/* 页脚 - 科技终端 */
.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg,
            rgba(15, 23, 42, 0.95),
            rgba(30, 41, 59, 0.95));
    backdrop-filter: blur(10px);
    color: #94a3b8;
    text-align: center;
    font-size: 0.9rem;
    border-top: 2px solid rgba(0, 150, 255, 0.2);
    margin: 0 auto;
    text-shadow: 0 0 10px rgba(0, 150, 255, 0.3);
    z-index: 99;
    font-family: 'Orbitron', monospace;
    letter-spacing: 1px;
    border-image: linear-gradient(90deg,
            transparent,
            rgba(0, 150, 255, 0.3),
            transparent) 1;
}

.footer::before {
    content: '⟁ ';
    margin-right: 8px;
    color: #60a5fa;
    animation: blink 1.5s infinite;
}

.footer::after {
    content: ' ⟁';
    margin-left: 8px;
    color: #60a5fa;
    animation: blink 1.5s infinite reverse;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.3;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 科技主题滚动条 */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.8);
    border-radius: 6px;
    border: 1px solid rgba(0, 150, 255, 0.2);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg,
            rgba(0, 150, 255, 0.7),
            rgba(138, 43, 226, 0.7));
    border-radius: 6px;
    border: 2px solid rgba(15, 23, 42, 0.8);
    box-shadow:
        inset 0 0 5px rgba(255, 255, 255, 0.1),
        0 0 10px rgba(0, 150, 255, 0.3);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg,
            rgba(0, 200, 255, 0.8),
            rgba(168, 85, 247, 0.8));
}

/* 响应式设计 */
@media (max-width: 768px) {
    .nav-container {
        padding: 0.8rem 1rem;
        flex-direction: column;
        align-items: stretch;
        gap: 0.8rem;
    }

    .nav-content {
        width: 100%;
        justify-content: space-between;
    }

    .nav-left {
        flex: 0 0 auto;
        max-width: 60%;
    }

    .char-icon {
        width: 45px;
        height: 45px;
    }

    .user-name {
        font-size: 1rem;
        max-width: 150px;
    }

    .nav-right {
        width: 100%;
        margin-left: 0;
        justify-content: flex-end;
    }

    .nav-right ul {
        width: 100%;
        justify-content: flex-end;
        gap: 0.5rem;
    }

    .nav-right a {
        font-size: 0.85rem;
        padding: 0.4rem 0.7rem;
    }

    .content-container {
        margin: 1rem;
        padding: 1.5rem;
    }

    .content-header h1 {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .nav-container {
        padding: 0.6rem 0.8rem;
        gap: 0.6rem;
    }

    .nav-left {
        max-width: 50%;
    }

    .char-icon {
        width: 40px;
        height: 40px;
    }

    .user-name {
        font-size: 0.9rem;
        max-width: 120px;
    }

    .nav-right ul {
        gap: 0.3rem;
    }

    .nav-right a {
        font-size: 0.8rem;
        padding: 0.35rem 0.6rem;
    }

    .content-container {
        margin: 0.5rem;
        padding: 1rem;
    }

    .footer {
        font-size: 0.8rem;
        padding: 0.8rem;
    }
}

/* 特别修复：当用户未登录时，确保导航对齐 */
.nav-left.hidden+.nav-right {
    width: 100%;
    justify-content: center;
}

.nav-left.hidden+.nav-right ul {
    justify-content: center;
}

/* 登录/登出按钮的特殊样式 */
.nav-right a[href*="logout"],
.nav-right a[href*="login"] {
    background: linear-gradient(135deg,
            rgba(239, 68, 68, 0.2),
            rgba(220, 38, 38, 0.1));
    border-color: rgba(239, 68, 68, 0.4);
}

.nav-right a[href*="logout"]:hover,
.nav-right a[href*="login"]:hover {
    background: linear-gradient(135deg,
            rgba(239, 68, 68, 0.3),
            rgba(220, 38, 38, 0.2));
    border-color: rgba(239, 68, 68, 0.6);
    box-shadow:
        0 4px 15px rgba(239, 68, 68, 0.3),
        0 0 15px rgba(239, 68, 68, 0.2);
}