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

:root {
    --primary-bg: #0a0a0a;
    --secondary-bg: #1a1a1a;
    --accent: #7c3aed;
    --accent-light: #8b5cf6;
    --accent-dark: #6d28d9;
    --accent-gradient: linear-gradient(135deg, #7c3aed, #6366f1, #8b5cf6);
    --accent-glow: 0 0 30px rgba(124, 58, 237, 0.4);
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --text-accent: #d8b4fe;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    --liquid-gradient: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.1) 0%,
        rgba(255, 255, 255, 0.05) 25%,
        rgba(255, 255, 255, 0.025) 50%,
        rgba(255, 255, 255, 0.05) 75%,
        rgba(255, 255, 255, 0.1) 100%
    );
    --nav-height: 70px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--primary-bg);
    color: var(--text-primary);
    line-height: 1.6;
    padding-bottom: var(--nav-height);
    overflow-x: hidden;
}

.app {
    min-height: 100vh;
    background: var(--primary-bg);
    position: relative;
}

/* Animated Background */
.animated-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        linear-gradient(45deg, 
            rgba(124, 58, 237, 0.1) 0%, 
            rgba(99, 102, 241, 0.08) 25%, 
            rgba(139, 92, 246, 0.1) 50%, 
            rgba(109, 40, 217, 0.08) 75%, 
            rgba(124, 58, 237, 0.1) 100%);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    z-index: -2;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Floating particles effect */
.animated-bg::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 80%, rgba(124, 58, 237, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(139, 92, 246, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(99, 102, 241, 0.08) 0%, transparent 50%);
    animation: float 20s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    33% { transform: translateY(-20px) rotate(120deg); }
    66% { transform: translateY(20px) rotate(240deg); }
}

/* Header */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 1.5rem 1rem 1rem 1rem;
    background: rgba(10, 10, 10, 0.7);
    backdrop-filter: blur(40px) saturate(180%);
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.header-content {
    display: flex;
    justify-content: center;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.logo {
    font-size: 1.8rem;
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: var(--accent-glow);
    text-align: center;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0.5rem;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 1rem);
    max-width: 400px;
    background: rgba(10, 10, 10, 0.7);
    backdrop-filter: blur(60px) saturate(200%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 0.6rem;
    z-index: 1000;
    box-shadow: 
        0 15px 30px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.nav-items {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.3rem;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0.3rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 16px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    min-height: 50px;
}

.nav-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    transition: left 0.6s;
}

.nav-item:hover::before {
    left: 100%;
}

.nav-item.active {
    color: var(--text-accent);
    background: rgba(124, 58, 237, 0.15);
    box-shadow: 
        inset 0 2px 8px rgba(124, 58, 237, 0.3),
        0 4px 16px rgba(124, 58, 237, 0.2);
}

.nav-item.active::after {
    content: '';
    position: absolute;
    bottom: 3px;
    width: 5px;
    height: 5px;
    background: var(--accent-gradient);
    border-radius: 50%;
    box-shadow: var(--accent-glow);
}

.nav-icon-bottom {
    font-size: 1.3rem;
    margin-bottom: 0.2rem;
    transition: all 0.4s ease;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.nav-item.active .nav-icon-bottom {
    transform: scale(1.15);
    filter: drop-shadow(0 0 8px rgba(124, 58, 237, 0.8));
}

.nav-label {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    transition: all 0.3s ease;
    text-align: center;
    line-height: 1.1;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-item.active .nav-label {
    color: var(--text-accent);
    font-weight: 700;
}

/* Main Content */
.main-content {
    padding: 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* Stats Grid - New Design */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    padding: 1.5rem;
    border-radius: 20px;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.gradient-main { 
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.15), rgba(99, 102, 241, 0.1));
    border: 1px solid rgba(124, 58, 237, 0.2);
    backdrop-filter: blur(20px);
}

.stat-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    filter: drop-shadow(0 6px 12px rgba(0,0,0,0.4));
    text-align: center;
}

.stat-group {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-row.total {
    border-bottom: none;
    border-top: 2px solid rgba(124, 58, 237, 0.3);
    padding-top: 0.8rem;
    margin-top: 0.2rem;
}

.stat-label-small {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.stat-value-small {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-accent);
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-row.total .stat-value-small {
    font-size: 1.1rem;
    font-weight: 800;
}

/* Chats List */
.chat-item {
    display: flex;
    align-items: center;
    padding: 1.2rem 1.5rem;
    margin-bottom: 0.8rem;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
}

.chat-item:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: translateX(8px);
    border-color: rgba(124, 58, 237, 0.3);
}

.chat-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
    margin-right: 1rem;
    font-size: 1.2rem;
    box-shadow: var(--accent-glow);
}

.chat-info {
    flex: 1;
}

.chat-name {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 0.2rem;
    color: var(--text-primary);
}

.chat-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    gap: 1rem;
}

.chat-arrow {
    font-size: 1.5rem;
    color: var(--text-accent);
    font-weight: bold;
    transition: all 0.3s ease;
}

.chat-item:hover .chat-arrow {
    transform: translateX(5px);
}

/* Chat Detail */
.back-btn {
    background: rgba(124, 58, 237, 0.2);
    border: 1px solid rgba(124, 58, 237, 0.3);
    color: var(--text-accent);
    padding: 0.5rem 1rem;
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.back-btn:hover {
    background: rgba(124, 58, 237, 0.3);
    transform: translateX(-3px);
}

.chat-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin: 1.5rem 0;
}

.chat-stat-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 1rem;
    text-align: center;
    backdrop-filter: blur(10px);
}

.chat-stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.3rem;
}

.chat-stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.chat-content {
    margin-top: 1.5rem;
}

.chat-message {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 1rem;
    margin-bottom: 0.8rem;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.chat-message:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(124, 58, 237, 0.2);
}

.message-text {
    font-size: 0.95rem;
    line-height: 1.4;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.message-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.message-type {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    background: rgba(124, 58, 237, 0.2);
    color: var(--text-accent);
    border-radius: 8px;
    font-size: 0.7rem;
    margin-left: 0.5rem;
}

/* Settings */
.settings-content {
    display: grid;
    gap: 1rem;
    padding: 0 0.5rem;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem 1.5rem;
    border-radius: 16px;
    transition: all 0.4s ease;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
}

.setting-item:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: translateX(5px);
}

.setting-info {
    flex: 1;
    margin-right: 1rem;
}

.setting-title {
    font-weight: 600;
    margin-bottom: 0.3rem;
    color: var(--text-primary);
}

.setting-description {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: .4s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: var(--text-secondary);
    transition: .4s;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

input:checked + .toggle-slider {
    background: var(--accent-gradient);
    border-color: rgba(124, 58, 237, 0.5);
}

input:checked + .toggle-slider:before {
    transform: translateX(24px);
    background: white;
    box-shadow: 0 2px 6px rgba(124, 58, 237, 0.4);
}

/* Content Sections */
.content-section {
    display: none;
    animation: fadeInUp 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    z-index: 2000;
    backdrop-filter: blur(30px);
}

.loading-overlay.active {
    display: flex;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 3px solid transparent;
    border-top: 3px solid var(--accent);
    border-radius: 50%;
    animation: spin 1.2s linear infinite;
    margin-bottom: 2rem;
    box-shadow: var(--accent-glow);
}

.loading-text {
    color: var(--text-primary);
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: 2px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Responsive */
@media (max-width: 768px) {
    .nav-label {
        font-size: 0.6rem;
    }
    
    .nav-icon-bottom {
        font-size: 1.2rem;
    }
    
    .chat-stats {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }
}

@media (max-width: 480px) {
    .nav-label {
        font-size: 0.55rem;
        letter-spacing: 0.2px;
    }
    
    .logo {
        font-size: 1.6rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .chat-item {
        padding: 1rem;
    }
}

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--primary-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--accent-gradient);
    border-radius: 4px;
}

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