/*!
 * 匿名聊天室 - 赛博朋克风格前台CSS
 */

/* === 变量定义 === */
:root {
    --bg-primary: #0a0e14;
    --bg-secondary: #0d1117;
    --bg-tertiary: #161b22;
    --bg-hover: #1f2428;
    --accent-primary: #00ff41;
    --accent-secondary: #0affef;
    --accent-danger: #ff0055;
    --accent-warning: #ffaa00;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #484f58;
    --border-color: #30363d;
    --glow-green: 0 0 20px rgba(0, 255, 65, 0.4);
    --glow-blue: 0 0 20px rgba(10, 255, 239, 0.4);
    --glow-red: 0 0 20px rgba(255, 0, 85, 0.4);
}

/* === 全局样式 === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'JetBrains Mono', 'Consolas', 'Courier New', monospace;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
}

/* 扫描线效果 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 255, 65, 0.015) 2px,
        rgba(0, 255, 65, 0.015) 4px
    );
    pointer-events: none;
    z-index: 9998;
}

/* 网格背景 */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(rgba(0, 255, 65, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 255, 65, 0.02) 1px, transparent 1px);
    background-size: 50px 50px;
    pointer-events: none;
    z-index: -1;
}

a {
    color: var(--accent-secondary);
    text-decoration: none;
    transition: all 0.3s ease;
}

a:hover {
    color: var(--accent-primary);
    text-shadow: var(--glow-green);
}

/* === 容器 === */
.container {
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* === 头部 === */
.header {
    padding: 15px 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
}

.header-logo {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.2rem;
    color: var(--accent-primary);
    text-shadow: var(--glow-green);
    letter-spacing: 2px;
}

.header-info {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.header-info .status {
    display: flex;
    align-items: center;
    gap: 5px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-primary);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 5px var(--accent-primary); }
    50% { opacity: 0.5; box-shadow: 0 0 10px var(--accent-primary); }
}

/* === 主内容区 === */
.main {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* === 欢迎页面 === */
.welcome-screen {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    text-align: center;
}

.welcome-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 2.5rem;
    color: var(--accent-primary);
    text-shadow: var(--glow-green);
    margin-bottom: 20px;
    letter-spacing: 3px;
}

.welcome-subtitle {
    color: var(--text-muted);
    margin-bottom: 40px;
    font-size: 1rem;
}

/* === 终端风格输入框 === */
.terminal-input {
    width: 100%;
    max-width: 500px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    padding: 20px;
    font-family: inherit;
}

.terminal-header {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
}

.terminal-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.terminal-dot.red { background: #ff5f56; }
.terminal-dot.yellow { background: #ffbd2e; }
.terminal-dot.green { background: #27ca40; }

.terminal-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 10px;
    text-align: left;
}

.terminal-field {
    position: relative;
    margin-bottom: 15px;
}

.terminal-field input {
    width: 100%;
    padding: 15px;
    padding-left: 40px;
    background: var(--bg-secondary);
    border: 1px solid var(--accent-primary);
    color: var(--accent-primary);
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s;
}

.terminal-field input:focus {
    box-shadow: var(--glow-green);
}

.terminal-field::before {
    content: '>';
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--accent-primary);
    font-weight: bold;
}

.terminal-btn {
    width: 100%;
    padding: 15px;
    background: transparent;
    border: 2px solid var(--accent-primary);
    color: var(--accent-primary);
    font-family: 'Orbitron', sans-serif;
    font-size: 1rem;
    letter-spacing: 2px;
    cursor: pointer;
    transition: all 0.3s;
}

.terminal-btn:hover {
    background: var(--accent-primary);
    color: var(--bg-primary);
    box-shadow: var(--glow-green);
}

.terminal-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* === 加载动画 === */
.loading-screen {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.loading-text {
    font-size: 1rem;
    color: var(--accent-primary);
    margin-bottom: 20px;
    text-align: center;
}

.loading-bar {
    width: 300px;
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    overflow: hidden;
}

.loading-bar-fill {
    height: 100%;
    background: var(--accent-primary);
    box-shadow: var(--glow-green);
    animation: loading 2s ease-in-out infinite;
}

@keyframes loading {
    0% { width: 0%; }
    50% { width: 70%; }
    100% { width: 100%; }
}

.loading-info {
    margin-top: 20px;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
}

.loading-info span {
    color: var(--accent-secondary);
}

/* === 聊天室布局 === */
.chat-layout {
    display: flex;
    width: 100%;
    height: 100%;
}

/* === 侧边栏 === */
.sidebar {
    width: 250px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
}

.chatroom-name {
    font-size: 1rem;
    color: var(--accent-primary);
    font-weight: bold;
}

.chatroom-info {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 5px;
}

.online-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.online-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-muted);
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
}

.online-item {
    display: flex;
    align-items: center;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 5px;
    transition: background 0.3s;
}

.online-item:hover {
    background: var(--bg-hover);
}

.online-item.me {
    border-left: 2px solid var(--accent-primary);
    background: rgba(0, 255, 65, 0.05);
}

.online-avatar {
    width: 32px;
    height: 32px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    font-size: 0.8rem;
    color: var(--accent-secondary);
}

.online-name {
    font-size: 0.85rem;
    color: var(--text-primary);
}

.online-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* === 聊天区域 === */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
}

.messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.message {
    margin-bottom: 15px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 5px;
}

.message-sender {
    color: var(--accent-secondary);
    font-weight: bold;
    font-size: 0.9rem;
}

.message-time {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.message-content {
    padding: 10px 15px;
    background: var(--bg-secondary);
    border-left: 2px solid var(--accent-primary);
    border-radius: 0 4px 4px 0;
    color: var(--text-primary);
    word-wrap: break-word;
}

.message.own .message-content {
    border-left-color: var(--accent-secondary);
    background: rgba(10, 255, 239, 0.05);
}

.message-system {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    padding: 10px;
}

.message-system .message-content {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-style: italic;
}

/* === 消息输入 === */
.message-input-area {
    padding: 15px 20px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
}

.message-form {
    display: flex;
    gap: 10px;
}

.message-form input {
    flex: 1;
    padding: 15px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    transition: all 0.3s;
}

.message-form input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 10px rgba(0, 255, 65, 0.2);
}

.message-form input::placeholder {
    color: var(--text-muted);
}

.message-form button {
    padding: 15px 30px;
    background: transparent;
    border: 1px solid var(--accent-primary);
    color: var(--accent-primary);
    font-family: inherit;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.message-form button:hover {
    background: var(--accent-primary);
    color: var(--bg-primary);
    box-shadow: var(--glow-green);
}

/* === 封禁页面 === */
.ban-screen {
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    text-align: center;
    padding: 40px;
}

.ban-icon {
    font-size: 4rem;
    color: var(--accent-danger);
    margin-bottom: 30px;
    animation: glitch 0.5s infinite;
}

@keyframes glitch {
    0% { transform: translate(0); }
    20% { transform: translate(-2px, 2px); }
    40% { transform: translate(-2px, -2px); }
    60% { transform: translate(2px, 2px); }
    80% { transform: translate(2px, -2px); }
    100% { transform: translate(0); }
}

.ban-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 2rem;
    color: var(--accent-danger);
    text-shadow: var(--glow-red);
    margin-bottom: 20px;
    letter-spacing: 3px;
}

.ban-message {
    max-width: 500px;
    padding: 20px;
    background: rgba(255, 0, 85, 0.1);
    border: 1px solid var(--accent-danger);
    color: var(--text-primary);
    margin-bottom: 20px;
}

.ban-info {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* === 错误提示 === */
.error-message {
    background: rgba(255, 0, 85, 0.1);
    border: 1px solid var(--accent-danger);
    color: var(--accent-danger);
    padding: 15px;
    margin-top: 15px;
    font-size: 0.9rem;
    animation: shake 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* === 打字机效果 === */
.typewriter {
    overflow: hidden;
    white-space: nowrap;
    animation: typing 1s steps(30, end);
}

@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}

.typewriter-cursor::after {
    content: '█';
    animation: blink 0.7s step-end infinite;
    color: var(--accent-primary);
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* === 滚动条 === */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* === 响应式 === */
@media (max-width: 768px) {
    .sidebar {
        display: none;
    }

    .welcome-title {
        font-size: 1.5rem;
    }

    .terminal-input {
        padding: 15px;
    }
}

/* === 矩阵雨背景 === */
#matrix-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    opacity: 0.1;
}

/* === 退出按钮 === */
.btn-exit {
    padding: 8px 15px;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-exit:hover {
    border-color: var(--accent-danger);
    color: var(--accent-danger);
}

/* === 用户计数 === */
.user-count {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: rgba(0, 255, 65, 0.1);
    border: 1px solid var(--accent-primary);
    color: var(--accent-primary);
    font-size: 0.75rem;
    border-radius: 3px;
}

/* === 空消息状态 === */
.empty-messages {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-style: italic;
}

/* === 滚动到底部按钮 === */
.scroll-bottom {
    position: absolute;
    bottom: 100px;
    right: 30px;
    width: 40px;
    height: 40px;
    background: var(--bg-secondary);
    border: 1px solid var(--accent-primary);
    border-radius: 50%;
    color: var(--accent-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.scroll-bottom.visible {
    opacity: 1;
}

.scroll-bottom:hover {
    background: var(--accent-primary);
    color: var(--bg-primary);
}

/* === 新消息提示 === */
.new-message-indicator {
    position: absolute;
    top: 50%;
    left: 250px;
    transform: translateY(-50%);
    padding: 10px 15px;
    background: var(--accent-secondary);
    color: var(--bg-primary);
    font-size: 0.8rem;
    cursor: pointer;
    border-radius: 4px;
    display: none;
}

.new-message-indicator.visible {
    display: block;
}

/* === 上传按钮 === */
.btn-upload {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    padding: 0;
    background: transparent;
    border: 1px solid var(--accent-secondary);
    color: var(--accent-secondary);
    cursor: pointer;
    transition: all 0.3s;
}

.btn-upload:hover {
    background: var(--accent-secondary);
    color: var(--bg-primary);
    box-shadow: var(--glow-blue);
}

/* === 上传进度 === */
.upload-progress {
    margin-top: 10px;
    padding: 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.upload-progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-primary);
    border-radius: 4px;
    overflow: hidden;
}

.upload-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    width: 0%;
    transition: width 0.3s ease;
}

.upload-progress-text {
    display: block;
    margin-top: 8px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* === 图片消息 === */
.chat-image {
    max-width: 300px;
    max-height: 300px;
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.2s;
}

.chat-image:hover {
    transform: scale(1.02);
}

/* === 图片预览模态框 === */
.image-preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.preview-image {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: 8px;
}

.preview-close-btn {
    position: absolute;
    top: 20px;
    right: 30px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 40px;
    cursor: pointer;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
}

.preview-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* === 文件附件 === */
.file-attachment {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    transition: all 0.3s;
}

.file-attachment:hover {
    border-color: var(--accent-secondary);
    background: var(--bg-hover);
}

.file-attachment i {
    font-size: 1.2rem;
    color: var(--accent-secondary);
}

.file-attachment .file-name {
    color: var(--accent-primary);
    font-weight: 500;
}

.file-attachment .file-size {
    color: var(--text-muted);
    font-size: 0.8rem;
}

