/* ============================================
   NexusChat - Component Styles
   ============================================ */

/* ============================================
   個人資料卡片
   ============================================ */

.profile-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.profile-avatar {
    position: relative;
    width: 64px;
    height: 64px;
    flex-shrink: 0;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    border-radius: var(--radius-full);
    object-fit: cover;
}

.profile-avatar .status-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    border-width: 3px;
}

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

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

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

.btn-edit-profile {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.btn-edit-profile:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

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

/* ============================================
   快捷功能
   ============================================ */

.quick-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding: 16px;
    background: var(--surface);
    border-bottom: 8px solid var(--bg-secondary);
}

.quick-action-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 12px 8px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.quick-action-item:hover {
    background: var(--bg-hover);
}

.quick-action-item:active {
    transform: scale(0.95);
}

.quick-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.quick-icon svg {
    width: 24px;
    height: 24px;
}

.quick-icon.keep { background: linear-gradient(135deg, #FFB347 0%, #FFCC33 100%); }
.quick-icon.sticker { background: linear-gradient(135deg, #FF6B6B 0%, #FF8E8E 100%); }
.quick-icon.theme { background: linear-gradient(135deg, #4FACFE 0%, #00F2FE 100%); }
.quick-icon.services { background: linear-gradient(135deg, #667EEA 0%, #764BA2 100%); }

.quick-action-item span {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

/* ============================================
   好友列表
   ============================================ */

.friends-section {
    background: var(--surface);
}

.section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-secondary);
}

.friend-count {
    font-weight: 400;
    color: var(--text-muted);
}

.friend-category {
    border-bottom: 1px solid var(--border);
}

.category-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.category-header:hover {
    background: var(--bg-hover);
}

.category-header svg {
    width: 20px;
    height: 20px;
    color: var(--text-secondary);
}

.category-header span {
    font-size: 15px;
    font-weight: 500;
}

.category-header .count {
    color: var(--text-muted);
    font-weight: 400;
    margin-left: auto;
}

.category-header .chevron {
    color: var(--text-muted);
    transition: transform var(--transition-fast);
}

.category-header.expanded .chevron {
    transform: rotate(180deg);
}

.category-content {
    display: none;
    padding-bottom: 8px;
}

.category-content.expanded {
    display: block;
}

/* 好友項目 */
.friend-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background var(--transition-fast);
}

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

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

.friend-avatar {
    position: relative;
    width: 48px;
    height: 48px;
    flex-shrink: 0;
}

.friend-avatar img {
    width: 100%;
    height: 100%;
    border-radius: var(--radius-full);
    object-fit: cover;
}

.friend-avatar .status-dot {
    position: absolute;
    bottom: 0;
    right: 0;
}

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

.friend-name {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 2px;
}

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

/* 群組頭像 */
.group-avatar {
    width: 48px;
    height: 48px;
    background: var(--primary-bg);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.group-avatar svg {
    width: 24px;
    height: 24px;
    color: var(--primary);
}

.group-avatar.multi {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    padding: 2px;
    overflow: hidden;
}

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

.group-member-count {
    font-size: 12px;
    color: var(--text-muted);
}

/* ============================================
   聊天列表
   ============================================ */

.chat-list {
    background: var(--surface);
}

.chat-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    cursor: pointer;
    transition: background var(--transition-fast);
    position: relative;
}

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

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

.chat-item.unread {
    background: var(--primary-bg);
}

.chat-item.pinned::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 8px;
    width: 6px;
    height: 6px;
    background: var(--primary);
    border-radius: var(--radius-full);
}

.chat-avatar {
    position: relative;
    width: 56px;
    height: 56px;
    flex-shrink: 0;
}

.chat-avatar img {
    width: 100%;
    height: 100%;
    border-radius: var(--radius-full);
    object-fit: cover;
}

.chat-avatar.group {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    font-weight: 700;
    border-radius: var(--radius-lg);
}

.chat-avatar .status-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 14px;
    height: 14px;
    border-width: 3px;
}

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

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

.chat-name {
    font-size: 16px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-time {
    font-size: 12px;
    color: var(--text-muted);
    flex-shrink: 0;
    margin-left: 8px;
}

.chat-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

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

.chat-item.unread .chat-message {
    color: var(--text-primary);
    font-weight: 500;
}

.chat-badge {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: var(--primary);
    color: white;
    font-size: 12px;
    font-weight: 700;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chat-muted {
    color: var(--text-muted);
}

.chat-muted svg {
    width: 16px;
    height: 16px;
}

/* ============================================
   動態時報
   ============================================ */

/* 限時動態 */
.stories-section {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
}

.stories-scroll {
    display: flex;
    gap: 16px;
    padding: 0 16px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.stories-scroll::-webkit-scrollbar {
    display: none;
}

.story-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    scroll-snap-align: start;
    cursor: pointer;
}

.story-avatar {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-full);
    padding: 3px;
    background: linear-gradient(135deg, #FF6B6B 0%, #FF8E53 50%, #FFE66D 100%);
}

.story-avatar img {
    width: 100%;
    height: 100%;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 3px solid var(--surface);
}

.story-item.viewed .story-avatar {
    background: var(--border);
}

.story-item.add-story .story-avatar {
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.add-icon {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 300;
    color: var(--primary);
    background: var(--surface);
    border-radius: var(--radius-full);
}

.story-item span {
    font-size: 12px;
    color: var(--text-secondary);
    max-width: 64px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
}

/* 發文區 */
.post-composer {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--surface);
    border-bottom: 8px solid var(--bg-secondary);
}

.composer-avatar {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.composer-avatar img {
    width: 100%;
    height: 100%;
    border-radius: var(--radius-full);
    object-fit: cover;
}

.composer-input {
    flex: 1;
    padding: 10px 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-full);
    font-size: 14px;
    color: var(--text-muted);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.composer-input:hover {
    background: var(--bg-tertiary);
}

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

.composer-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

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

.composer-btn.photo { color: var(--success); }
.composer-btn.video { color: var(--error); }

.composer-btn:hover {
    background: var(--bg-hover);
}

/* 貼文列表 */
.posts-feed {
    background: var(--bg-secondary);
}

.post-card {
    background: var(--surface);
    margin-bottom: 8px;
}

.post-author-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
}

.post-author-avatar {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
}

.post-author-avatar img {
    width: 100%;
    height: 100%;
    border-radius: var(--radius-full);
    object-fit: cover;
}

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

.post-author-name {
    font-size: 15px;
    font-weight: 600;
}

.post-time {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

.post-menu-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.post-menu-btn:hover {
    background: var(--bg-hover);
}

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

.post-text {
    padding: 0 16px 12px;
    font-size: 15px;
    line-height: 1.6;
}

.post-media {
    position: relative;
    background: var(--bg-secondary);
}

.post-media img,
.post-media video {
    width: 100%;
    display: block;
}

.post-media-grid {
    display: grid;
    gap: 2px;
}

.post-media-grid.grid-2 {
    grid-template-columns: 1fr 1fr;
}

.post-media-grid.grid-3 {
    grid-template-columns: 2fr 1fr;
    grid-template-rows: 1fr 1fr;
}

.post-media-grid.grid-3 > *:first-child {
    grid-row: span 2;
}

.post-media-grid.grid-4 {
    grid-template-columns: 1fr 1fr;
}

.post-stats {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 16px;
    font-size: 13px;
    color: var(--text-secondary);
}

.post-actions {
    display: flex;
    border-top: 1px solid var(--border);
}

.post-action {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.post-action:hover {
    background: var(--bg-hover);
}

.post-action:active {
    background: var(--bg-active);
}

.post-action.liked {
    color: var(--error);
}

.post-action svg {
    width: 20px;
    height: 20px;
}

.post-action span {
    font-size: 14px;
    font-weight: 500;
}

/* ============================================
   VOOM
   ============================================ */

.voom-content {
    background: var(--bg-primary);
}

.voom-tabs {
    display: flex;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.voom-tab {
    flex: 1;
    padding: 14px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-secondary);
    position: relative;
    transition: color var(--transition-fast);
}

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

.voom-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 3px;
    background: var(--primary);
    border-radius: var(--radius-full) var(--radius-full) 0 0;
}

.voom-feed {
    display: flex;
    flex-direction: column;
}

.voom-item {
    position: relative;
    aspect-ratio: 9/16;
    max-height: 100vh;
    background: var(--bg-secondary);
    scroll-snap-align: start;
}

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

.voom-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(transparent 60%, rgba(0,0,0,0.8));
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 16px;
}

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

.voom-author img {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    object-fit: cover;
}

.voom-author-name {
    color: white;
    font-weight: 600;
}

.voom-description {
    color: white;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 8px;
}

.voom-actions {
    position: absolute;
    right: 12px;
    bottom: 100px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.voom-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: white;
}

.voom-action svg {
    width: 28px;
    height: 28px;
}

.voom-action span {
    font-size: 12px;
    font-weight: 500;
}

/* ============================================
   錢包
   ============================================ */

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

.wallet-header h1 {
    color: white;
}

.wallet-header .icon-btn {
    color: white;
}

.wallet-card {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 24px;
    margin: 16px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
}

.wallet-balance {
    margin-bottom: 24px;
}

.balance-label {
    display: block;
    font-size: 13px;
    opacity: 0.9;
    margin-bottom: 4px;
}

.balance-amount {
    font-size: 32px;
    font-weight: 700;
}

.wallet-actions {
    display: flex;
    justify-content: space-between;
}

.wallet-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: white;
}

.wallet-action .action-icon {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-fast);
}

.wallet-action:hover .action-icon {
    background: rgba(255, 255, 255, 0.3);
}

.wallet-action svg {
    width: 22px;
    height: 22px;
}

.wallet-action span {
    font-size: 12px;
    font-weight: 500;
}

.wallet-services {
    padding: 20px 16px;
    background: var(--surface);
    margin-bottom: 8px;
}

.wallet-services h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.service-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 8px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.service-item:hover {
    background: var(--bg-tertiary);
}

.service-icon {
    font-size: 24px;
}

.service-item span:not(.service-value) {
    font-size: 12px;
    color: var(--text-secondary);
}

.service-value {
    font-size: 14px;
    font-weight: 700;
    color: var(--primary);
}

.transaction-history {
    padding: 20px 16px;
    background: var(--surface);
}

.transaction-history h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
}

.transaction-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}

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

.transaction-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-full);
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.transaction-icon img {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
}

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

.transaction-title {
    font-size: 15px;
    font-weight: 500;
    margin-bottom: 2px;
}

.transaction-date {
    font-size: 13px;
    color: var(--text-muted);
}

.transaction-amount {
    font-size: 16px;
    font-weight: 600;
}

.transaction-amount.income {
    color: var(--success);
}

.transaction-amount.expense {
    color: var(--text-primary);
}
