/* 科幻风格聊天室样式 */

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

body {
    font-family: 'Orbitron', sans-serif;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 50%, #16213e 100%);
    color: #00f0ff;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* 背景效果 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><rect width="100" height="100" fill="none" stroke="rgba(0, 240, 255, 0.1)" stroke-width="0.5"/></svg>');
    z-index: -1;
    animation: gridMove 20s linear infinite;
}

@keyframes gridMove {
    0% { transform: translate(0, 0); }
    100% { transform: translate(100px, 100px); }
}

/* 容器样式 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 登录/注册框 */
.login-box {
    background: rgba(26, 26, 46, 0.8);
    border: 1px solid #00f0ff;
    border-radius: 10px;
    padding: 40px;
    box-shadow: 0 0 30px rgba(0, 240, 255, 0.3);
    backdrop-filter: blur(10px);
    width: 100%;
    max-width: 400px;
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from { box-shadow: 0 0 30px rgba(0, 240, 255, 0.3); }
    to { box-shadow: 0 0 40px rgba(0, 240, 255, 0.5); }
}

.login-box h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #00f0ff;
    text-shadow: 0 0 10px rgba(0, 240, 255, 0.5);
}

.login-notice {
    text-align: center;
    color: #ff9800;
    font-size: 12px;
    margin-bottom: 20px;
    padding: 10px;
    background: rgba(255, 152, 0, 0.1);
    border: 1px solid rgba(255, 152, 0, 0.3);
    border-radius: 5px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #00f0ff;
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 12px;
    background: rgba(10, 10, 10, 0.6);
    border: 1px solid #00f0ff;
    border-radius: 5px;
    color: #00f0ff;
    font-family: 'Orbitron', sans-serif;
    transition: all 0.3s ease;
}

.form-group input:focus {
    outline: none;
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.5);
    border-color: #00f0ff;
}

/* 按钮样式 */
.btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(45deg, #00f0ff, #0080ff);
    border: none;
    border-radius: 5px;
    color: #0a0a0a;
    font-family: 'Orbitron', sans-serif;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 20px;
}

.btn:hover {
    background: linear-gradient(45deg, #0080ff, #00f0ff);
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.7);
    transform: translateY(-2px);
}

/* 链接样式 */
.login-link {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
}

.login-link a {
    color: #00f0ff;
    text-decoration: none;
    transition: color 0.3s ease;
}

.login-link a:hover {
    color: #0080ff;
    text-shadow: 0 0 5px rgba(0, 240, 255, 0.5);
}

/* 聊天容器 */
.chat-container {
    background: rgba(26, 26, 46, 0.8);
    border: 1px solid #00f0ff;
    border-radius: 10px;
    box-shadow: 0 0 30px rgba(0, 240, 255, 0.3);
    backdrop-filter: blur(10px);
    width: 100%;
    max-width: 800px;
    height: 80vh;
    display: flex;
    flex-direction: column;
    animation: glow 2s ease-in-out infinite alternate;
}

/* 聊天头部 */
.chat-header {
    padding: 20px;
    border-bottom: 1px solid #00f0ff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(10, 10, 10, 0.6);
    border-radius: 10px 10px 0 0;
}

.chat-header h2 {
    color: #00f0ff;
    text-shadow: 0 0 10px rgba(0, 240, 255, 0.5);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info span {
    color: #00f0ff;
}

.admin-link, .logout-link {
    color: #00f0ff;
    text-decoration: none;
    padding: 8px 12px;
    border: 1px solid #00f0ff;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.admin-link:hover, .logout-link:hover {
    background: rgba(0, 240, 255, 0.1);
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.5);
}

/* 消息容器 */
.message-container {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* 消息样式 */
.message {
    max-width: 70%;
    padding: 15px;
    border-radius: 10px;
    background: rgba(10, 10, 10, 0.6);
    border: 1px solid #00f0ff;
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.2);
}

.own-message {
    align-self: flex-end;
    background: rgba(0, 128, 255, 0.2);
    border-color: #0080ff;
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 12px;
}

.username {
    font-weight: bold;
    color: #00f0ff;
}

.username.admin {
    color: #ff0080;
    text-shadow: 0 0 5px rgba(255, 0, 128, 0.5);
}

.time {
    color: #888;
}

.message-content {
    color: #00f0ff;
    line-height: 1.4;
}

.message-image {
    margin-bottom: 10px;
}

.message-image img {
    max-width: 250px;
    max-height: 200px;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.message-image img:hover {
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.5);
}

.upload-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0 !important;
    background: rgba(10, 10, 10, 0.6);
    border: 1px solid #00f0ff;
    border-radius: 5px;
    color: #00f0ff;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.upload-btn:hover {
    background: rgba(0, 240, 255, 0.1);
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.5);
}

/* 消息输入 */
.message-input {
    padding: 20px;
    border-top: 1px solid #00f0ff;
    background: rgba(10, 10, 10, 0.6);
    border-radius: 0 0 10px 10px;
}

.message-input form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.input-row {
    display: flex;
    gap: 10px;
    align-items: center;
    width: 100%;
}

.message-input-field {
    flex: 1;
    min-width: 0;
    padding: 12px;
    background: rgba(10, 10, 10, 0.6);
    border: 1px solid #00f0ff;
    border-radius: 5px;
    color: #00f0ff;
    font-family: 'Orbitron', sans-serif;
    transition: all 0.3s ease;
}

.message-input-field:focus {
    outline: none;
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.5);
    border-color: #00f0ff;
}

.send-btn {
    width: 80px !important;
    flex-shrink: 0;
    margin: 0 !important;
}

#upload-status {
    color: #ff9800;
    font-size: 12px;
    min-width: 50px;
    text-align: center;
}

.message-input .btn {
    margin-top: 0;
    width: 100px;
}

/* 管理员容器 */
.admin-container {
    background: rgba(26, 26, 46, 0.8);
    border: 1px solid #00f0ff;
    border-radius: 10px;
    box-shadow: 0 0 30px rgba(0, 240, 255, 0.3);
    backdrop-filter: blur(10px);
    width: 100%;
    max-width: 1000px;
    min-height: 80vh;
    display: flex;
    flex-direction: column;
    animation: glow 2s ease-in-out infinite alternate;
}

/* 管理员头部 */
.admin-header {
    padding: 20px;
    border-bottom: 1px solid #00f0ff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(10, 10, 10, 0.6);
    border-radius: 10px 10px 0 0;
}

.admin-header h2 {
    color: #00f0ff;
    text-shadow: 0 0 10px rgba(0, 240, 255, 0.5);
}

.admin-links {
    display: flex;
    gap: 15px;
}

.back-link {
    color: #00f0ff;
    text-decoration: none;
    padding: 8px 12px;
    border: 1px solid #00f0ff;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.back-link:hover {
    background: rgba(0, 240, 255, 0.1);
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.5);
}

/* 管理员菜单 */
.admin-menu {
    padding: 20px;
    border-bottom: 1px solid #00f0ff;
    display: flex;
    gap: 15px;
    background: rgba(10, 10, 10, 0.6);
}

.menu-item {
    color: #00f0ff;
    text-decoration: none;
    padding: 10px 20px;
    border: 1px solid #00f0ff;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.menu-item:hover {
    background: rgba(0, 240, 255, 0.1);
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.5);
}

/* 管理员内容 */
.admin-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

/* 表格样式 */
.user-table, .message-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.user-table th, .message-table th {
    background: rgba(0, 240, 255, 0.2);
    color: #00f0ff;
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #00f0ff;
}

.user-table td, .message-table td {
    padding: 12px;
    border-bottom: 1px solid rgba(0, 240, 255, 0.3);
    color: #00f0ff;
}

.user-table tr:hover, .message-table tr:hover {
    background: rgba(0, 240, 255, 0.1);
}

.delete-link {
    color: #ff0080;
    text-decoration: none;
    padding: 6px 12px;
    border: 1px solid #ff0080;
    border-radius: 3px;
    transition: all 0.3s ease;
    display: inline-block;
    font-size: 12px;
}

.delete-link:hover {
    background: rgba(255, 0, 128, 0.1);
    box-shadow: 0 0 10px rgba(255, 0, 128, 0.5);
}

.disabled {
    color: #888;
    cursor: not-allowed;
    display: inline-block;
    font-size: 12px;
    padding: 6px 12px;
}

/* 错误和成功消息 */
.error {
    background: rgba(255, 0, 128, 0.2);
    border: 1px solid #ff0080;
    color: #ff0080;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 20px;
    text-align: center;
}

.success {
    background: rgba(0, 240, 255, 0.2);
    border: 1px solid #00f0ff;
    color: #00f0ff;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 20px;
    text-align: center;
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(10, 10, 10, 0.6);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 240, 255, 0.5);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 240, 255, 0.8);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .login-box {
        padding: 30px;
    }

    .chat-container {
        height: 90vh;
    }

    .chat-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

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

    .input-row {
        flex-wrap: nowrap;
    }

    .message-input-field {
        font-size: 14px;
        padding: 10px;
    }

    .send-btn {
        width: 60px !important;
        font-size: 12px;
    }

    .upload-btn {
        width: 36px;
        height: 36px;
    }

    .upload-btn svg {
        width: 16px;
        height: 16px;
    }
}

    .message {
        max-width: 85%;
    }

    .message-input form {
        flex-direction: column;
    }

    .message-input .btn {
        width: 100%;
    }

    .admin-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

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

    .admin-menu {
        flex-wrap: wrap;
    }

    .user-table, .message-table {
        font-size: 14px;
    }

    .user-table th, .user-table td, .message-table th, .message-table td {
        padding: 8px;
    }
}

@media (max-width: 480px) {
    .login-box {
        padding: 20px;
    }

    .chat-header h2 {
        font-size: 18px;
    }

    .message-container {
        padding: 10px;
    }

    .message {
        padding: 10px;
    }

    .message-input {
        padding: 10px;
    }

    .admin-header h2 {
        font-size: 18px;
    }

    .admin-menu {
        padding: 10px;
    }

    .menu-item {
        padding: 8px 12px;
        font-size: 14px;
    }

    .admin-content {
        padding: 10px;
    }
}