/* 基础样式和变量 */
:root {
    --primary-color: #2196F3;
    --primary-dark: #1976D2;
    --secondary-color: #FF4081;
    --background-color: #fafafa;
    --surface-color: #ffffff;
    --text-primary: #212121;
    --text-secondary: #757575;
    --border-color: #e0e0e0;
    --success-color: #4CAF50;
    --warning-color: #FF9800;
    --error-color: #F44336;
    --shadow: 0 2px 4px rgba(0,0,0,0.1);
    --border-radius: 8px;
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--background-color);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

#app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 工具类 */
.hidden {
    display: none !important;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 16px;
    transition: var(--transition);
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--text-secondary);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 16px;
    transition: var(--transition);
}

.icon-btn {
    background: transparent;
    border: none;
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

.icon-btn:hover {
    background: rgba(0,0,0,0.1);
}

/* 头部样式 */
.header {
    background: var(--surface-color);
    padding: 16px 20px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header h1 {
    font-size: 20px;
    font-weight: 600;
    color: var(--primary-color);
}

.status-bar {
    display: flex;
    align-items: center;
    gap: 16px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary);
}

.indicator-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--error-color);
    transition: var(--transition);
}

.indicator-dot.active {
    background: var(--success-color);
}

.indicator-dot.warning {
    background: var(--warning-color);
}

/* 主内容区域 */
.main-content {
    flex: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

/* 雷达界面 */
.radar-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-height: 400px;
}

.radar-circle {
    position: relative;
    width: 300px;
    height: 300px;
    border: 2px solid var(--primary-color);
    border-radius: 50%;
    background: radial-gradient(circle, rgba(33,150,243,0.1) 0%, rgba(33,150,243,0.05) 50%, transparent 100%);
    margin-bottom: 30px;
    overflow: hidden;
}

.radar-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.user-avatar {
    color: white;
    font-weight: 600;
    font-size: 14px;
}

.radar-sweep {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 2px;
    height: 150px;
    background: linear-gradient(to bottom, var(--primary-color), transparent);
    transform-origin: bottom;
    transform: translate(-50%, -100%) rotate(0deg);
    animation: radar-sweep 3s linear infinite;
}

@keyframes radar-sweep {
    from { transform: translate(-50%, -100%) rotate(0deg); }
    to { transform: translate(-50%, -100%) rotate(360deg); }
}

.detected-user {
    position: absolute;
    width: 40px;
    height: 40px;
    background: var(--secondary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    animation: user-appear 0.5s ease-out;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.detected-user:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

@keyframes user-appear {
    from {
        opacity: 0;
        transform: scale(0);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.radar-info {
    text-align: center;
    color: var(--text-secondary);
}

.detected-count {
    font-size: 18px;
    font-weight: 600;
    margin-top: 10px;
    color: var(--primary-color);
}

/* 聊天界面 */
.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 120px);
    background: var(--surface-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.chat-header {
    background: var(--primary-color);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-header .icon-btn {
    color: white;
}

.chat-title {
    flex: 1;
    text-align: center;
    margin: 0 16px;
}

.chat-title span {
    display: block;
    font-size: 16px;
    font-weight: 600;
}

.chat-type {
    font-size: 12px !important;
    opacity: 0.8;
    font-weight: normal !important;
}

.chat-actions {
    display: flex;
    gap: 8px;
}

.privacy-btn {
    background: rgba(255,255,255,0.2);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    transition: var(--transition);
}

.privacy-btn:hover {
    background: rgba(255,255,255,0.3);
}

.messages-container {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
    position: relative;
    animation: message-appear 0.3s ease-out;
}

@keyframes message-appear {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.own {
    background: var(--primary-color);
    color: white;
    align-self: flex-end;
    margin-left: auto;
}

.message.other {
    background: var(--border-color);
    color: var(--text-primary);
    align-self: flex-start;
}

.message-sender {
    font-size: 12px;
    opacity: 0.7;
    margin-bottom: 4px;
}

.message-time {
    font-size: 11px;
    opacity: 0.6;
    margin-top: 4px;
}

.input-container {
    display: flex;
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    gap: 12px;
}

#messageInput {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 24px;
    font-size: 16px;
    outline: none;
    transition: var(--transition);
}

#messageInput:focus {
    border-color: var(--primary-color);
}

.send-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 24px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: var(--transition);
    min-width: 80px;
}

.send-btn:hover:not(:disabled) {
    background: var(--primary-dark);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 设置面板 */
.settings-panel {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    max-width: 400px;
    height: 100vh;
    background: var(--surface-color);
    box-shadow: -4px 0 20px rgba(0,0,0,0.1);
    transition: right 0.3s ease;
    z-index: 1000;
}

.settings-panel.active {
    right: 0;
}

.settings-content {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.settings-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.settings-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.setting-item {
    margin-bottom: 24px;
}

.setting-item label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
}

.setting-item input[type="text"],
.setting-item select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 16px;
    outline: none;
    transition: var(--transition);
}

.setting-item input[type="text"]:focus,
.setting-item select:focus {
    border-color: var(--primary-color);
}

.setting-item input[type="range"] {
    width: 100%;
    margin-right: 12px;
}

/* 开关按钮样式 */
.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary-color);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

/* 模态框 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-content {
    background: var(--surface-color);
    padding: 24px;
    border-radius: var(--border-radius);
    max-width: 400px;
    width: 90%;
    text-align: center;
    animation: modal-appear 0.3s ease-out;
}

@keyframes modal-appear {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    justify-content: center;
}

/* Toast通知 */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-primary);
    color: white;
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 14px;
    z-index: 3000;
    animation: toast-appear 0.3s ease-out;
}

@keyframes toast-appear {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .main-content {
        padding: 16px;
    }
    
    .radar-circle {
        width: 250px;
        height: 250px;
    }
    
    .radar-center {
        width: 50px;
        height: 50px;
    }
    
    .detected-user {
        width: 35px;
        height: 35px;
        font-size: 11px;
    }
    
    .settings-panel {
        width: 100%;
        max-width: none;
    }
    
    .modal-content {
        margin: 20px;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 12px 16px;
    }
    
    .header h1 {
        font-size: 18px;
    }
    
    .main-content {
        padding: 12px;
    }
    
    .radar-circle {
        width: 200px;
        height: 200px;
    }
    
    .input-container {
        padding: 12px 16px;
    }
    
    .message {
        max-width: 90%;
    }
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
} 