* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --primary: #7c3aed;
    --secondary: #3b82f6;
    --primary-glow: rgba(124, 58, 237, 0.4);
    --secondary-glow: rgba(59, 130, 246, 0.3);
    --bg: #0a0a0f;
    --bg-elevated: rgba(255, 255, 255, 0.03);
    --bg-card: rgba(255, 255, 255, 0.04);
    --border: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(255, 255, 255, 0.12);
    --text: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.6);
    --text-muted: rgba(255, 255, 255, 0.35);
    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 20px;
    --radius-xl: 24px;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 40px var(--primary-glow);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Vazirmatn', sans-serif;
    background: var(--bg);
    color: var(--text);
    height: 100vh;
    height: 100dvh;
    height: var(--app-height, 100vh);
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    position: fixed;
    inset: 0;
    -webkit-font-smoothing: antialiased;
}

[role="button"]:focus-visible,
[role="switch"]:focus-visible,
button:focus-visible,
input:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

#bgLights {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.bg-photo-layer {
    position: absolute;
    inset: -20px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    filter: blur(2px);
    transform: scale(1.05);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.bg-photo-layer.active {
    opacity: 1;
}

.bg-dark-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.bg-dark-overlay.active {
    opacity: 1;
}

/* When a photo wallpaper is active, keep the theme-colored glow blobs
   hidden so switching themes doesn't tint the photo's own colors */
#bgLights.has-photo .light,
#bgLights.has-photo .mesh-gradient {
    opacity: 0 !important;
}

.light {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.35;
    animation: floatLight 10s ease-in-out infinite alternate;
}

.light-1 {
    width: 400px;
    height: 400px;
    top: -100px;
    left: -100px;
    background: var(--primary-glow);
    animation-delay: 0s;
}

.light-2 {
    width: 500px;
    height: 500px;
    bottom: -150px;
    right: -150px;
    background: var(--secondary-glow);
    animation-delay: 3s;
}

.light-3 {
    width: 300px;
    height: 300px;
    top: 40%;
    right: 10%;
    background: var(--primary-glow);
    animation-delay: 5s;
}

.light-4 {
    width: 350px;
    height: 350px;
    bottom: 20%;
    left: 5%;
    background: var(--secondary-glow);
    animation-delay: 7s;
}

.light-5 {
    width: 250px;
    height: 250px;
    top: 10%;
    right: 40%;
    background: rgba(236, 72, 153, 0.15);
    animation-delay: 2s;
}

.mesh-gradient {
    position: absolute;
    inset: 0;
    background: 
        radial-gradient(ellipse at 20% 30%, var(--primary-glow) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 70%, var(--secondary-glow) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(124, 58, 237, 0.05) 0%, transparent 70%);
    animation: meshMove 15s ease-in-out infinite alternate;
}

@keyframes floatLight {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(60px, 40px) scale(1.3); }
}

@keyframes meshMove {
    0% { opacity: 0.5; transform: scale(1); }
    100% { opacity: 0.8; transform: scale(1.1); }
}

#loadingOverlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.8s ease, visibility 0.8s ease;
}

#loadingOverlay.hide {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-glow {
    position: absolute;
    width: 340px;
    height: 340px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--primary-glow) 0%, var(--secondary-glow) 45%, transparent 75%);
    filter: blur(60px);
    opacity: 0;
    animation: loaderGlowIn 1.2s ease forwards, loaderGlowPulse 3s ease-in-out 1.2s infinite;
}

@keyframes loaderGlowIn {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 0.8; transform: scale(1); }
}

@keyframes loaderGlowPulse {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50% { opacity: 0.9; transform: scale(1.08); }
}

.loader-box {
    position: relative;
    width: 140px;
    height: 140px;
}

.loader-img {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: contain;
    will-change: transform, opacity;
    opacity: 0;
    filter: drop-shadow(0 0 18px var(--primary-glow));
    transition: transform 1s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.6s ease;
}

.loader-img.left { transform: translateX(-150%) scale(0.5) rotate(-15deg); }
.loader-img.right { transform: translateX(150%) scale(0.5) rotate(15deg); }

.loader-img.left.active,
.loader-img.right.active {
    transform: translateX(0%) scale(1) rotate(0deg);
    opacity: 1;
}

#mainPage {
    display: none;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    height: var(--app-height, 100vh);
    padding: 16px 16px calc(100px + env(safe-area-inset-bottom, 0px)) 16px;
    flex-direction: column;
    animation: fadeIn 0.8s ease;
    position: relative;
    z-index: 1;
}

#mainPage.show { display: flex; }

#contentArea {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    position: relative;
    z-index: 2;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    touch-action: pan-y;
    padding: 8px 0;
    scrollbar-width: none;
}

#contentArea::-webkit-scrollbar { display: none; }

.content-page {
    display: none;
    width: 100%;
    max-width: 480px;
    animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    padding-bottom: 20px;
}

.content-page.active { display: block; }

@keyframes fadeIn {
    0% { opacity: 0; transform: scale(0.95); }
    100% { opacity: 1; transform: scale(1); }
}

@keyframes slideUp {
    0% { opacity: 0; transform: translateY(20px); }
    100% { opacity: 1; transform: translateY(0); }
}

.hero-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 60px 20px 40px;
    min-height: 60vh;
}

.hero-logo {
    position: relative;
    width: 132px;
    height: 132px;
    margin: 70px auto 24px;
    isolation: isolate;
}

.logo-beam {
    position: absolute;
    left: 50%;
    top: -90px;
    width: 180px;
    height: 170px;
    transform: translateX(-50%);
    background: linear-gradient(180deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.06) 20%,
        var(--primary-glow) 65%,
        rgba(255, 255, 255, 0) 100%);
    clip-path: polygon(47% 0%, 53% 0%, 96% 100%, 4% 100%);
    filter: blur(7px);
    opacity: 0.5;
    mix-blend-mode: screen;
    animation: beamFlicker 7s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

.logo-beam-glow {
    position: absolute;
    left: 50%;
    top: -14px;
    width: 130px;
    height: 130px;
    transform: translateX(-50%);
    background: radial-gradient(circle, var(--primary-glow) 0%, rgba(124, 58, 237, 0) 70%);
    filter: blur(16px);
    opacity: 0.55;
    animation: beamFlicker 7s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

.logo-floor-glow {
    position: absolute;
    left: 50%;
    bottom: -12px;
    width: 120px;
    height: 22px;
    transform: translateX(-50%);
    background: radial-gradient(ellipse, var(--primary-glow) 0%, rgba(124, 58, 237, 0) 75%);
    filter: blur(7px);
    opacity: 0.45;
    animation: beamFlicker 7s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

.logo-icon {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    animation: iconGlow 4s ease-in-out infinite;
}

.logo-icon-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 8px;
    animation: iconGlow 4s ease-in-out infinite;
    filter: drop-shadow(0 0 20px var(--primary-glow));
    z-index: 1;
}

@keyframes beamFlicker {
    0%, 100% { opacity: 0.5; }
    9% { opacity: 0.36; }
    22% { opacity: 0.58; }
    38% { opacity: 0.42; }
    51% { opacity: 0.6; }
    67% { opacity: 0.4; }
    84% { opacity: 0.54; }
}

@keyframes iconGlow {
    0%, 100% { filter: drop-shadow(0 0 12px var(--primary-glow)); }
    50% { filter: drop-shadow(0 0 30px var(--primary-glow)); }
}

.hero-section h1 {
    font-size: 32px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.hero-subtitle {
    color: var(--text-secondary);
    font-size: 15px;
    margin-bottom: 32px;
}

.hero-stats {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 16px 28px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
}

.hero-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.hero-stat-num {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
}

.hero-stat-label {
    font-size: 11px;
    color: var(--text-muted);
}

.hero-stat-divider {
    width: 1px;
    height: 30px;
    background: var(--border);
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding: 0 4px;
}

.page-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
}

.page-title i {
    color: var(--primary);
    font-size: 16px;
}

.page-refresh {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.page-refresh:active {
    transform: scale(0.9) rotate(180deg);
}

.page-refresh:hover {
    background: var(--bg-elevated);
    border-color: var(--border-hover);
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 10px 14px;
    margin-bottom: 16px;
    transition: var(--transition);
    backdrop-filter: blur(16px) saturate(160%);
    -webkit-backdrop-filter: blur(16px) saturate(160%);
}

.search-bar:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.search-bar .search-icon {
    color: var(--text-muted);
    font-size: 13px;
}

.search-bar input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    direction: rtl;
}

.search-bar input::placeholder {
    color: var(--text-muted);
}

.search-bar .search-clear {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 13px;
    cursor: pointer;
    padding: 4px;
    transition: var(--transition);
}

.search-bar .search-clear:active {
    transform: scale(0.9);
}

.days-tabs-wrapper {
    margin: 0 -16px 16px -16px;
    padding: 8px 16px;
    position: relative;
    background: linear-gradient(180deg, rgba(0,0,0,0.2) 0%, transparent 100%);
    border-bottom: 1px solid var(--border);
}

.days-tabs {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 4px 2px 8px 2px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    align-items: center;
}

.days-tabs::-webkit-scrollbar { display: none; }

.day-tab-all, .day-tab {
    flex-shrink: 0;
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.day-tab-all:active, .day-tab:active {
    transform: scale(0.95);
}

.day-tab-all.active, .day-tab.active {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-color: transparent;
    color: #fff;
    box-shadow: 0 4px 15px var(--primary-glow);
}

.day-tab .badge, .day-tab-all .badge {
    font-size: 10px;
    background: rgba(255, 255, 255, 0.15);
    padding: 2px 8px;
    border-radius: 10px;
    color: inherit;
    font-weight: 600;
}

.user-filter-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.15), rgba(59, 130, 246, 0.1));
    border: 1px solid rgba(124, 58, 237, 0.3);
    border-radius: var(--radius-lg);
    margin-bottom: 16px;
    animation: slideDown 0.3s ease;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.user-filter-chip i {
    color: var(--primary);
    font-size: 14px;
}

.user-filter-chip > span:not(.user-filter-count) {
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
}

.user-filter-count {
    font-size: 11px !important;
    color: var(--text-muted) !important;
    background: rgba(255, 255, 255, 0.08);
    padding: 2px 10px;
    border-radius: 10px;
}

.user-filter-close {
    margin-right: auto;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    transition: var(--transition);
}

.user-filter-close:active {
    transform: scale(0.85);
}

@keyframes slideDown {
    0% { opacity: 0; transform: translateY(-10px); }
    100% { opacity: 1; transform: translateY(0); }
}

.state-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    font-size: 14px;
    gap: 12px;
}

.state-icon {
    font-size: 40px;
    opacity: 0.5;
    margin-bottom: 4px;
}

.state-hint {
    font-size: 12px;
    opacity: 0.5;
    margin-top: 4px;
}

.spinner-ring {
    display: inline-block;
    position: relative;
    width: 40px;
    height: 40px;
}

.spinner-ring.small {
    width: 28px;
    height: 28px;
}

.spinner-ring div {
    box-sizing: border-box;
    display: block;
    position: absolute;
    width: 100%;
    height: 100%;
    border: 3px solid transparent;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

.spinner-ring div:nth-child(1) { animation-delay: -0.45s; }
.spinner-ring div:nth-child(2) { animation-delay: -0.3s; }
.spinner-ring div:nth-child(3) { animation-delay: -0.15s; }

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.retry-btn {
    margin-top: 8px;
    padding: 8px 24px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text);
    font-size: 13px;
    cursor: pointer;
    font-family: inherit;
    transition: var(--transition);
}

.retry-btn:active {
    transform: scale(0.95);
}

.new-message-toast {
    position: sticky;
    top: 8px;
    z-index: 50;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    padding: 10px 20px;
    border-radius: 999px;
    box-shadow: 0 8px 25px var(--primary-glow);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: toastDrop 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: 12px;
    align-self: center;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
    position: relative;
    overflow: visible;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.toast-pulse {
    position: absolute;
    inset: -2px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    opacity: 0.3;
    animation: toastPulse 2s ease-in-out infinite;
    z-index: -1;
}

@keyframes toastDrop {
    from { opacity: 0; transform: translateY(-20px) scale(0.9); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastPulse {
    0%, 100% { transform: scale(1); opacity: 0.3; }
    50% { transform: scale(1.05); opacity: 0.1; }
}

.messages-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 4px 2px;
}

.day-group {
    margin-bottom: 32px;
    animation: fadeInUp 0.5s ease;
}

.day-group:last-child {
    margin-bottom: 0;
}

.day-group-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
    padding: 0 4px;
}

.day-group-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
    background: var(--bg-card);
    padding: 4px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.day-group-divider {
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, var(--border), transparent);
}

.message-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 16px 18px;
    position: relative;
    transition: var(--transition);
    animation: messageIn 0.4s ease;
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
}

.message-item:hover {
    border-color: var(--border-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.message-item.unread {
    border-color: rgba(124, 58, 237, 0.3);
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.08), rgba(59, 130, 246, 0.04));
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
}

.message-item.highlight {
    border-color: var(--primary);
    box-shadow: 0 0 20px var(--primary-glow);
    animation: highlightPulse 0.8s ease;
}

@keyframes messageIn {
    0% { opacity: 0; transform: translateY(10px) scale(0.98); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes highlightPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

@keyframes fadeInUp {
    0% { opacity: 0; transform: translateY(10px); }
    100% { opacity: 1; transform: translateY(0); }
}

.message-unread-dot {
    position: absolute;
    top: 14px;
    left: 14px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    box-shadow: 0 0 10px var(--primary-glow);
    animation: dotPulse 2s ease-in-out infinite;
}

@keyframes dotPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.7; }
}

.message-item-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.message-sender {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    transition: var(--transition);
}

.message-sender:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.message-sender:active {
    transform: scale(0.97);
}

.message-sender i {
    font-size: 6px;
    color: var(--primary);
}

.sender-hint {
    font-size: 10px;
    opacity: 0.4;
    margin-right: 4px;
}

.message-time {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.message-edited-tag {
    font-size: 10px;
    color: var(--text-muted);
    opacity: 0.6;
}

.message-category-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: var(--text);
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.2), rgba(59, 130, 246, 0.15));
    border: 1px solid rgba(124, 58, 237, 0.25);
    border-radius: 999px;
    padding: 3px 10px;
    margin-bottom: 12px;
    width: fit-content;
}

.message-body {
    color: var(--text);
    font-size: 14.5px;
    line-height: 1.8;
    word-break: break-word;
    white-space: pre-wrap;
    direction: rtl;
    text-align: right;
    user-select: text;
    -webkit-user-select: text;
}

.message-caption {
    margin-top: 12px;
    font-size: 13px;
    color: var(--text-secondary);
    direction: rtl;
    text-align: right;
    line-height: 1.6;
    user-select: text;
    -webkit-user-select: text;
}

.message-media {
    margin-top: 12px;
    border-radius: var(--radius-md);
    overflow: hidden;
}

.message-media img,
.message-media video {
    width: 100%;
    border-radius: var(--radius-md);
    display: block;
}

.message-media audio {
    width: 100%;
    margin-top: 4px;
}

.message-reactions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.reaction-btn {
    flex: 1;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 0;
    font-size: 18px;
    cursor: pointer;
    transition: var(--transition);
}

.reaction-btn:active {
    transform: scale(0.9);
}

.reaction-btn:hover {
    background: var(--bg-card);
    border-color: var(--border-hover);
}

.reaction-btn.picked {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.2), rgba(59, 130, 246, 0.15));
    border-color: var(--primary);
    box-shadow: 0 0 12px var(--primary-glow);
}

.reaction-btn:disabled {
    opacity: 0.4;
    pointer-events: none;
}

.message-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.message-action-btn {
    flex: 1 1 auto;
    min-width: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
}

.message-action-btn:active {
    transform: scale(0.95);
}

.message-action-btn:hover {
    background: var(--bg-card);
    border-color: var(--border-hover);
    color: var(--text);
}

.message-action-btn.active {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.15), rgba(56, 189, 248, 0.05));
    border-color: rgba(56, 189, 248, 0.4);
    color: #38bdf8;
}

.message-action-btn.danger:hover {
    background: rgba(220, 38, 38, 0.1);
    border-color: rgba(220, 38, 38, 0.3);
    color: #ef4444;
}

.message-action-btn.is-loading {
    opacity: 0.5;
    pointer-events: none;
}

.profile-data {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.profile-header {
    position: relative;
    margin-bottom: 30px;
}

.profile-cover {
    position: relative;
    height: 140px;
    border-radius: var(--radius-xl);
    overflow: hidden;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
}

.profile-cover-gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 40%, var(--bg) 100%);
}

.profile-avatar-wrap {
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    width: 90px;
    height: 90px;
}

.profile-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--bg);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    background: var(--bg-card);
}

.avatar-status {
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #22c55e;
    border: 3px solid var(--bg);
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
}

.avatar-status.online {
    animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
    0%, 100% { box-shadow: 0 0 8px rgba(34, 197, 94, 0.5); }
    50% { box-shadow: 0 0 16px rgba(34, 197, 94, 0.8); }
}

.profile-info-card {
    text-align: center;
    padding: 8px 0 4px;
}

.profile-name {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.profile-username {
    font-size: 13px;
    color: var(--text-muted);
}

.profile-stats-card {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 32px;
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
}

.profile-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.profile-stat-value {
    font-size: 24px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.profile-stat-label {
    font-size: 12px;
    color: var(--text-muted);
}

.stat-divider {
    width: 1px;
    height: 40px;
    background: var(--border);
}

.profile-details-card {
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    overflow: hidden;
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
}

.detail-row {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 16px;
    transition: var(--transition);
}

.detail-row:not(:last-child) {
    border-bottom: 1px solid var(--border);
}

.detail-row:hover {
    background: var(--bg-elevated);
}

.detail-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
    margin-top: 2px;
}

.detail-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.detail-label {
    font-size: 12px;
    color: var(--text-muted);
}

.detail-value {
    font-size: 14px;
    color: var(--text);
    word-break: break-word;
    line-height: 1.6;
}

.bio-row .detail-value {
    line-height: 1.7;
    color: var(--text-secondary);
}

.analytics-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 16px;
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
}

.card-header {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.card-header i {
    color: var(--primary);
}

.chart-section {
    margin-bottom: 20px;
}

.chart-section:last-of-type {
    margin-bottom: 0;
}

.chart-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.week-chart {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 8px;
    height: 100px;
    padding: 0 4px;
}

.week-bar-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    gap: 4px;
}

.week-bar-count {
    font-size: 10px;
    color: var(--text-secondary);
    font-weight: 600;
}

.week-bar-track {
    flex: 1;
    width: 100%;
    max-width: 24px;
    background: var(--bg-elevated);
    border-radius: 8px;
    display: flex;
    align-items: flex-end;
    overflow: hidden;
    position: relative;
}

.week-bar-fill {
    width: 100%;
    background: linear-gradient(180deg, var(--primary), var(--secondary));
    border-radius: 8px;
    transition: height 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.week-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 30%;
    background: linear-gradient(180deg, rgba(255,255,255,0.2), transparent);
    border-radius: 8px 8px 0 0;
}

.week-bar-label {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 4px;
}

.type-chart {
    width: 100%;
}

.type-bar-stack {
    display: flex;
    width: 100%;
    height: 12px;
    border-radius: 6px;
    overflow: hidden;
    background: var(--bg-elevated);
    margin-bottom: 10px;
}

.type-bar-seg {
    height: 100%;
    transition: width 0.6s ease;
    position: relative;
}

.type-bar-seg::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 40%;
    background: linear-gradient(180deg, rgba(255,255,255,0.15), transparent);
}

.type-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.type-legend-item {
    font-size: 11px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.type-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.ai-insight {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.1), rgba(59, 130, 246, 0.05));
    border: 1px solid rgba(124, 58, 237, 0.2);
    border-radius: var(--radius-md);
    padding: 14px;
    margin-top: 16px;
}

.ai-header {
    font-size: 12px;
    color: #a78bfa;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    font-weight: 600;
}

.ai-text {
    font-size: 13px;
    line-height: 1.9;
    color: var(--text-secondary);
    direction: rtl;
    text-align: right;
}

.link-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 16px;
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
}

.link-header {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.link-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.link-value {
    flex: 1;
    font-size: 13px;
    color: var(--text);
    direction: ltr;
    text-align: left;
    overflow-wrap: anywhere;
    font-family: 'SF Mono', monospace;
    background: var(--bg-elevated);
    padding: 10px 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.link-copy-btn {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    transition: var(--transition);
    box-shadow: 0 4px 15px var(--primary-glow);
}

.link-copy-btn:active {
    transform: scale(0.9);
}

.hint-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.7;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.hint-card i {
    color: var(--primary);
    font-size: 14px;
    margin-top: 2px;
    flex-shrink: 0;
}

.settings-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 16px;
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
}

.settings-item:last-child {
    margin-bottom: 0;
}

.settings-item:hover {
    border-color: var(--border-hover);
    background: var(--bg-elevated);
}

.settings-item:active {
    transform: scale(0.98);
}

.settings-item-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.settings-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.settings-icon.theme-icon {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.2), rgba(59, 130, 246, 0.15));
}

.settings-icon.wallpaper-icon {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.2), rgba(34, 211, 238, 0.15));
}

.settings-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.settings-title {
    font-size: 15px;
    color: var(--text);
    font-weight: 500;
}

.settings-desc {
    font-size: 12px;
    color: var(--text-muted);
}

.settings-arrow {
    color: var(--text-muted);
    font-size: 12px;
    transition: var(--transition);
}

.settings-item:hover .settings-arrow {
    color: var(--text);
    transform: translateX(-4px);
}

.sub-panel {
    animation: slideInRight 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideInRight {
    0% { transform: translateX(30px); opacity: 0; }
    100% { transform: translateX(0); opacity: 1; }
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.back-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 13px;
    padding: 8px 14px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: inherit;
    transition: var(--transition);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.back-btn:active {
    transform: scale(0.95);
}

.panel-title {
    color: var(--text);
    font-size: 16px;
    font-weight: 600;
    flex: 1;
    text-align: center;
    margin-left: 60px;
}

.theme-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.theme-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 12px 8px;
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    border: 2px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.theme-item:active {
    transform: scale(0.95);
}

.theme-item.active {
    border-color: var(--primary);
    box-shadow: 0 0 20px var(--primary-glow);
}

.theme-preview {
    width: 100%;
    aspect-ratio: 1;
    border-radius: var(--radius-md);
    position: relative;
    overflow: hidden;
}

.theme-preview::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 50%, rgba(0,0,0,0.3) 100%);
    border-radius: inherit;
}

.theme-item span {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.wallpaper-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.wallpaper-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 12px 8px;
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    border: 2px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.wallpaper-item:active {
    transform: scale(0.95);
}

.wallpaper-item.active {
    border-color: #fff;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
}

.wallpaper-preview {
    width: 100%;
    aspect-ratio: 1;
    border-radius: var(--radius-md);
    background-size: cover;
    background-position: center;
    position: relative;
}

.wallpaper-preview::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 50%, rgba(0,0,0,0.4) 100%);
    border-radius: inherit;
}

.wallpaper-item span {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 500;
}

.wallpaper-upload-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 12px 8px;
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    border: 2px dashed var(--border);
    cursor: pointer;
    transition: var(--transition);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    position: relative;
    overflow: hidden;
}

.wallpaper-upload-item:active {
    transform: scale(0.95);
}

.wallpaper-upload-item:hover {
    border-color: var(--primary);
    background: var(--bg-elevated);
}

.wallpaper-upload-item.active {
    border-color: var(--primary);
    border-style: solid;
    box-shadow: 0 0 20px var(--primary-glow);
}

.wallpaper-upload-preview {
    width: 100%;
    aspect-ratio: 1;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: var(--text-muted);
    background: var(--bg-elevated);
}

.wallpaper-upload-item input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.bottom-nav {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 48px);
    max-width: 380px;
    height: 72px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    background: rgba(10, 10, 15, 0.65);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border-radius: 36px;
    padding: 0 16px;
    border: 1px solid var(--border);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.03) inset;
    z-index: 100;
    transition: var(--transition);
}

.nav-item {
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    flex: 1;
    height: 100%;
}

.nav-icon-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: var(--transition);
    position: relative;
}

.nav-glow {
    position: absolute;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--primary);
    opacity: 0;
    filter: blur(20px);
    transition: var(--transition);
    z-index: -1;
}

.nav-glow.center-glow {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
}

.nav-item.expanded .nav-glow {
    opacity: 0.3;
    transform: scale(1.5);
}

.nav-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    transition: var(--transition);
    background: var(--bg-elevated);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-item.center-item .nav-icon {
    border-color: rgba(124, 58, 237, 0.4);
}

.nav-item.expanded .nav-icon,
.nav-item.expanded.center-item .nav-icon {
    width: 64px;
    height: 64px;
    border-color: var(--primary);
    box-shadow: 0 0 30px var(--primary-glow);
    transform: translateY(-8px);
}

.settings-icon {
    object-fit: contain;
    padding: 10px;
}

.nav-item.expanded .settings-icon {
    padding: 14px;
}

.nav-label {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 500;
    transition: var(--transition);
    opacity: 0;
    transform: translateY(4px);
    position: absolute;
    bottom: -14px;
    white-space: nowrap;
}

.nav-item.expanded .nav-label {
    opacity: 1;
    transform: translateY(0);
    color: var(--text-secondary);
}

.nav-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    background: linear-gradient(135deg, #ef4444, #f97316);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    border: 2px solid var(--bg);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
    animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@media (max-width: 480px) {
    .bottom-nav {
        height: 64px;
        padding: 0 12px;
        bottom: 12px;
        border-radius: 28px;
        max-width: 340px;
    }

    .nav-icon {
        width: 40px;
        height: 40px;
    }

    .nav-item.expanded .nav-icon {
        width: 54px;
        height: 54px;
        transform: translateY(-6px);
    }

    .settings-icon {
        padding: 8px;
    }

    .nav-item.expanded .settings-icon {
        padding: 10px;
    }

    .nav-label {
        font-size: 9px;
        bottom: -12px;
    }

    .theme-grid,
    .wallpaper-grid {
        gap: 8px;
    }

    .hero-section {
        padding: 40px 16px 30px;
    }

    .hero-logo {
        width: 104px;
        height: 104px;
    }

    .hero-section h1 {
        font-size: 26px;
    }

    .message-item {
        padding: 14px 16px;
    }

    .page-title {
        font-size: 16px;
    }

    .profile-cover {
        height: 120px;
    }

    .profile-avatar-wrap {
        width: 80px;
        height: 80px;
        bottom: -25px;
    }
}

[data-theme="red"] {
    --primary: #dc2626;
    --secondary: #ef4444;
    --primary-glow: rgba(220, 38, 38, 0.4);
    --secondary-glow: rgba(239, 68, 68, 0.3);
}

[data-theme="green"] {
    --primary: #059669;
    --secondary: #34d399;
    --primary-glow: rgba(5, 150, 105, 0.4);
    --secondary-glow: rgba(52, 211, 153, 0.3);
}

[data-theme="pink"] {
    --primary: #db2777;
    --secondary: #f472b6;
    --primary-glow: rgba(219, 39, 119, 0.4);
    --secondary-glow: rgba(244, 114, 182, 0.3);
}

[data-theme="orange"] {
    --primary: #ea580c;
    --secondary: #fb923c;
    --primary-glow: rgba(234, 88, 12, 0.4);
    --secondary-glow: rgba(251, 146, 60, 0.3);
}

[data-theme="cyan"] {
    --primary: #0891b2;
    --secondary: #22d3ee;
    --primary-glow: rgba(8, 145, 178, 0.4);
    --secondary-glow: rgba(34, 211, 238, 0.3);
}