/* 星辰小手机 - 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --primary-color: #007AFF;
    --bg-color: #000000;
    --surface-color: #1C1C1E;
    --card-color: #2C2C2E;
    --text-primary: #FFFFFF;
    --text-secondary: #8E8E93;
    --border-color: #38383A;
    --success-color: #34C759;
    --danger-color: #FF3B30;
    --warning-color: #FF9500;
    --blur-bg: rgba(28, 28, 30, 0.8);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg-color);
    color: var(--text-primary);
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    position: fixed;
}

.hidden {
    display: none !important;
}

/* 锁屏界面 */
.lock-screen {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    touch-action: pan-y;
}

.lock-time {
    text-align: center;
    margin-bottom: 60vh;
}

.lock-clock {
    font-size: 72px;
    font-weight: 200;
    margin-bottom: 8px;
    letter-spacing: 2px;
}

.lock-date {
    font-size: 18px;
    font-weight: 400;
    opacity: 0.9;
}

.lock-hint {
    position: absolute;
    bottom: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    opacity: 0.8;
    animation: bounce 2s infinite;
}

.lock-icon {
    width: 24px;
    height: 24px;
    stroke-width: 2;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* 主屏幕 */
.home-screen {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding-bottom: 100px;
}

/* 状态栏 */
.status-bar {
    height: 44px;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    backdrop-filter: blur(20px);
    background: rgba(0, 0, 0, 0.3);
    font-size: 15px;
    font-weight: 600;
}

.status-icons {
    display: flex;
    gap: 6px;
}

.status-icon {
    width: 18px;
    height: 18px;
}

/* 用户信息区域 */
.home-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    gap: 12px;
}

.user-avatar-container {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: transform 0.2s;
}

.user-avatar-container:active {
    transform: scale(0.95);
}

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

.user-signature {
    font-size: 14px;
    opacity: 0.9;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 12px;
    transition: background 0.2s;
}

.user-signature:active {
    background: rgba(255, 255, 255, 0.1);
}

/* 时间组件 */
.time-widget {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 20px;
    margin: 20px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.widget-time {
    font-size: 48px;
    font-weight: 300;
    letter-spacing: 1px;
}

.widget-date {
    font-size: 16px;
    opacity: 0.9;
    margin-top: 4px;
}

/* 小组件区域 */
.widgets-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    padding: 0 20px;
    margin-bottom: 20px;
}

.widget {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(20px);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: transform 0.2s;
}

.widget:active {
    transform: scale(0.98);
}

.widget-icon {
    font-size: 32px;
}

.widget-info {
    flex: 1;
}

.widget-title {
    font-size: 12px;
    opacity: 0.8;
    margin-bottom: 4px;
}

.widget-value {
    font-size: 16px;
    font-weight: 600;
}

/* 应用图标区域 */
.apps-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    padding: 20px;
}

.app-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: transform 0.2s;
}

.app-icon:active {
    transform: scale(0.9);
}

.app-icon-img {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(20px);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.app-name {
    font-size: 12px;
    text-align: center;
}

/* Dock栏 */
.dock {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(30px);
    border-radius: 20px;
    padding: 10px 20px;
    display: flex;
    gap: 15px;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.dock-icon {
    cursor: pointer;
    transition: transform 0.2s;
}

.dock-icon:active {
    transform: scale(0.9);
}

.dock-icon-img {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

/* 应用容器 */
.app-container {
    width: 100%;
    height: 100%;
    background: var(--bg-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
}

/* 应用头部 */
.app-header {
    height: 56px;
    display: flex;
    align-items: center;
    padding: 0 16px;
    background: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    gap: 12px;
}

.back-btn, .header-action-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: var(--primary-color);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}

.back-btn:active, .header-action-btn:active {
    background: var(--card-color);
}

.back-btn svg, .header-action-btn svg {
    width: 24px;
    height: 24px;
}

.app-title {
    flex: 1;
    font-size: 18px;
    font-weight: 600;
}

.chat-header-info {
    flex: 1;
}

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

.chat-header-status {
    font-size: 12px;
    color: var(--text-secondary);
}

/* 应用内容 */
.app-content {
    flex: 1;
    overflow-y: auto;
    background: var(--bg-color);
}

/* 聊天标签页 */
.chat-tabs {
    display: flex;
    background: var(--surface-color);
    border-top: 1px solid var(--border-color);
    position: fixed;
    bottom: 0;
    width: 100%;
}

.chat-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px;
    gap: 4px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.2s;
    background: transparent;
    border: none;
}

.chat-tab.active {
    color: var(--primary-color);
}

.chat-tab svg {
    width: 24px;
    height: 24px;
}

.chat-tab span {
    font-size: 11px;
}

/* 聊天内容 */
.chat-content {
    display: none;
    padding-bottom: 70px;
    min-height: calc(100vh - 126px);
}

.chat-content.active {
    display: block;
}

/* 聊天列表 */
.chat-list {
    padding: 0;
}

.chat-item {
    display: flex;
    padding: 16px;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s;
}

.chat-item:active {
    background: var(--surface-color);
}

.chat-item-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

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

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

.chat-item-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}

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

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

.chat-item-message {
    font-size: 14px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-item-status {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--success-color);
    margin-top: 4px;
}

/* 空状态 */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

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

.empty-text {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    opacity: 0.8;
}

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

/* 设置列表 */
.settings-list {
    padding: 0;
}

.setting-section {
    margin-top: 24px;
}

.setting-section:first-child {
    margin-top: 0;
}

.setting-section-title {
    font-size: 13px;
    color: var(--text-secondary);
    text-transform: uppercase;
    padding: 12px 16px;
    font-weight: 600;
}

.setting-item {
    display: flex;
    align-items: center;
    padding: 16px;
    gap: 12px;
    background: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s;
}

.setting-item:active {
    background: var(--card-color);
}

.setting-icon {
    font-size: 28px;
    width: 32px;
    text-align: center;
}

.setting-info {
    flex: 1;
}

.setting-title {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 2px;
}

.setting-desc {
    font-size: 13px;
    color: var(--text-secondary);
}

.setting-arrow {
    width: 20px;
    height: 20px;
    color: var(--text-secondary);
}

/* 切换开关 */
.toggle {
    position: relative;
    display: inline-block;
    width: 51px;
    height: 31px;
}

.toggle 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: 31px;
}

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

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

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

.toggle-item {
    cursor: default;
}

.toggle-item:active {
    background: var(--surface-color);
}

/* 聊天消息区域 */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: var(--bg-color);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message {
    display: flex;
    gap: 8px;
    max-width: 80%;
    animation: messageIn 0.3s ease;
}

@keyframes messageIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message.char {
    align-self: flex-start;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

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

.message-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.message-bubble {
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
    position: relative;
    cursor: pointer;
}

.message.user .message-bubble {
    background: var(--primary-color);
    border-bottom-right-radius: 4px;
}

.message.char .message-bubble {
    background: var(--surface-color);
    border-bottom-left-radius: 4px;
}

.message-bubble.selected {
    box-shadow: 0 0 0 2px var(--warning-color);
}

.message-time {
    font-size: 11px;
    color: var(--text-secondary);
    padding: 0 8px;
}

.message.user .message-time {
    text-align: right;
}

/* 聊天输入区域 */
.chat-input-container {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--surface-color);
    border-top: 1px solid var(--border-color);
}

.chat-tool-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}

.chat-tool-btn:active {
    background: var(--card-color);
}

.chat-tool-btn svg {
    width: 24px;
    height: 24px;
}

.chat-input {
    flex: 1;
    padding: 10px 16px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    color: var(--text-primary);
    font-size: 15px;
    outline: none;
}

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

.chat-send-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: opacity 0.2s;
}

.chat-send-btn:active {
    opacity: 0.8;
}

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

/* 消息菜单 */
.message-menu {
    position: fixed;
    background: var(--surface-color);
    border-radius: 12px;
    padding: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    border: 1px solid var(--border-color);
}

.message-menu-item {
    padding: 12px 16px;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.2s;
    white-space: nowrap;
    font-size: 15px;
}

.message-menu-item:active {
    background: var(--card-color);
}

/* 回顾列表 */
.review-list {
    padding: 0;
}

.review-item {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s;
}

.review-item:active {
    background: var(--surface-color);
}

.review-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.review-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
}

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

.review-info {
    flex: 1;
}

.review-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.review-stats {
    display: flex;
    gap: 16px;
    margin-top: 8px;
}

.review-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.review-stat-label {
    font-size: 11px;
    color: var(--text-secondary);
}

.review-stat-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary-color);
}

/* 世界书列表 */
.worldbook-list {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.worldbook-item {
    background: var(--surface-color);
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: transform 0.2s;
    border: 1px solid var(--border-color);
}

.worldbook-item:active {
    transform: scale(0.98);
}

.worldbook-folder {
    background: var(--card-color);
}

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

.worldbook-icon {
    font-size: 32px;
}

.worldbook-info {
    flex: 1;
}

.worldbook-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.worldbook-desc {
    font-size: 13px;
    color: var(--text-secondary);
}

/* 模态框 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}

.modal-content {
    background: var(--surface-color);
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

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

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--card-color);
    color: var(--text-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}

.modal-close:active {
    background: var(--border-color);
}

.modal-close svg {
    width: 20px;
    height: 20px;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

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

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

.form-input, .form-textarea, .form-select {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 15px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

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

.form-textarea {
    min-height: 100px;
    resize: vertical;
}

.form-hint {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 6px;
}

/* 按钮样式 */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn:active {
    opacity: 0.8;
}

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

.btn-secondary {
    background: var(--card-color);
    color: var(--text-primary);
}

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

.btn-full {
    width: 100%;
}

.btn-group {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 打字动画 */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: var(--surface-color);
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    width: fit-content;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--text-secondary);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

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

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

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

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

/* 响应式设计 */
@media (max-width: 480px) {
    .lock-clock {
        font-size: 64px;
    }
    
    .widget-time {
        font-size: 40px;
    }
    
    .apps-container {
        gap: 16px;
        padding: 16px;
    }
    
    .app-icon-img {
        width: 56px;
        height: 56px;
        font-size: 28px;
    }
}

/* 过渡动画 */
.fade-enter {
    opacity: 0;
}

.fade-enter-active {
    opacity: 1;
    transition: opacity 0.3s;
}

.fade-exit {
    opacity: 1;
}

.fade-exit-active {
    opacity: 0;
    transition: opacity 0.3s;
}

.slide-enter {
    transform: translateX(100%);
}

.slide-enter-active {
    transform: translateX(0);
    transition: transform 0.3s ease;
}

.slide-exit {
    transform: translateX(0);
}

.slide-exit-active {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}
