/* CSS Variables */
:root {
    --brand-color: #34B7F1;
    --brand-dark: #2481cc;
    --primary-color: #34B7F1;
    --primary-dark: #2481cc;
    --secondary-color: #128C7E;
    --accent-color: #25D366;
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --success-color: #25D366;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --online-color: #25D366;
    --offline-color: #64748b;
    --away-color: #f59e0b;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-full: 9999px;
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 350ms ease;
}

/* Reset & Base Styles */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
    overscroll-behavior-x: none;
    touch-action: pan-y;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
}

/* Specific to Chat Page */
body.chat-page {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    touch-action: none;
}

/* Specific to Landing Page */
body.landing-page {
    background: radial-gradient(circle at 10% 20%, rgba(52, 183, 241, 0.15) 0%, transparent 40%),
                radial-gradient(circle at 90% 80%, rgba(99, 102, 241, 0.15) 0%, transparent 40%),
                var(--bg-primary);
    overflow-x: hidden;
    overflow-y: auto;
    touch-action: pan-y;
    position: relative;
}

/* =========================================
   Landing Page Styles
========================================= */

.landing-decor {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}

.decor-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(12px);
    opacity: 0.35;
    animation: drift 16s ease-in-out infinite;
}

.orb-1 {
    width: 260px;
    height: 260px;
    top: 8%;
    left: -60px;
    background: rgba(52, 183, 241, 0.28);
}

.orb-2 {
    width: 320px;
    height: 320px;
    top: 35%;
    right: -90px;
    background: rgba(37, 211, 102, 0.18);
    animation-delay: -5s;
}

.orb-3 {
    width: 220px;
    height: 220px;
    bottom: 8%;
    left: 50%;
    background: rgba(99, 102, 241, 0.24);
    animation-delay: -9s;
}

.decor-grid {
    position: absolute;
    inset: 0;
    background-image: linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
                      linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px);
    background-size: 40px 40px;
    mask-image: radial-gradient(circle at center, black 20%, transparent 80%);
    opacity: 0.3;
}

.navbar,
.hero,
.features,
.security-section,
.cta-section {
    position: relative;
    z-index: 1;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 5%;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(10px);
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: 800;
    color: white;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-links a {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--transition-fast);
}

.nav-links a:hover {
    color: var(--brand-color);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--text-secondary);
    color: var(--text-primary);
    padding: 0.5rem 1.25rem;
    border-radius: var(--radius-full);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-outline:hover {
    border-color: var(--brand-color);
    color: var(--brand-color);
}

.btn-brand {
    background: var(--brand-color);
    border: none;
    color: white;
    padding: 0.5rem 1.25rem;
    border-radius: var(--radius-full);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: 0 4px 14px rgba(52, 183, 241, 0.3);
}

.btn-brand:hover {
    background: var(--brand-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 183, 241, 0.4);
}

.btn-large {
    padding: 0.875rem 2rem;
    font-size: 1.1rem;
}

.btn-block {
    width: 100%;
    padding: 0.875rem;
}

.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6rem 5% 2rem;
    gap: 4rem;
}

.hero-content {
    flex: 1;
    max-width: 600px;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.9rem;
    margin-bottom: 1.25rem;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: var(--radius-full);
    background: rgba(255,255,255,0.05);
    color: var(--text-secondary);
    font-size: 0.9rem;
    animation: badgeGlow 3.5s ease-in-out infinite;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent-color);
    box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.45);
    animation: dotPulse 1.8s infinite;
}

.hero-content h1 {
    font-size: 4rem;
    line-height: 1.1;
    font-weight: 800;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, #fff, #a5b4fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-content p {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 2.5rem;
}

.hero-actions {
    display: flex;
    gap: 1rem;
}

.hero-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 2rem;
}

.stat-card {
    padding: 1rem;
    border-radius: 20px;
    background: rgba(30, 41, 59, 0.65);
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.16);
    animation: slideInUp 0.7s ease both;
}

.stat-card strong {
    display: block;
    font-size: 1.1rem;
    margin-bottom: 0.35rem;
}

.stat-card span {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.hero-visual {
    flex: 1;
    display: flex;
    justify-content: center;
    perspective: 1000px;
}

.mockup-window {
    width: 100%;
    max-width: 400px;
    height: 500px;
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255,255,255,0.1);
    transform: rotateY(-15deg) rotateX(5deg);
    transition: transform 0.5s ease;
    display: flex;
    flex-direction: column;
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0% { transform: rotateY(-15deg) rotateX(5deg) translateY(0px); }
    50% { transform: rotateY(-15deg) rotateX(5deg) translateY(-20px); }
    100% { transform: rotateY(-15deg) rotateX(5deg) translateY(0px); }
}

.mockup-window:hover {
    transform: rotateY(0deg) rotateX(0deg) translateY(0px);
    animation: none;
}

.mockup-header {
    background: var(--bg-secondary);
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border-bottom: 1px solid var(--bg-tertiary);
}

.mockup-avatar {
    width: 40px;
    height: 40px;
    background: var(--bg-tertiary);
    border-radius: 50%;
}

.mockup-info {
    flex: 1;
}

.mockup-name {
    height: 12px;
    width: 100px;
    background: var(--text-primary);
    border-radius: 4px;
    margin-bottom: 6px;
}

.mockup-status {
    height: 8px;
    width: 60px;
    background: var(--brand-color);
    border-radius: 4px;
}

.mockup-body {
    flex: 1;
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: var(--bg-primary);
}

.mockup-typing {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    align-self: flex-start;
    padding: 0.75rem 0.9rem;
    border-radius: 1rem;
    background: rgba(255,255,255,0.06);
}

.mockup-typing span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--brand-color);
    animation: typingBounce 1.2s infinite ease-in-out;
}

.mockup-typing span:nth-child(2) {
    animation-delay: 0.15s;
}

.mockup-typing span:nth-child(3) {
    animation-delay: 0.3s;
}

.mockup-msg {
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    font-size: 0.9rem;
    max-width: 85%;
    line-height: 1.4;
}

.mockup-msg.received {
    align-self: flex-start;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

.mockup-msg.sent {
    align-self: flex-end;
    background: var(--brand-color);
    color: white;
    border-bottom-right-radius: 4px;
}

.mockup-footer {
    padding: 1rem;
    background: var(--bg-secondary);
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.mockup-input {
    flex: 1;
    height: 36px;
    background: var(--bg-tertiary);
    border-radius: 20px;
}

.mockup-send {
    width: 36px;
    height: 36px;
    background: var(--brand-color);
    border-radius: 50%;
}

.features {
    padding: 6rem 5%;
    background: var(--bg-secondary);
}

.section-header {
    text-align: center;
    margin-bottom: 4rem;
}

.section-header h2 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.section-header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.feature-card {
    background: var(--bg-primary);
    padding: 2rem;
    border-radius: var(--radius-xl);
    border: 1px solid rgba(255,255,255,0.05);
    transition: transform var(--transition-fast);
}

.feature-card:hover {
    transform: translateY(-10px);
}

.security-section,
.cta-section {
    padding: 6rem 5%;
}

.security-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
}

.security-card {
    padding: 2rem;
    border-radius: 24px;
    background: rgba(30, 41, 59, 0.72);
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.2);
    transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.security-card:hover {
    transform: translateY(-8px);
    border-color: rgba(52, 183, 241, 0.35);
}

.security-card i {
    font-size: 1.8rem;
    color: var(--brand-color);
    margin-bottom: 1rem;
}

.security-card h3 {
    margin-bottom: 0.75rem;
    font-size: 1.2rem;
}

.security-card p {
    color: var(--text-secondary);
}

.cta-card {
    max-width: 900px;
    margin: 0 auto;
    padding: 3rem;
    text-align: center;
    border-radius: 28px;
    background: linear-gradient(135deg, rgba(52, 183, 241, 0.12), rgba(18, 140, 126, 0.12));
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.24);
}

.cta-card h2 {
    font-size: 2.2rem;
    margin-bottom: 1rem;
}

.cta-card p {
    color: var(--text-secondary);
    font-size: 1.05rem;
    margin-bottom: 1.75rem;
}

.feature-icon {
    width: 50px;
    height: 50px;
    background: rgba(52, 183, 241, 0.1);
    color: var(--brand-color);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
}

.feature-card h3 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.feature-card p {
    color: var(--text-secondary);
}

/* =========================================
   Auth Modal Styles
========================================= */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(5px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    overflow: hidden;
}

.auth-container {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    width: 100%;
    max-width: 420px;
    padding: 3rem 2.5rem;
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    animation: scaleIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    max-height: calc(100dvh - 2rem);
    overflow-y: auto;
    margin: auto;
    overscroll-behavior: contain;
}

.close-modal {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
}

.close-modal:hover {
    color: white;
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-header h2 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.auth-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.social-logins {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.btn-social {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem;
    border-radius: var(--radius-md);
    border: none;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: opacity var(--transition-fast);
}

.btn-social:hover {
    opacity: 0.9;
}

.btn-social.google {
    background: white;
    color: #333;
}

.btn-social.telegram {
    background: #2481cc;
    color: white;
}

.divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 1.5rem 0;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.divider::before, .divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--bg-tertiary);
}

.divider span {
    padding: 0 10px;
}

.input-group {
    margin-bottom: 1.25rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.input-group input {
    width: 100%;
    padding: 0.875rem 1rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.2s ease;
}

.input-group input:focus {
    outline: none;
    border-color: var(--brand-color);
    background: rgba(15, 23, 42, 0.9);
    box-shadow: 0 0 0 4px rgba(52, 183, 241, 0.1);
}

.username-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.username-wrapper .at-symbol {
    position: absolute;
    left: 1rem;
    color: var(--text-muted);
}

.username-wrapper input {
    padding-left: 2.25rem;
}

.auth-error {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 8px;
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
    padding: 0.75rem;
    text-align: center;
    display: none;
}

.auth-error:not(:empty) {
    display: block;
    animation: fadeIn 0.2s ease;
}

.auth-footer {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

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

.auth-footer a:hover {
    text-decoration: underline;
}

/* =========================================
   Chat App Styles (Nexus Web)
========================================= */

/* Scrollbar Styles */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
}

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

/* App Container */
.app-container {
    display: flex;
    position: fixed;
    top: var(--app-offset, 0px);
    left: 0;
    height: var(--app-height, 100%);
    width: 100%;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 360px;
    min-width: 360px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--bg-tertiary);
    display: flex;
    flex-direction: column;
    transition: transform var(--transition-normal);
    z-index: 100;
    touch-action: pan-y;
}

.sidebar-header {
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--bg-tertiary);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo i {
    font-size: 1.75rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-action-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.header-action-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* User Profile */
.user-profile {
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.875rem;
    border-bottom: 1px solid var(--bg-tertiary);
}

.avatar {
    position: relative;
    width: 48px;
    height: 48px;
}

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

.avatar .status {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    border-radius: var(--radius-full);
    border: 2px solid var(--bg-secondary);
}

.status.online {
    background: var(--online-color);
}

.status.offline {
    background: var(--offline-color);
}

.status.away {
    background: var(--away-color);
}

.user-info h3 {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
}

.user-info .status-text {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

/* Search Box */
.search-box {
    padding: 0.875rem 1.25rem;
    position: relative;
}

.search-box i {
    position: absolute;
    left: 2rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.9375rem;
}

.search-box input {
    width: 100%;
    padding: 0.625rem 0.875rem 0.625rem 2.25rem;
    background: var(--bg-tertiary);
    border: 1px solid transparent;
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: all var(--transition-fast);
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: var(--bg-secondary);
}

.search-results-dropdown {
    position: absolute;
    top: 100%;
    left: 1.25rem;
    right: 1.25rem;
    background: var(--bg-primary);
    border: 1px solid var(--bg-tertiary);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 50;
    max-height: 250px;
    overflow-y: auto;
    margin-top: 0.5rem;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background var(--transition-fast);
}

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

.search-result-item img {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
}

.search-result-info h4 {
    font-size: 0.9rem;
    color: var(--text-primary);
}

.search-result-info p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Chat List */
.chat-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
}

.chat-item {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.875rem 1.25rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    border-left: 3px solid transparent;
}

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

.chat-item.active {
    background: var(--bg-tertiary);
    border-left-color: var(--primary-color);
}

.chat-item .avatar {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
}

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

.chat-header-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}

.chat-name {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

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

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

.unread-badge {
    background: var(--primary-color);
    color: white;
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 0.125rem 0.375rem;
    border-radius: var(--radius-full);
    flex-shrink: 0;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    position: relative;
    overflow: hidden;
    height: 100%;
    min-width: 0;
}

/* Welcome Screen */
.welcome-screen {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.welcome-content {
    text-align: center;
    max-width: 420px;
}

.welcome-content > i {
    font-size: 6rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1.5rem;
    display: inline-block;
}

.welcome-content h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.welcome-content p {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    line-height: 1.6;
}

/* Buttons */
.btn-primary, .btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-lg);
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

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

/* Chat Container */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    min-width: 0;
    min-height: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* Chat Header */
.chat-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1.25rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--bg-tertiary);
    flex-shrink: 0;
    z-index: 10;
}

.back-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

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

.chat-user-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.875rem;
    min-width: 0;
    cursor: pointer;
}

.chat-user-info .avatar {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
}

.user-details {
    min-width: 0;
}

.user-details h3 {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-details .status-text {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.chat-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.action-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: none;
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    font-size: 1rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.action-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

/* Messages Container */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
}

/* Message Bubbles */
.message {
    display: flex;
    gap: 0.75rem;
    max-width: 75%;
    animation: messageSlide 0.3s ease;
}

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

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

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

.message .avatar {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    align-self: flex-end;
}

.message-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.message-bubble {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-lg);
    word-wrap: break-word;
    position: relative;
}

.message.sent .message-bubble {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-bottom-right-radius: var(--radius-sm);
}

.message.received .message-bubble {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-bottom-left-radius: var(--radius-sm);
}

.message-text {
    font-size: 0.9375rem;
    line-height: 1.5;
}

.message-time {
    font-size: 0.6875rem;
    opacity: 0.7;
    margin-top: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.message.sent .message-time {
    color: rgba(255, 255, 255, 0.8);
    justify-content: flex-end;
}

.message.received .message-time {
    color: var(--text-muted);
}

.read-status {
    font-size: 0.75rem;
    display: flex;
    align-items: center;
}

.read-status .fa-check,
.read-status .fa-check-double {
    font-size: 0.7rem;
}

.read-status.read .fa-check-double {
    color: #34B7F1; /* WhatsApp/Telegram Blue Tick */
}

.message.sent .read-status {
    color: rgba(255, 255, 255, 0.9);
}

/* Media Messages */
.message-media {
    max-width: 280px;
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
}

.message-media img {
    width: 100%;
    height: auto;
    display: block;
}

.message-media video {
    width: 100%;
    max-height: 200px;
}

.message-media audio {
    width: 100%;
    height: 40px;
}

.message-file {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    min-width: 200px;
}

.message.received .message-file {
    background: var(--bg-secondary);
}

.file-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-color);
    border-radius: var(--radius-md);
    font-size: 1.25rem;
    color: white;
}

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

.file-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: inherit;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-size {
    font-size: 0.75rem;
    opacity: 0.7;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1.25rem;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.typing-indicator .dots {
    display: flex;
    gap: 0.25rem;
}

.typing-indicator .dots span {
    width: 6px;
    height: 6px;
    background: var(--primary-color);
    border-radius: var(--radius-full);
    animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-indicator .dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-indicator .dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typingBounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

/* Chat Input Area */
.chat-input-area {
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    border-top: 1px solid var(--bg-tertiary);
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    flex-shrink: 0;
}

.input-actions {
    display: none;
}

.input-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.input-btn:hover {
    color: var(--primary-color);
}

.message-input-wrapper {
    flex: 1;
    display: flex;
    align-items: flex-end;
    gap: 0.25rem;
    background: var(--bg-tertiary);
    border-radius: 24px;
    padding: 0.4rem 0.75rem;
    min-width: 0;
}

.message-input-wrapper textarea {
    flex: 1;
    width: 100%;
    min-width: 0;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    resize: none;
    outline: none;
    max-height: 120px;
    min-height: 24px;
    line-height: 1.5;
    padding: 0.5rem 0.25rem;
}

.message-input-wrapper textarea::placeholder {
    color: var(--text-muted);
}

.send-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border: none;
    border-radius: var(--radius-full);
    color: white;
    font-size: 1rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Emoji Picker */
.emoji-picker {
    position: absolute;
    bottom: 100%;
    left: 1.25rem;
    right: 1.25rem;
    background: var(--bg-secondary);
    border: 1px solid var(--bg-tertiary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    z-index: 50;
    max-height: 300px;
    display: flex;
    flex-direction: column;
}

.emoji-tabs {
    display: flex;
    gap: 0.25rem;
    padding: 0.5rem;
    border-bottom: 1px solid var(--bg-tertiary);
    overflow-x: auto;
}

.emoji-tab {
    background: none;
    border: none;
    padding: 0.5rem;
    font-size: 1.25rem;
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.emoji-tab:hover {
    background: var(--bg-tertiary);
}

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

.emoji-content {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 0.375rem;
}

.emoji-item {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.375rem;
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    background: none;
    border: none;
}

.emoji-item:hover {
    background: var(--bg-tertiary);
    transform: scale(1.1);
}

/* Call Overlay */
.call-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.95);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.call-container {
    width: 100%;
    max-width: 480px;
    text-align: center;
    padding: 2rem;
}

.call-background {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, var(--primary-color) 0%, transparent 70%);
    opacity: 0.3;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.3; }
    50% { transform: scale(1.1); opacity: 0.5; }
}

.call-content {
    position: relative;
    z-index: 1;
}

.call-avatar {
    width: 140px;
    height: 140px;
    margin: 0 auto 1.5rem;
    border-radius: var(--radius-full);
    overflow: hidden;
    border: 4px solid var(--primary-color);
    box-shadow: 0 0 40px rgba(99, 102, 241, 0.5);
}

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

.call-content h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.call-content p {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.call-timer {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary-color);
    font-variant-numeric: tabular-nums;
}

.call-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 2.5rem;
}

.call-btn {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-full);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.call-btn.mute, .call-btn.speaker {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.call-btn.mute:hover, .call-btn.speaker:hover {
    background: var(--text-muted);
}

.call-btn.end-call {
    background: var(--error-color);
    color: white;
}

.call-btn.end-call:hover {
    background: #dc2626;
    transform: scale(1.1);
}

/* Date Separator */
.date-separator {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 1.5rem 0;
}

.date-separator::before,
.date-separator::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--bg-tertiary);
}

.date-separator span {
    padding: 0 1rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.8);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

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

.modal-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

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

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--bg-tertiary);
}

/* File Drop Zone */
.file-drop-zone {
    border: 2px dashed var(--bg-tertiary);
    border-radius: var(--radius-lg);
    padding: 2rem;
    text-align: center;
    transition: all var(--transition-fast);
}

.file-drop-zone.drag-over {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.1);
}

.file-drop-zone i {
    font-size: 3rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.file-drop-zone p {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.file-drop-zone span {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.file-drop-zone input[type="file"] {
    display: none;
}

.file-preview-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
}

.file-preview-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
}

.file-preview-item img {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: var(--radius-md);
}

.file-preview-item .file-info {
    flex: 1;
    min-width: 0;
}

.file-preview-item .remove-file {
    background: none;
    border: none;
    color: var(--error-color);
    font-size: 1.125rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.file-preview-item .remove-file:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .sidebar {
        width: 320px;
        min-width: 320px;
    }
}

@media (max-width: 768px) {
    html, body {
        touch-action: pan-y;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
        width: 100%;
        min-width: 100%;
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .back-btn {
        display: flex;
    }
    
    .main-content {
        width: 100%;
    }
    
    .chat-header {
        padding: 0.75rem 1rem;
    }
    
    .chat-user-info .avatar {
        width: 40px;
        height: 40px;
    }
    
    .action-btn {
        width: 36px;
        height: 36px;
        font-size: 0.875rem;
    }
    
    .messages-container {
        padding: 1rem;
        padding-bottom: 2rem;
    }
    
    .message {
        max-width: 85%;
    }
    
    .chat-input-area {
        padding: 0.5rem;
        background: var(--bg-secondary);
    }
    
    .input-btn {
        width: 32px;
        height: 32px;
        font-size: 1.25rem;
    }
    
    .send-btn {
        width: 40px;
        height: 40px;
    }
    
    .emoji-picker {
        left: 0;
        right: 0;
        bottom: 100%;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        border-left: none;
        border-right: none;
        max-height: 250px;
    }
    
    .emoji-content {
        grid-template-columns: repeat(6, 1fr);
    }
    
    .auth-container {
        padding: 1.5rem;
    }

    .modal-overlay {
        align-items: flex-start;
        padding: 0.75rem;
    }

    .auth-container {
        width: min(100%, 420px);
        max-height: calc(100dvh - 1.5rem);
        padding: 1.25rem 1rem 1rem;
        border-radius: 20px;
    }

    .auth-footer {
        position: sticky;
        bottom: -1rem;
        margin: 1rem -1rem 0;
        padding: 1rem;
        background: rgba(30, 41, 59, 0.96);
        border-top: 1px solid rgba(255, 255, 255, 0.08);
    }
    
    .hero {
        flex-direction: column;
        padding-top: 6rem;
        text-align: center;
        gap: 2rem;
        min-height: auto;
    }
    
    .hero-content h1 {
        font-size: 2.5rem;
    }
    
    .hero-actions {
        justify-content: center;
        flex-direction: column;
    }

    .hero-stats {
        grid-template-columns: 1fr;
    }

    .cta-card {
        padding: 2rem 1.25rem;
    }
    
    .nav-links a {
        display: none;
    }
    .nav-links {
        display: none; /* simple mobile nav */
    }
    
    .mockup-window {
        max-width: 320px;
        height: 400px;
    }
}

@media (max-width: 480px) {
    .auth-container {
        max-height: calc(100dvh - 1rem);
        padding: 1rem 0.875rem 0.875rem;
    }

    .auth-footer {
        bottom: -0.875rem;
        margin-left: -0.875rem;
        margin-right: -0.875rem;
        padding: 0.875rem;
    }

    .chat-actions .action-btn:nth-child(3) {
        display: none;
    }
    
    .message {
        max-width: 90%;
    }
    
    .message .avatar {
        width: 28px;
        height: 28px;
    }
    
    .call-avatar {
        width: 100px;
        height: 100px;
    }
    
    .call-btn {
        width: 50px;
        height: 50px;
        font-size: 1.25rem;
    }
}



/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

@keyframes drift {
    0%, 100% {
        transform: translate3d(0, 0, 0) scale(1);
    }
    50% {
        transform: translate3d(20px, -24px, 0) scale(1.08);
    }
}

@keyframes badgeGlow {
    0%, 100% {
        box-shadow: 0 0 0 rgba(52, 183, 241, 0);
    }
    50% {
        box-shadow: 0 0 24px rgba(52, 183, 241, 0.18);
    }
}

@keyframes dotPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(37, 211, 102, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(37, 211, 102, 0);
    }
}

/* Modal Animations */
.modal {
    animation: fadeIn 0.2s ease;
}

.modal-content {
    animation: scaleIn 0.3s ease;
}

/* Hover Effects */
.chat-item,
.action-btn,
.input-btn,
.emoji-item,
.call-btn {
    will-change: transform;
}

/* Focus Styles */
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Selection */
::selection {
    background: var(--primary-color);
    color: white;
}

/* Image Preview in Chat */
.message-media {
    position: relative;
}

.message-media::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 50%, rgba(0,0,0,0.5));
    border-radius: var(--radius-md);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.message-media:hover::after {
    opacity: 1;
}

/* Loading Animation */
.loading-dots {
    display: flex;
    gap: 0.25rem;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    background: var(--primary-color);
    border-radius: var(--radius-full);
    animation: loadingBounce 1.4s infinite ease-in-out both;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes loadingBounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Notification Badge */
.notification-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--accent-color);
    color: white;
    font-size: 0.6875rem;
    font-weight: 700;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Ripple Effect */
.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 70%);
    transform: scale(0);
    opacity: 0;
    transition: transform 0.5s, opacity 0.5s;
}

.ripple:active::after {
    transform: scale(2);
    opacity: 1;
    transition: 0s;
}

/* Voice Message */
.voice-message {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 200px;
}

.voice-play-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: rgba(255,255,255,0.2);
    border: none;
    color: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
}

.voice-waveform {
    flex: 1;
    height: 30px;
    display: flex;
    align-items: center;
    gap: 2px;
}

.waveform-bar {
    flex: 1;
    background: currentColor;
    opacity: 0.5;
    border-radius: 1px;
    animation: waveform 1s ease-in-out infinite;
}

.waveform-bar:nth-child(odd) {
    animation-delay: 0.1s;
}

@keyframes waveform {
    0%, 100% { height: 30%; }
    50% { height: 100%; }
}

.voice-duration {
    font-size: 0.75rem;
    opacity: 0.7;
    font-variant-numeric: tabular-nums;
}

/* Sticker/GIF picker */
.sticker-picker {
    position: absolute;
    bottom: 100%;
    left: 1.25rem;
    right: 1.25rem;
    background: var(--bg-secondary);
    border: 1px solid var(--bg-tertiary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    z-index: 50;
    max-height: 320px;
    display: flex;
    flex-direction: column;
}

.sticker-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    padding: 0.75rem;
    overflow-y: auto;
}

.sticker-item {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    background: var(--bg-tertiary);
    border: none;
}

.sticker-item:hover {
    transform: scale(1.05);
    background: var(--primary-color);
}

/* Poll Message */
.poll-message {
    min-width: 250px;
}

.poll-question {
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.poll-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.poll-option {
    position: relative;
    padding: 0.625rem 0.875rem;
    background: rgba(255,255,255,0.1);
    border-radius: var(--radius-md);
    cursor: pointer;
    overflow: hidden;
    transition: all var(--transition-fast);
}

.poll-option:hover {
    background: rgba(255,255,255,0.2);
}

.poll-option.selected {
    background: var(--primary-color);
}

.poll-progress {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    background: rgba(99, 102, 241, 0.3);
    transition: width var(--transition-normal);
}

.poll-option-text {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: space-between;
}

.poll-votes {
    font-size: 0.75rem;
    opacity: 0.8;
}

.poll-total {
    margin-top: 0.75rem;
    font-size: 0.75rem;
    opacity: 0.7;
    text-align: center;
}

/* Location Message */
.location-message {
    min-width: 200px;
}

.location-map {
    width: 100%;
    height: 150px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: var(--primary-color);
}

.location-address {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Contact Message */
.contact-message {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 220px;
}

.contact-avatar {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    flex-shrink: 0;
}

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

.contact-name {
    font-weight: 600;
    margin-bottom: 0.125rem;
}

.contact-phone {
    font-size: 0.8125rem;
    opacity: 0.7;
}

.contact-actions {
    display: flex;
    gap: 0.25rem;
}

.contact-btn {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: rgba(255,255,255,0.1);
    border: none;
    color: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    transition: all var(--transition-fast);
}

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

/* System Message */
.system-message {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 1rem 0;
}

.system-message-content {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 0.8125rem;
    padding: 0.375rem 0.875rem;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Reply Preview */
.reply-preview {
    background: var(--bg-tertiary);
    padding: 0.75rem 1rem;
    margin: -0.5rem -0.5rem 0.5rem -0.5rem;
    border-left: 3px solid var(--primary-color);
    border-radius: var(--radius-md);
}

.reply-preview-header {
    font-size: 0.75rem;
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.reply-preview-text {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Forwarded Message */
.forwarded-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Edited Label */
.edited-label {
    font-size: 0.6875rem;
    opacity: 0.6;
    margin-left: 0.25rem;
}

/* Context Menu */
.context-menu {
    position: fixed;
    background: var(--bg-secondary);
    border: 1px solid var(--bg-tertiary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    z-index: 1000;
    min-width: 180px;
    padding: 0.5rem 0;
    animation: scaleIn 0.15s ease;
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 0.875rem;
}

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

.context-menu-item i {
    font-size: 1rem;
    color: var(--text-muted);
    width: 20px;
    text-align: center;
}

.context-menu-item:hover i {
    color: var(--primary-color);
}

.context-menu-item.danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

.context-menu-item.danger:hover i {
    color: var(--error-color);
}

.context-menu-divider {
    height: 1px;
    background: var(--bg-tertiary);
    margin: 0.5rem 0;
}

/* Reaction Bar */
.reaction-bar {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.25rem;
    flex-wrap: wrap;
}

.reaction {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.125rem 0.5rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.reaction:hover {
    background: var(--primary-color);
}

.reaction.add {
    padding: 0.125rem 0.375rem;
    font-size: 0.75rem;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.message:hover .reaction.add {
    opacity: 1;
}

/* Search Highlight */
.search-highlight {
    background: rgba(99, 102, 241, 0.3);
    border-radius: 2px;
    padding: 0 2px;
}

/* Typing in Chat List */
.chat-item.typing .chat-message {
    color: var(--primary-color);
    font-style: italic;
}

/* Pinned Chat */
.chat-item.pinned {
    background: rgba(99, 102, 241, 0.05);
}

.chat-item.pinned::before {
    content: '\f08d';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    font-size: 0.625rem;
    color: var(--primary-color);
    transform: rotate(45deg);
}

/* Archived Chat */
.chat-item.archived {
    opacity: 0.6;
}

/* Online Status Pulse */
.status.online::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: var(--radius-full);
    border: 2px solid var(--online-color);
    animation: statusPulse 2s ease-out infinite;
}

@keyframes statusPulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

/* New Message Indicator */
.new-message-indicator {
    position: absolute;
    bottom: 80px;
    right: 1.25rem;
    background: var(--primary-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
    z-index: 10;
}

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

/* Empty State */
.empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
}

.empty-state i {
    font-size: 4rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.empty-state h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.empty-state p {
    font-size: 0.9375rem;
    color: var(--text-secondary);
}

/* Loading State */
.loading-state {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--bg-tertiary);
    border-top-color: var(--primary-color);
    border-radius: var(--radius-full);
    animation: spin 1s linear infinite;
}

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

/* Error State */
.error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
}

.error-state i {
    font-size: 3rem;
    color: var(--error-color);
    margin-bottom: 1rem;
}

.error-state h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.error-state p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-tertiary) 25%,
        var(--bg-secondary) 50%,
        var(--bg-tertiary) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--radius-md);
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.skeleton-avatar {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
}

.skeleton-text {
    height: 12px;
    margin-bottom: 8px;
}

.skeleton-text:last-child {
    width: 60%;
}

/* Tooltip */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    padding: 0.375rem 0.75rem;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-fast);
    z-index: 1000;
}

[data-tooltip]:hover::before {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Print Styles */
@media print {
    .sidebar,
    .chat-input-area,
    .chat-actions,
    .call-overlay,
    .modal {
        display: none !important;
    }
    
    .main-content {
        width: 100% !important;
    }
    
    .messages-container {
        overflow: visible !important;
    }
}
