/**
 * PiChat - Modern Messaging App Styles
 * Clean, responsive, and accessible design
 */

/* CSS Variables */
:root {
    /* Colors - Light Theme */
    --primary: #128C7E;
    --primary-dark: #075E54;
    --primary-light: #25D366;
    --secondary: #34B7F1;
    --accent: #00A884;
    
    --bg-primary: #ffffff;
    --bg-secondary: #f0f2f5;
    --bg-tertiary: #e9edef;
    --bg-chat: #efeae2;
    --bg-message-out: #d9fdd3;
    --bg-message-in: #ffffff;
    
    --text-primary: #111b21;
    --text-secondary: #667781;
    --text-tertiary: #8696a0;
    --text-inverse: #ffffff;
    
    --border-color: #e9edef;
    --border-light: #f0f2f5;
    
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    
    --transition: all 0.2s ease;
    --transition-slow: all 0.3s ease;
    
    --sidebar-width: 400px;
    --header-height: 60px;
    --input-height: 52px;
    
    /* Online status */
    --online-color: #31a24c;
    --offline-color: #8696a0;
}

/* Dark Theme */
[data-theme="dark"] {
    --bg-primary: #111b21;
    --bg-secondary: #1f2c33;
    --bg-tertiary: #2a3942;
    --bg-chat: #0b141a;
    --bg-message-out: #005c4b;
    --bg-message-in: #1f2c33;
    
    --text-primary: #e9edef;
    --text-secondary: #8696a0;
    --text-tertiary: #667781;
    
    --border-color: #2a3942;
    --border-light: #233138;
}

/* Reset & Base */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.5;
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

img {
    max-width: 100%;
    height: auto;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
    font-size: inherit;
}

input, textarea, select {
    font-family: inherit;
    font-size: inherit;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.mobile-only {
    display: none;
}

/* Scrollbar Styles */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--text-tertiary);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Splash Screen */
.splash-screen {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease;
}

.splash-content {
    text-align: center;
    color: white;
}

.splash-logo {
    width: 120px;
    height: 120px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    animation: pulse 2s infinite;
}

.splash-logo i {
    font-size: 60px;
}

.splash-content h1 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
}

.splash-content p {
    font-size: 16px;
    opacity: 0.8;
}

.splash-loader {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: white;
    border-radius: 50%;
    margin: 24px auto 0;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Auth Container */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
}

.auth-form {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.auth-logo i {
    font-size: 40px;
    color: white;
}

.auth-header h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
}

.auth-header p {
    color: var(--text-secondary);
}

/* Form Elements */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--bg-secondary);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.input-wrapper:focus-within {
    border-color: var(--primary);
    background: var(--bg-primary);
}

.input-wrapper i {
    position: absolute;
    left: 14px;
    color: var(--text-tertiary);
    font-size: 18px;
}

.input-wrapper input {
    flex: 1;
    height: var(--input-height);
    padding: 0 44px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    outline: none;
}

.input-wrapper input::placeholder {
    color: var(--text-tertiary);
}

.toggle-password {
    position: absolute;
    right: 8px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.toggle-password:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.input-hint {
    display: block;
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 6px;
}

.forgot-password {
    display: inline-block;
    font-size: 13px;
    color: var(--primary);
    margin-bottom: 20px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 48px;
    padding: 0 24px;
    font-weight: 600;
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(18, 140, 126, 0.4);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--bg-tertiary);
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    height: 36px;
    padding: 0 16px;
    font-size: 13px;
}

.icon-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    border-radius: var(--radius-full);
    transition: var(--transition);
}

.icon-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.icon-btn i {
    font-size: 20px;
}

/* Auth Footer */
.auth-footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 14px;
}

/* Main App Container */
.app-container {
    display: flex;
    height: 100vh;
    height: 100dvh;
    background: var(--bg-primary);
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    height: 100%;
    background: var(--bg-primary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    height: var(--header-height);
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-secondary);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--primary);
}

.logo i {
    font-size: 28px;
}

.logo span {
    font-size: 20px;
    font-weight: 700;
}

.header-actions {
    display: flex;
    gap: 4px;
}

/* Search Bar */
.search-bar {
    padding: 8px 16px;
    background: var(--bg-secondary);
    position: relative;
}

.search-bar i {
    position: absolute;
    left: 28px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
    font-size: 18px;
}

.search-bar input {
    width: 100%;
    height: 40px;
    padding: 0 16px 0 44px;
    background: var(--bg-primary);
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    outline: none;
}

.search-bar input::placeholder {
    color: var(--text-tertiary);
}

/* Navigation Tabs */
.nav-tabs {
    display: flex;
    padding: 8px;
    gap: 4px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.nav-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 40px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    transition: var(--transition);
    position: relative;
}

.nav-tab:hover {
    background: var(--bg-tertiary);
}

.nav-tab.active {
    background: var(--primary);
    color: white;
}

.nav-tab i {
    font-size: 18px;
}

.badge {
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    font-size: 11px;
    font-weight: 600;
    background: #dc3545;
    color: white;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-tab.active .badge {
    background: white;
    color: var(--primary);
}

/* Tab Content */
.tab-content {
    flex: 1;
    overflow-y: auto;
    display: none;
}

.tab-content.active {
    display: block;
}

/* Conversations List */
.conversations-list {
    padding: 8px;
}

.conversation-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
}

.conversation-item:hover {
    background: var(--bg-secondary);
}

.conversation-item.active {
    background: var(--bg-tertiary);
}

.conversation-avatar {
    position: relative;
    flex-shrink: 0;
}

.conversation-avatar img {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-full);
    object-fit: cover;
}

.online-indicator {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background: var(--online-color);
    border: 2px solid var(--bg-primary);
    border-radius: 50%;
}

.conversation-info {
    flex: 1;
    min-width: 0;
}

.conversation-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.conversation-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-time {
    font-size: 12px;
    color: var(--text-tertiary);
    flex-shrink: 0;
}

.conversation-preview {
    display: flex;
    align-items: center;
    gap: 4px;
}

.conversation-preview p {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-preview .unread-badge {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    font-size: 11px;
    font-weight: 600;
    background: var(--primary);
    color: white;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Contacts List */
.contacts-header {
    padding: 12px 16px;
}

.contacts-list {
    padding: 8px;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
}

.contact-item:hover {
    background: var(--bg-secondary);
}

.contact-avatar {
    position: relative;
    flex-shrink: 0;
}

.contact-avatar img {
    width: 45px;
    height: 45px;
    border-radius: var(--radius-full);
    object-fit: cover;
}

.contact-info {
    flex: 1;
    min-width: 0;
}

.contact-name {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
}

.contact-status {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.contact-actions {
    display: flex;
    gap: 4px;
}

/* Requests List */
.requests-list {
    padding: 8px;
}

.request-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
}

.request-info {
    flex: 1;
    min-width: 0;
}

.request-name {
    font-weight: 600;
    margin-bottom: 2px;
}

.request-time {
    font-size: 12px;
    color: var(--text-tertiary);
}

.request-actions {
    display: flex;
    gap: 8px;
}

.request-actions .btn {
    height: 36px;
    padding: 0 16px;
    font-size: 13px;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-secondary);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    flex: 1;
}

.user-avatar {
    position: relative;
}

.user-avatar img {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    object-fit: cover;
}

.user-info h4 {
    font-size: 14px;
    font-weight: 600;
}

.user-info p {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Chat Container */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-chat);
    position: relative;
}

/* Empty Chat State */
.empty-chat {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
}

.empty-content {
    text-align: center;
    padding: 40px;
}

.empty-content i {
    font-size: 80px;
    color: var(--text-tertiary);
    margin-bottom: 24px;
}

.empty-content h2 {
    font-size: 24px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.empty-content p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

/* Active Chat */
.active-chat {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Chat Header */
.chat-header {
    height: var(--header-height);
    padding: 0 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.back-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    border-radius: var(--radius-full);
}

.back-btn i {
    font-size: 20px;
}

.chat-user {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.chat-avatar {
    position: relative;
}

.chat-avatar img {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    object-fit: cover;
}

.chat-user-info h3 {
    font-size: 15px;
    font-weight: 600;
}

.chat-user-info p {
    font-size: 12px;
    color: var(--text-secondary);
}

.chat-actions {
    display: flex;
    gap: 4px;
}

/* Messages Container */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><text y=".9em" font-size="90" opacity="0.02">💬</text></svg>');
    background-size: 100px;
}

.messages-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Message Bubbles */
.message {
    display: flex;
    flex-direction: column;
    max-width: 65%;
    animation: messageIn 0.2s ease;
}

@keyframes messageIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.sent {
    align-self: flex-end;
}

.message.received {
    align-self: flex-start;
}

.message-bubble {
    padding: 8px 12px;
    border-radius: var(--radius-md);
    position: relative;
}

.message.sent .message-bubble {
    background: var(--bg-message-out);
    border-bottom-right-radius: 4px;
}

.message.received .message-bubble {
    background: var(--bg-message-in);
    border-bottom-left-radius: 4px;
    box-shadow: var(--shadow-sm);
}

.message-sender {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 4px;
}

.message-content {
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.message-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    margin-top: 4px;
}

.message-time {
    font-size: 11px;
    color: var(--text-tertiary);
}

.message-status {
    font-size: 14px;
    color: var(--text-tertiary);
}

.message-status.delivered {
    color: var(--text-tertiary);
}

.message-status.read {
    color: var(--secondary);
}

/* Reply Preview in Message */
.message-reply {
    padding: 8px;
    margin-bottom: 4px;
    background: rgba(0, 0, 0, 0.05);
    border-left: 3px solid var(--primary);
    border-radius: 4px;
    font-size: 12px;
}

.message-reply .reply-name {
    font-weight: 600;
    color: var(--primary);
}

.message-reply .reply-text {
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Image Message */
.message-image {
    max-width: 300px;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

/* File Message */
.message-file {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.message-file i {
    font-size: 32px;
    color: var(--primary);
}

.file-info {
    flex: 1;
    min-width: 0;
}

.file-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-size {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    align-items: center;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--text-tertiary);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(1) { animation-delay: 0s; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-8px); }
}

/* Message Input */
.message-input-container {
    padding: 8px 16px 16px;
    background: var(--bg-secondary);
}

.reply-preview {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    margin-bottom: 8px;
    background: var(--bg-primary);
    border-left: 3px solid var(--primary);
    border-radius: var(--radius-sm);
}

.reply-preview .reply-content {
    flex: 1;
    min-width: 0;
}

.reply-preview .reply-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
}

.reply-preview .reply-text {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.close-reply {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
    border-radius: var(--radius-full);
}

.close-reply:hover {
    background: var(--bg-tertiary);
}

.message-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 6px;
}

.input-container {
    flex: 1;
}

.input-container textarea {
    width: 100%;
    max-height: 100px;
    padding: 10px 12px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    resize: none;
    outline: none;
    line-height: 1.4;
}

.input-container textarea::placeholder {
    color: var(--text-tertiary);
}

.send-btn {
    background: var(--primary) !important;
    color: white !important;
}

.send-btn:hover {
    background: var(--primary-dark) !important;
}

/* Attachment Menu */
.attach-menu {
    position: absolute;
    bottom: 100%;
    left: 60px;
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 8px;
    margin-bottom: 8px;
    z-index: 100;
}

.attach-menu button {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.attach-menu button:hover {
    background: var(--bg-secondary);
}

.attach-menu i {
    font-size: 24px;
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 440px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
}

.modal-lg {
    max-width: 560px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.close-modal {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    border-radius: var(--radius-full);
    transition: var(--transition);
}

.close-modal:hover {
    background: var(--bg-tertiary);
}

.close-modal i {
    font-size: 20px;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
}

/* Settings */
.settings-section {
    margin-bottom: 32px;
}

.settings-section:last-child {
    margin-bottom: 0;
}

.settings-section h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.profile-edit {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.avatar-edit {
    position: relative;
    flex-shrink: 0;
}

.avatar-edit img {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-full);
    object-fit: cover;
}

.avatar-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    border-radius: var(--radius-full);
    color: white;
    opacity: 0;
    transition: var(--transition);
}

.avatar-edit:hover .avatar-overlay {
    opacity: 1;
}

.avatar-overlay i {
    font-size: 24px;
}

.profile-fields {
    flex: 1;
}

.profile-fields .form-group {
    margin-bottom: 12px;
}

.profile-fields input {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    background: var(--bg-secondary);
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    outline: none;
}

.profile-fields input:focus {
    box-shadow: 0 0 0 2px var(--primary);
}

.setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
}

.setting-item:last-child {
    border-bottom: none;
}

.setting-info span {
    font-weight: 500;
}

.setting-info p {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Switch Toggle */
.switch {
    position: relative;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    transition: var(--transition);
}

.slider::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: var(--transition);
}

input:checked + .slider {
    background: var(--primary);
}

input:checked + .slider::before {
    transform: translateX(20px);
}

/* Form Select */
.form-select {
    height: 36px;
    padding: 0 12px;
    background: var(--bg-secondary);
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    outline: none;
    cursor: pointer;
}

/* Search Results */
.search-results {
    margin-top: 16px;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
}

.search-result-item:hover {
    background: var(--bg-secondary);
}

.search-result-item img {
    width: 45px;
    height: 45px;
    border-radius: var(--radius-full);
    object-fit: cover;
}

.search-result-info {
    flex: 1;
}

.search-result-info h4 {
    font-size: 15px;
    font-weight: 500;
}

.search-result-info p {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Context Menu */
.context-menu {
    position: fixed;
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 8px;
    min-width: 180px;
    z-index: 1001;
}

.context-menu button {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 12px;
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.context-menu button:hover {
    background: var(--bg-secondary);
}

.context-menu button i {
    font-size: 18px;
    color: var(--text-secondary);
}

.context-menu button.danger {
    color: #dc3545;
}

.context-menu button.danger i {
    color: #dc3545;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast.success {
    border-left: 4px solid var(--primary);
}

.toast.error {
    border-left: 4px solid #dc3545;
}

.toast.info {
    border-left: 4px solid var(--secondary);
}

.toast i {
    font-size: 20px;
}

.toast.success i { color: var(--primary); }
.toast.error i { color: #dc3545; }
.toast.info i { color: var(--secondary); }

.toast-message {
    flex: 1;
    font-size: 14px;
}

.toast-close {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
    border-radius: var(--radius-sm);
}

.toast-close:hover {
    background: var(--bg-secondary);
}

/* Date Separator */
.date-separator {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px 0;
}

.date-separator span {
    padding: 6px 16px;
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--bg-message-in);
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-sm);
}

/* Responsive Design */
@media (max-width: 768px) {
    :root {
        --sidebar-width: 100%;
    }
    
    .mobile-only {
        display: flex;
    }
    
    .app-container {
        flex-direction: column;
    }
    
    .sidebar {
        position: absolute;
        inset: 0;
        z-index: 10;
        transform: translateX(0);
        transition: transform 0.3s ease;
    }
    
    .sidebar.hidden-mobile {
        transform: translateX(-100%);
    }
    
    .chat-container {
        position: absolute;
        inset: 0;
    }
    
    .empty-chat {
        display: none;
    }
    
    .message {
        max-width: 85%;
    }
    
    .modal-content {
        max-height: 100vh;
        border-radius: 0;
    }
    
    .toast-container {
        top: auto;
        bottom: 20px;
        left: 20px;
        right: 20px;
    }
    
    .toast {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .auth-form {
        padding: 24px;
    }
    
    .nav-tab span {
        display: none;
    }
    
    .nav-tab {
        padding: 0 12px;
    }
    
    .conversation-item {
        padding: 10px 8px;
    }
    
    .conversation-avatar img {
        width: 45px;
        height: 45px;
    }
}

/* Print Styles */
@media print {
    .sidebar,
    .message-input-container,
    .chat-header {
        display: none;
    }
    
    .messages-container {
        overflow: visible;
    }
}
/* Pull to Refresh */
.pull-refresh-indicator {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%) translateY(-50px);
    width: 40px;
    height: 40px;
    background: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.2s ease;
    box-shadow: 0 4px 15px rgba(18, 140, 126, 0.4);
}

.pull-refresh-indicator.visible {
    opacity: 1;
}

.pull-refresh-indicator i {
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes ri-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.ri-spin {
    animation: ri-spin 1s linear infinite;
}