:root {
    --primary: #4A90D9;
    --primary-light: #7CB3E8;
    --primary-dark: #2E6DB4;
    --bg: #F0F6FF;
    --bg-white: #FFFFFF;
    --bg-card: rgba(255, 255, 255, 0.85);
    --text: #2C3E50;
    --text-light: #7F8C9B;
    --text-lighter: #A8B5C2;
    --border: #E1EBF5;
    --shadow: rgba(74, 144, 217, 0.1);
    --danger: #E74C3C;
    --success: #27AE60;
    --gradient: linear-gradient(135deg, #E8F4FD 0%, #FFFFFF 50%, #E8F4FD 100%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--gradient);
    min-height: 100vh;
    color: var(--text);
}

.app-container {
    max-width: 430px;
    margin: 0 auto;
    min-height: 100vh;
    background: var(--bg);
    position: relative;
    overflow-x: hidden;
}

.auth-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(180deg, #D4E8F9 0%, #FFFFFF 60%, #D4E8F9 100%);
}

.auth-logo {
    width: 80px;
    height: 80px;
    background: var(--primary);
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    box-shadow: 0 8px 24px var(--shadow);
}

.auth-logo svg {
    width: 48px;
    height: 48px;
    fill: white;
}

.auth-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}

.auth-subtitle {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 32px;
}

.auth-form {
    width: 100%;
    max-width: 360px;
}

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

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
    padding: 14px 16px;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    font-size: 15px;
    background: var(--bg-white);
    transition: all 0.3s;
    outline: none;
}

.form-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.15);
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 8px;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--shadow);
}

.auth-link {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    color: var(--text-light);
}

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

.error-msg {
    background: #FFF0F0;
    color: var(--danger);
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 16px;
    border: 1px solid #FFD4D4;
}

.header {
    background: var(--bg-white);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}

.header-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.header-btn svg {
    width: 20px;
    height: 20px;
}

/* 底部导航 - 椭圆形小尺寸 */
.bottom-nav {
    position: fixed;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    width: 180px;
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 30px;
    display: flex;
    padding: 5px 8px;
    box-shadow: 0 4px 20px rgba(74, 144, 217, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.8);
    z-index: 1000;
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 6px 4px;
    border-radius: 22px;
    text-decoration: none;
    color: var(--text-light);
    transition: all 0.3s;
    position: relative;
}

.nav-item.active {
    background: var(--primary);
    color: white;
}

.nav-item svg {
    width: 16px;
    height: 16px;
    margin-bottom: 2px;
}

.nav-item .nav-icon {
    width: 16px;
    height: 16px;
    margin-bottom: 2px;
    object-fit: contain;
}

.nav-item span {
    font-size: 9px;
    font-weight: 600;
}

.nav-badge {
    position: absolute;
    top: 2px;
    right: calc(50% - 16px);
    background: var(--danger);
    color: white;
    font-size: 8px;
    min-width: 13px;
    height: 13px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
}

.chat-list {
    padding: 12px 16px;
    padding-bottom: 100px;
}

.chat-item {
    display: flex;
    align-items: center;
    padding: 14px;
    background: var(--bg-card);
    border-radius: 16px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    color: inherit;
    border: 1px solid rgba(255, 255, 255, 0.6);
}

.chat-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px var(--shadow);
}

.chat-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 18px;
    margin-right: 14px;
    flex-shrink: 0;
    overflow: hidden;
}

.chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

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

.chat-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-last-msg {
    font-size: 13px;
    color: var(--text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-meta {
    text-align: right;
    flex-shrink: 0;
    margin-left: 10px;
}

.chat-time {
    font-size: 11px;
    color: var(--text-lighter);
    margin-bottom: 6px;
}

.chat-unread {
    background: var(--danger);
    color: white;
    font-size: 11px;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.empty-state svg {
    width: 80px;
    height: 80px;
    fill: var(--border);
    margin-bottom: 16px;
}

.empty-state p {
    font-size: 15px;
    margin-bottom: 8px;
}

.empty-state small {
    font-size: 13px;
    color: var(--text-lighter);
}

.chat-page {
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
}

.chat-header {
    background: var(--bg-white);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.chat-header .back-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-right: 12px;
}

.chat-header .menu-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-left: auto;
}

.chat-header-info {
    display: flex;
    align-items: center;
    flex: 1;
}

.chat-header-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    font-weight: 700;
    margin-right: 10px;
    overflow: hidden;
}

.chat-header-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-header-name {
    font-size: 16px;
    font-weight: 600;
}

.messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.message-bubble {
    display: flex;
    margin-bottom: 16px;
    align-items: flex-start;
}

.message-bubble.sent {
    flex-direction: row-reverse;
}

.msg-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
    overflow: hidden;
}

.msg-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.msg-content {
    max-width: 70%;
    margin: 0 10px;
}

.msg-bubble {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
}

.message-bubble.received .msg-bubble {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-top-left-radius: 4px;
}

.message-bubble.sent .msg-bubble {
    background: var(--primary);
    color: white;
    border-top-right-radius: 4px;
}

.msg-status {
    font-size: 11px;
    color: var(--text-lighter);
    margin-top: 4px;
    text-align: right;
}

.msg-status.read {
    color: var(--primary);
}

.message-input-area {
    background: var(--bg-white);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.message-input-area input {
    flex: 1;
    padding: 12px 16px;
    border: 1.5px solid var(--border);
    border-radius: 20px;
    font-size: 14px;
    outline: none;
    background: var(--bg);
}

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

.send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    margin-left: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-page {
    padding-bottom: 100px;
}

.profile-card {
    background: var(--bg-white);
    margin: 16px;
    padding: 24px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 4px 16px var(--shadow);
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 28px;
    font-weight: 700;
    margin: 0 auto 12px;
    overflow: hidden;
    border: 3px solid white;
    box-shadow: 0 4px 12px var(--shadow);
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-name {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 4px;
}

.profile-username {
    font-size: 13px;
    color: var(--text-light);
}

.profile-menu {
    margin: 16px;
}

.profile-menu-item {
    background: var(--bg-white);
    padding: 16px 20px;
    border-radius: 14px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid var(--border);
}

.profile-menu-item:hover {
    border-color: var(--primary-light);
}

.profile-menu-item svg {
    width: 22px;
    height: 22px;
    fill: var(--primary);
    margin-right: 14px;
}

.profile-menu-item span {
    flex: 1;
    font-size: 15px;
    font-weight: 500;
}

.profile-menu-item .arrow {
    color: var(--text-lighter);
    font-size: 18px;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background: var(--bg-white);
    border-radius: 20px;
    width: 100%;
    max-width: 360px;
    padding: 24px;
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 16px;
    text-align: center;
}

.friend-request {
    background: var(--bg-white);
    padding: 14px 16px;
    border-radius: 14px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    border: 1px solid var(--border);
}

.friend-request-info {
    flex: 1;
    margin-left: 12px;
}

.friend-request-name {
    font-size: 15px;
    font-weight: 600;
}

.friend-request-time {
    font-size: 12px;
    color: var(--text-lighter);
}

.friend-request-btns {
    display: flex;
    gap: 8px;
}

.btn-accept, .btn-reject {
    padding: 6px 14px;
    border-radius: 8px;
    border: none;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

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

.btn-reject {
    background: var(--bg);
    color: var(--text-light);
}

.side-menu {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100%;
    background: var(--bg-white);
    z-index: 3000;
    transition: left 0.3s;
    padding: 20px;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.1);
}

.side-menu.show {
    left: 0;
}

.side-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 2999;
    display: none;
}

.side-menu-overlay.show {
    display: block;
}

.side-menu-item {
    padding: 14px 16px;
    border-radius: 12px;
    margin-bottom: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
}

.side-menu-item:hover {
    background: var(--bg);
}

.side-menu-item.danger {
    color: var(--danger);
}

.qr-container {
    text-align: center;
    padding: 20px;
}

.qr-code {
    width: 200px;
    height: 200px;
    margin: 0 auto 16px;
    background: white;
    padding: 10px;
    border-radius: 12px;
}

.add-friend-panel {
    position: fixed;
    bottom: -100%;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 430px;
    background: var(--bg-white);
    border-radius: 24px 24px 0 0;
    padding: 24px 20px;
    transition: bottom 0.3s;
    z-index: 2000;
    box-shadow: 0 -4px 20px var(--shadow);
}

.add-friend-panel.show {
    bottom: 0;
}

.add-friend-options {
    display: flex;
    gap: 16px;
    margin-top: 16px;
}

.add-friend-option {
    flex: 1;
    background: var(--bg);
    padding: 20px;
    border-radius: 16px;
    text-align: center;
    cursor: pointer;
}

.add-friend-option svg {
    width: 40px;
    height: 40px;
    fill: var(--primary);
    margin-bottom: 8px;
}

.add-friend-option span {
    display: block;
    font-size: 14px;
    font-weight: 600;
}

.scan-page {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: black;
    z-index: 4000;
    display: none;
}

.scan-page.show {
    display: block;
}

.scan-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.scan-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
}

.scan-album {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.3);
    border: none;
    color: white;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
}

.hidden {
    display: none !important;
}
