/* QQ Chat - Mobile First Responsive Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #00BFFF;
    --primary-dark: #0099CC;
    --bg-color: #F5F5F7;
    --card-bg: #FFFFFF;
    --text-primary: #1D1D1F;
    --text-secondary: #8E8E93;
    --border-color: #E5E5EA;
    --success-color: #34C759;
    --danger-color: #FF3B30;
    --warning-color: #FF9500;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
}

/* Auth Pages (Login & Register) */
.auth-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.auth-box {
    background: var(--card-bg);
    border-radius: 24px;
    padding: 40px 30px;
    box-shadow: var(--shadow-md);
    max-width: 400px;
    width: 100%;
    margin: 0 auto;
}

.auth-title {
    font-size: 28px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 30px;
    color: var(--text-primary);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.input-group {
    position: relative;
}

.input-group input {
    width: 100%;
    padding: 14px 0;
    font-size: 16px;
    border: none;
    border-bottom: 2px solid var(--border-color);
    background: transparent;
    transition: border-color 0.3s;
    outline: none;
}

.input-group input:focus {
    border-bottom-color: var(--primary-color);
}

.input-group label {
    position: absolute;
    left: 0;
    top: 14px;
    font-size: 16px;
    color: var(--text-secondary);
    transition: all 0.3s;
    pointer-events: none;
}

.input-group input:focus + label,
.input-group input:not(:placeholder-shown) + label {
    top: -8px;
    font-size: 12px;
    color: var(--primary-color);
}

.password-toggle {
    position: absolute;
    right: 0;
    top: 14px;
    cursor: pointer;
    color: var(--text-secondary);
}

.btn {
    padding: 16px;
    font-size: 17px;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 191, 255, 0.4);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.btn-primary:active {
    transform: translateY(0);
}

.auth-link {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
}

.auth-link a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.error-message {
    background: #FFE5E5;
    color: var(--danger-color);
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 16px;
}

.success-message {
    background: #E5F9E5;
    color: var(--success-color);
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 16px;
}

/* Header */
.header {
    background: var(--card-bg);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.back-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-primary);
}

.header-title {
    font-size: 18px;
    font-weight: 600;
}

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

.header-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
}

/* User Profile in Header */
.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--card-bg);
}

.user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.user-info h3 {
    font-size: 16px;
    font-weight: 600;
}

.user-info p {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Search Bar */
.search-bar {
    padding: 12px 16px;
    background: var(--card-bg);
}

.search-input {
    width: 100%;
    padding: 12px 16px;
    border: none;
    border-radius: 10px;
    background: var(--bg-color);
    font-size: 15px;
    outline: none;
}

/* Group List */
.group-list {
    padding: 8px 0;
}

.group-item {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    background: var(--card-bg);
    cursor: pointer;
    transition: background 0.2s;
    position: relative;
}

.group-item:active {
    background: var(--bg-color);
}

.group-avatar {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    object-fit: cover;
    margin-right: 12px;
    position: relative;
}

.group-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 12px;
    object-fit: cover;
}

.unread-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    background: var(--danger-color);
    color: white;
    font-size: 11px;
    font-weight: 600;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
}

.group-info {
    flex: 1;
    min-width: 0;
}

.group-name {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.group-preview {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.group-time {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* Announcement Bar */
.announcement-bar {
    background: #FFF9E6;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--warning-color);
}

.announcement-bar .icon {
    font-size: 18px;
}

/* Chat Page */
.chat-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.member-count {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: normal;
}

.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 60px);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: var(--bg-color);
}

.message {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
}

.message-time {
    text-align: center;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.message-content {
    display: flex;
    gap: 10px;
    max-width: 80%;
}

.message.own {
    flex-direction: row-reverse;
}

.message.own .message-content {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}

.message-body {
    background: var(--card-bg);
    padding: 10px 14px;
    border-radius: 12px;
    border-top-left-radius: 4px;
    position: relative;
}

.message.own .message-body {
    background: var(--primary-color);
    color: white;
    border-radius: 12px;
    border-top-right-radius: 4px;
}

.message-sender {
    font-size: 12px;
    color: var(--primary-color);
    margin-bottom: 4px;
    font-weight: 500;
}

.message.own .message-sender {
    color: rgba(255, 255, 255, 0.8);
}

.message-text {
    font-size: 15px;
    line-height: 1.4;
    word-wrap: break-word;
}

.message-image {
    max-width: 200px;
    max-height: 200px;
    border-radius: 8px;
    cursor: pointer;
}

.message-file {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    color: inherit;
    text-decoration: none;
}

.message.own .message-file {
    background: rgba(255, 255, 255, 0.2);
}

.recalled-message {
    color: var(--text-secondary);
    font-style: italic;
    font-size: 13px;
}

/* System Messages */
.system-message {
    text-align: center;
    padding: 8px 16px;
    font-size: 13px;
    color: var(--text-secondary);
}

.system-message a {
    color: var(--primary-color);
    text-decoration: none;
}

/* Chat Input */
.chat-input-area {
    background: var(--card-bg);
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
}

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

.chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 24px;
    font-size: 15px;
    outline: none;
    resize: none;
    max-height: 100px;
}

.chat-input:focus {
    border-color: var(--primary-color);
}

.send-btn {
    padding: 10px 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 20px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.send-btn:hover {
    background: var(--primary-dark);
}

.send-btn:disabled {
    background: var(--border-color);
    cursor: not-allowed;
}

/* Function Icons */
.chat-functions {
    display: flex;
    gap: 20px;
    padding: 10px 0;
    justify-content: center;
}

.func-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-color);
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    transition: all 0.2s;
}

.func-icon:hover {
    background: var(--primary-color);
    color: white;
}

/* Emoji Picker */
.emoji-picker {
    display: none;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px;
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    max-height: 150px;
    overflow-y: auto;
}

.emoji-picker.active {
    display: flex;
}

.emoji-item {
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
    transition: transform 0.2s;
}

.emoji-item:hover {
    transform: scale(1.2);
}

/* Image Preview Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    max-width: 90%;
    max-height: 90%;
}

.modal-content img {
    max-width: 100%;
    max-height: 100%;
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 30px;
    color: white;
    cursor: pointer;
}

/* Floating Action Button */
.fab {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: var(--shadow-md);
    cursor: pointer;
    border: none;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state .icon {
    font-size: 64px;
    margin-bottom: 16px;
}

/* Loading */
.loading {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
}

/* Admin Panel Styles */
.admin-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 16px;
}

.admin-header {
    background: var(--card-bg);
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.admin-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    overflow-x: auto;
    padding-bottom: 8px;
}

.admin-tab {
    padding: 10px 16px;
    background: var(--card-bg);
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.admin-tab.active {
    background: var(--primary-color);
    color: white;
}

.admin-section {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}

.admin-section h3 {
    font-size: 16px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

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

.form-group label {
    display: block;
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 15px;
    outline: none;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--primary-color);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-warning {
    background: var(--warning-color);
    color: white;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-sm {
    padding: 8px 12px;
    font-size: 13px;
}

/* User/IP List */
.user-list {
    max-height: 400px;
    overflow-y: auto;
}

.user-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
}

.user-item:last-child {
    border-bottom: none;
}

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

.user-item-actions {
    display: flex;
    gap: 8px;
}

.status-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}

.status-badge.banned {
    background: #FFE5E5;
    color: var(--danger-color);
}

.status-badge.active {
    background: #E5F9E5;
    color: var(--success-color);
}

.status-badge.admin {
    background: #E5F5FF;
    color: var(--primary-color);
}

/* Warning Records */
.warning-item {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}

.warning-item:last-child {
    border-bottom: none;
}

.warning-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
}

.warning-reason {
    color: var(--danger-color);
}

.warning-time {
    color: var(--text-secondary);
    font-size: 12px;
}

/* Group Settings */
.group-settings {
    display: grid;
    gap: 16px;
}

.toggle-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.toggle-group:last-child {
    border-bottom: none;
}

.toggle-label {
    font-size: 15px;
}

.toggle-switch {
    position: relative;
    width: 50px;
    height: 28px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-color);
    transition: 0.3s;
    border-radius: 28px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--primary-color);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(22px);
}

/* File Upload */
.file-upload {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.file-upload:hover {
    border-color: var(--primary-color);
    background: rgba(0, 191, 255, 0.05);
}

.file-upload-icon {
    font-size: 40px;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.file-upload-text {
    font-size: 14px;
    color: var(--text-secondary);
}

#file-input {
    display: none;
}

/* Violation Words */
.word-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.word-tag {
    padding: 6px 12px;
    background: var(--bg-color);
    border-radius: 16px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.word-tag .remove {
    cursor: pointer;
    color: var(--danger-color);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Pull to Refresh */
.pull-refresh {
    text-align: center;
    padding: 10px;
    color: var(--text-secondary);
    font-size: 13px;
}

/* Message Actions */
.message-actions {
    display: none;
    position: absolute;
    top: -30px;
    right: 0;
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    padding: 4px;
}

.message:hover .message-actions {
    display: flex;
    gap: 4px;
}

.message-action-btn {
    padding: 6px 10px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 12px;
    border-radius: 4px;
}

.message-action-btn:hover {
    background: var(--bg-color);
}

/* Responsive */
@media (max-width: 480px) {
    .auth-box {
        padding: 30px 20px;
    }

    .group-avatar {
        width: 48px;
        height: 48px;
    }

    .message-content {
        max-width: 85%;
    }
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 14px;
    z-index: 2000;
    animation: toastIn 0.3s ease;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Mute Indicator */
.mute-indicator {
    background: var(--danger-color);
    color: white;
    padding: 8px 16px;
    text-align: center;
    font-size: 13px;
}
