/* Chato - Minimalist Chat App Styles */

:root {
    --primary: #10b981;
    --primary-dark: #059669;
    --primary-light: #d1fae5;
    --secondary: #64748b;
    --success: #10b981;
    --error: #ef4444;
    --bg-primary: #ffffff;
    --bg-secondary: #f0fdf4;
    --bg-tertiary: #dcfce7;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --border: #d1d5db;
    --shadow: rgba(16, 185, 129, 0.1);
    --shadow-hover: rgba(16, 185, 129, 0.2);
}

/* Dark Mode */
[data-theme="dark"] {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --primary-light: #1e3a8a;
    --secondary: #94a3b8;
    --success: #10b981;
    --error: #ef4444;
    --bg-primary: #1e293b;
    --bg-secondary: #0f172a;
    --bg-tertiary: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border: #334155;
    --shadow: rgba(59, 130, 246, 0.1);
    --shadow-hover: rgba(59, 130, 246, 0.2);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Auth Pages */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--bg-secondary) 100%);
}

.auth-container {
    width: 100%;
    max-width: 420px;
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.logo {
    font-size: 56px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
    letter-spacing: -1px;
}

.tagline {
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 500;
}

.auth-card {
    background: var(--bg-primary);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 10px 40px var(--shadow-hover);
    border: 1px solid var(--border);
}

.auth-card h2 {
    font-size: 26px;
    margin-bottom: 28px;
    text-align: center;
    font-weight: 700;
    color: var(--text-primary);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.form-group input {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid var(--border);
    border-radius: 12px;
    font-size: 15px;
    transition: all 0.3s;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg-primary);
    box-shadow: 0 0 0 3px var(--shadow);
}

.form-group input:disabled {
    background: var(--bg-tertiary);
    cursor: not-allowed;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-shrink: 0;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    padding: 0;
    box-shadow: 0 4px 12px var(--shadow-hover);
}

.btn-primary:hover {
    transform: scale(1.1) rotate(15deg);
    box-shadow: 0 6px 16px var(--shadow-hover);
}

/* Remove rotation for block buttons (login, register, etc) */
.btn-block.btn-primary:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 20px var(--shadow-hover);
}

.btn-primary:active {
    transform: scale(0.95);
}

.btn-primary svg {
    width: 22px;
    height: 22px;
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-block {
    width: 100%;
    border-radius: 12px;
    padding: 14px;
    font-size: 16px;
    font-weight: 600;
}

.btn-block.btn-primary {
    width: 100%;
    height: auto;
    border-radius: 12px;
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 15px;
    color: var(--text-secondary);
}

.auth-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
}

.auth-footer a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
}

.alert-error {
    background: #fee2e2;
    color: var(--error);
    border: 1px solid #fecaca;
}

.alert-success {
    background: #d1fae5;
    color: var(--success);
    border: 1px solid #a7f3d0;
}

/* Chat Container */
.chat-container {
    display: flex;
    height: 100vh;
    max-height: 100vh;
    max-width: 1400px;
    margin: 0 auto;
    background: var(--bg-secondary);
    overflow: hidden;
    box-shadow: 0 0 40px var(--shadow);
}

/* Sidebar */
.chat-sidebar {
    width: 100%;
    max-width: 360px;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    box-shadow: 2px 0 10px var(--shadow);
}

.sidebar-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}

.sidebar-header h2 {
    font-size: 22px;
    color: white;
    font-weight: 700;
    letter-spacing: -0.5px;
    flex-shrink: 0;
}

.header-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: nowrap;
}

.header-actions .icon-btn,
.header-actions .theme-toggle {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: all 0.3s;
    flex-shrink: 0;
    padding: 0;
}

.header-actions .icon-btn:hover,
.header-actions .theme-toggle:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

.header-actions .icon-btn svg,
.header-actions .theme-toggle svg {
    width: 18px;
    height: 18px;
}

.header-actions .avatar-small {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.3);
    flex-shrink: 0;
}

.user-list {
    flex: 1;
    overflow-y: auto;
    background: var(--bg-primary);
}

.user-item {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    gap: 12px;
    cursor: pointer;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.3s;
    border-bottom: 1px solid var(--border);
    background: var(--bg-primary);
    position: relative;
}

.user-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--primary);
    transform: scaleY(0);
    transition: transform 0.3s;
}

.user-item:hover {
    background: var(--bg-tertiary);
    transform: translateX(4px);
}

.user-item:hover::before {
    transform: scaleY(1);
}

.user-item.active {
    background: var(--primary-light);
    font-weight: 500;
}

.user-item.active::before {
    transform: scaleY(1);
}

.avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-light);
    transition: all 0.3s;
}

.user-item:hover .avatar {
    border-color: var(--primary);
    transform: scale(1.05);
}

.user-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.user-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.user-name {
    font-weight: 500;
    font-size: 15px;
    color: var(--text-primary);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-time {
    font-size: 11px;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.user-last-message {
    display: flex;
    align-items: center;
    gap: 4px;
}

.message-content {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.user-last-message .message-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-checkmark {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    width: 16px;
    height: 16px;
}

.sidebar-checkmark.sent {
    color: var(--text-secondary);
}

.sidebar-checkmark.read {
    color: #4ade80;
}

[data-theme="dark"] .sidebar-checkmark.read {
    color: #3b82f6;
}

.unread-badge {
    background: var(--primary);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 12px;
    min-width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.user-item.active .unread-badge {
    background: white;
    color: var(--primary);
}

/* Chat Main */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
}

.chat-header {
    padding: 16px 20px;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px var(--shadow);
}

.back-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: background 0.2s;
}

.back-btn:hover {
    background: var(--bg-tertiary);
}

.back-btn.mobile-only {
    display: none;
}

.chat-user-info {
    flex: 1;
}

.chat-user-name {
    font-weight: 600;
    font-size: 16px;
}

.chat-user-status {
    font-size: 12px;
    margin-top: 2px;
}

.status-online {
    color: var(--success);
    font-weight: 500;
}

.status-offline {
    color: var(--text-secondary);
    font-weight: 400;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
    position: relative;
    background: var(--bg-secondary);
    background-image: 
        radial-gradient(circle at 20% 30%, rgba(16, 185, 129, 0.25) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(5, 150, 105, 0.25) 0%, transparent 50%),
        radial-gradient(circle at 40% 80%, rgba(16, 185, 129, 0.20) 0%, transparent 40%),
        radial-gradient(circle at 90% 20%, rgba(5, 150, 105, 0.20) 0%, transparent 45%),
        repeating-linear-gradient(45deg, transparent, transparent 35px, rgba(16, 185, 129, 0.08) 35px, rgba(16, 185, 129, 0.08) 36px),
        repeating-linear-gradient(-45deg, transparent, transparent 35px, rgba(16, 185, 129, 0.08) 35px, rgba(16, 185, 129, 0.08) 36px);
}

/* Dark mode background */
[data-theme="dark"] .chat-messages {
    background-image: 
        radial-gradient(circle at 20% 30%, rgba(59, 130, 246, 0.12) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(37, 99, 235, 0.12) 0%, transparent 50%),
        radial-gradient(circle at 40% 80%, rgba(59, 130, 246, 0.10) 0%, transparent 40%),
        radial-gradient(circle at 90% 20%, rgba(37, 99, 235, 0.10) 0%, transparent 45%),
        repeating-linear-gradient(45deg, transparent, transparent 35px, rgba(59, 130, 246, 0.04) 35px, rgba(59, 130, 246, 0.04) 36px),
        repeating-linear-gradient(-45deg, transparent, transparent 35px, rgba(59, 130, 246, 0.04) 35px, rgba(59, 130, 246, 0.04) 36px);
}

/* Ensure messages appear above background */
.chat-messages > * {
    position: relative;
    z-index: 1;
}

.message-bubble {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
    animation: fadeIn 0.3s ease-out;
    box-shadow: 0 2px 8px var(--shadow);
    transition: all 0.2s;
    position: relative;
    z-index: 1;
}

.message-bubble:hover {
    box-shadow: 0 4px 12px var(--shadow-hover);
    transform: translateY(-1px);
}

@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(10px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

.message-bubble.own {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.message-bubble.other {
    align-self: flex-start;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
    color: var(--text-primary);
}

.message-text {
    font-size: 15px;
    line-height: 1.4;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
}

.message-image {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    margin-top: 4px;
    cursor: pointer;
    display: block;
    object-fit: cover;
    transition: transform 0.2s;
}

.message-image:hover {
    transform: scale(1.02);
}

.message-image:active {
    transform: scale(0.98);
}

.message-audio {
    width: 100%;
    margin-top: 4px;
}

.message-time {
    font-size: 11px;
    margin-top: 4px;
    opacity: 0.7;
    display: flex;
    align-items: center;
    gap: 4px;
}

.read-status {
    display: inline-flex;
    align-items: center;
    margin-left: 2px;
}

.read-status svg {
    width: 14px;
    height: 14px;
}

.read-status.sent {
    color: rgba(255, 255, 255, 0.7);
}

.read-status.read {
    color: #4ade80;
}

.message-bubble.other .read-status {
    display: none;
}

.loading {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
}

.chat-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    padding: 40px;
    text-align: center;
}

.chat-empty svg {
    margin-bottom: 20px;
    opacity: 0.3;
}

.chat-empty h3 {
    margin-bottom: 8px;
    color: var(--text-primary);
}

.chat-input-area {
    padding: 16px 20px;
    background: var(--bg-primary);
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
    align-items: center;
    position: relative;
    flex-shrink: 0;
    box-shadow: 0 -2px 8px var(--shadow);
}

.message-input {
    flex: 1;
    padding: 12px 18px;
    border: 2px solid var(--border);
    border-radius: 24px;
    font-size: 15px;
    min-width: 0;
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: all 0.3s;
}

.message-input::placeholder {
    color: var(--text-secondary);
}

.message-input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg-primary);
    box-shadow: 0 0 0 3px var(--shadow);
}

.icon-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border: none;
    background: var(--bg-tertiary);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    transition: all 0.3s;
    flex-shrink: 0;
}

.icon-btn:hover {
    background: var(--primary);
    color: white;
    transform: scale(1.1);
}

.icon-btn:active {
    transform: scale(0.95);
}

.icon-btn svg {
    width: 22px;
    height: 22px;
}

/* Attach Menu */
.attach-menu {
    position: absolute;
    bottom: 65px;
    left: 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 8px;
    box-shadow: 0 4px 12px var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 100;
    min-width: 160px;
}

.attach-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 14px;
    transition: background 0.2s;
    white-space: nowrap;
    text-align: left;
}

.attach-option:hover {
    background: var(--bg-tertiary);
}

.attach-option svg {
    color: var(--primary);
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Emoji Picker */
.emoji-picker {
    position: absolute;
    bottom: 65px;
    right: 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 4px 12px var(--shadow);
    z-index: 100;
    width: 320px;
    max-height: 280px;
    overflow-y: auto;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
}

.emoji-item {
    font-size: 24px;
    padding: 8px;
    text-align: center;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.2s;
    user-select: none;
}

.emoji-item:hover {
    background: var(--bg-tertiary);
    transform: scale(1.2);
}

/* Profile Page */
.profile-container {
    max-width: 600px;
    margin: 0 auto;
    min-height: 100vh;
    background: var(--bg-primary);
}

.profile-header {
    padding: 16px 20px;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 16px;
}

.profile-header h2 {
    font-size: 20px;
}

.profile-content {
    padding: 32px 20px;
}

.profile-avatar-section {
    text-align: center;
    margin-bottom: 32px;
}

.avatar-preview {
    position: relative;
    display: inline-block;
    margin-bottom: 12px;
}

.avatar-large {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
}

.avatar-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    cursor: pointer;
    transition: opacity 0.2s;
}

.avatar-preview:hover .avatar-overlay {
    opacity: 1;
}

.avatar-hint {
    font-size: 13px;
    color: var(--text-secondary);
}

.profile-form {
    margin-bottom: 24px;
}

.profile-actions {
    margin-top: 32px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    body {
        overflow: hidden;
        position: fixed;
        width: 100%;
        height: 100vh;
        height: 100dvh;
    }
    
    .chat-container {
        height: 100vh;
        height: 100dvh;
        max-height: 100vh;
        max-height: 100dvh;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
    }
    
    .chat-main {
        height: 100vh;
        height: 100dvh;
        max-height: 100vh;
        max-height: 100dvh;
        position: relative;
    }
    
    .chat-messages {
        padding: 12px;
        padding-bottom: 12px;
    }
    
    .chat-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 100;
        max-width: 100%;
        transform: translateX(0);
        transition: transform 0.3s;
        height: 100vh;
        height: 100dvh;
    }
    
    .chat-sidebar.hidden {
        transform: translateX(-100%);
    }
    
    /* Mobile header adjustments */
    .sidebar-header {
        padding: 12px 16px;
    }
    
    .sidebar-header h2 {
        font-size: 20px;
    }
    
    .header-actions {
        gap: 4px;
    }
    
    .header-actions .icon-btn,
    .header-actions .theme-toggle {
        width: 32px;
        height: 32px;
        min-width: 32px;
    }
    
    .header-actions .icon-btn svg,
    .header-actions .theme-toggle svg {
        width: 16px;
        height: 16px;
    }
    
    .header-actions .avatar-small {
        width: 32px;
        height: 32px;
        min-width: 32px;
    }
    
    .back-btn.mobile-only {
        display: flex;
    }
    
    .message-bubble {
        max-width: 85%;
    }
    
    .chat-input-area {
        padding: 8px 10px;
        gap: 4px;
        position: relative;
        bottom: 0;
    }
    
    .icon-btn {
        width: 32px;
        height: 32px;
        min-width: 32px;
    }
    
    .icon-btn svg {
        width: 18px;
        height: 18px;
    }
    
    .message-input {
        padding: 8px 12px;
        font-size: 16px; /* Prevent zoom on iOS */
        border-radius: 20px;
    }
    
    .btn {
        padding: 8px 12px;
        min-width: 40px;
    }
    
    .btn-primary {
        width: 40px;
        height: 40px;
    }
    
    .btn-primary svg {
        width: 16px;
        height: 16px;
    }
    
    .emoji-picker {
        width: 280px;
        max-height: 240px;
        right: 10px;
        bottom: 55px;
    }
    
    .emoji-grid {
        grid-template-columns: repeat(6, 1fr);
    }
    
    .emoji-item {
        font-size: 20px;
        padding: 6px;
    }
    
    .attach-menu {
        bottom: 55px;
        left: 10px;
    }
    
    /* Show sidebar by default on mobile when no chat selected */
    .chat-main:not(.has-chat) {
        display: none;
    }
    
    /* Compact header on mobile */
    .chat-header {
        padding: 12px 16px;
    }
    
    .sidebar-header {
        padding: 16px;
    }
    
    .user-item {
        padding: 12px 16px;
    }
    
    .avatar {
        width: 40px;
        height: 40px;
    }
    
    .avatar-small {
        width: 32px;
        height: 32px;
    }
    
    .profile-modal {
        padding: 10px;
    }
    
    .profile-modal-content {
        max-width: 95%;
        max-height: 95%;
    }
    
    .profile-modal-close {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
    }
    
    .profile-modal-content img {
        max-height: 85vh;
        border-radius: 8px;
    }
    
    .profile-modal-name {
        font-size: 14px;
        padding: 6px 12px;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary);
}

/* Profile Image Modal */
.profile-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s;
    padding: 20px;
}

.profile-modal-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.profile-modal-close {
    position: absolute;
    top: -50px;
    right: 0;
    width: 44px;
    height: 44px;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: all 0.2s;
    z-index: 1001;
}

.profile-modal-close:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
}

.profile-modal-close:active {
    transform: scale(0.95);
}

.profile-modal-content img {
    max-width: 100%;
    max-height: 80vh;
    border-radius: 12px;
    object-fit: contain;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    background: transparent;
    image-rendering: auto;
    -webkit-user-select: none;
    user-select: none;
}

.profile-modal-name {
    color: white;
    font-size: 16px;
    font-weight: 500;
    text-align: center;
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 8px;
}

.clickable {
    cursor: pointer;
    transition: transform 0.2s;
}

.clickable:hover {
    transform: scale(1.05);
}

.clickable:active {
    transform: scale(0.95);
}

/* Theme Toggle for Auth Pages */
.theme-toggle-auth {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    border: none;
    background: var(--bg-primary);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    box-shadow: 0 2px 8px var(--shadow);
    transition: all 0.2s;
    z-index: 1000;
}

.theme-toggle-auth:hover {
    background: var(--bg-tertiary);
    transform: scale(1.05);
}

.theme-toggle-auth svg {
    width: 20px;
    height: 20px;
}


/* Dark mode - different abstract pattern */
[data-theme="dark"] .chat-messages::before {
    opacity: 0.05;
    background-image: 
        radial-gradient(circle at 15% 25%, var(--primary) 0%, transparent 45%),
        radial-gradient(circle at 85% 75%, var(--primary-dark) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, var(--primary) 0%, transparent 35%),
        radial-gradient(circle at 70% 15%, var(--primary-dark) 0%, transparent 40%);
}

[data-theme="dark"] .chat-messages::after {
    opacity: 0.03;
}

/* Animated floating shapes (optional - subtle) */
@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(5deg); }
}

.chat-messages .floating-shape {
    position: absolute;
    border-radius: 50%;
    background: var(--primary);
    opacity: 0.02;
    pointer-events: none;
    animation: float 20s ease-in-out infinite;
}

.chat-messages .floating-shape:nth-child(1) {
    width: 300px;
    height: 300px;
    top: 10%;
    left: -10%;
    animation-delay: 0s;
}

.chat-messages .floating-shape:nth-child(2) {
    width: 200px;
    height: 200px;
    bottom: 20%;
    right: -5%;
    animation-delay: 7s;
}

.chat-messages .floating-shape:nth-child(3) {
    width: 250px;
    height: 250px;
    top: 60%;
    left: 50%;
    animation-delay: 14s;
}


/* Theme toggle in chat header (different style from sidebar) */
.chat-header .theme-toggle {
    background: var(--bg-tertiary);
    color: var(--primary);
}

.chat-header .theme-toggle:hover {
    background: var(--primary);
    color: white;
}


/* Reply button on hover (Desktop only) */
.message-bubble {
    cursor: pointer;
    position: relative;
}

.message-bubble:hover {
    filter: brightness(0.95);
}

/* Reply icon that appears on hover */
.message-bubble .reply-btn {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 32px;
    height: 32px;
    background: var(--bg-primary);
    border: 2px solid var(--primary);
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px var(--shadow);
    transition: all 0.2s;
    z-index: 10;
}

.message-bubble:hover .reply-btn {
    display: flex;
}

.message-bubble .reply-btn:hover {
    background: var(--primary);
    transform: scale(1.1);
}

.message-bubble .reply-btn svg {
    width: 16px;
    height: 16px;
    stroke: var(--primary);
}

.message-bubble .reply-btn:hover svg {
    stroke: white;
}

/* Hide reply button on mobile - use click instead */
@media (max-width: 768px) {
    .message-bubble .reply-btn {
        display: none !important;
    }
}

/* Settings Modal */
.settings-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.settings-modal-content {
    background: var(--bg-primary);
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.settings-header h3 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--text-primary);
}

.settings-modal-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.settings-modal-close:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.settings-body {
    padding: 20px;
}

.setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: 12px;
    margin-bottom: 12px;
    transition: all 0.3s ease;
}

.setting-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.setting-info {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
}

.setting-info svg {
    color: var(--primary-color);
    flex-shrink: 0;
}

.setting-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.setting-desc {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.settings-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
    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-color: #ccc;
    transition: 0.3s;
    border-radius: 28px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--primary-color);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

.toggle-switch input:disabled + .toggle-slider {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Dark mode adjustments */
body.dark-mode .settings-modal-content {
    background: var(--bg-primary);
}

body.dark-mode .setting-item {
    background: var(--bg-secondary);
}

/* Mobile responsive */
@media (max-width: 768px) {
    .settings-modal-content {
        width: 95%;
        max-height: 85vh;
    }
    
    .settings-header {
        padding: 16px;
    }
    
    .settings-body {
        padding: 16px;
    }
    
    .setting-item {
        padding: 12px;
    }
    
    .setting-info {
        gap: 12px;
    }
    
    .setting-info svg {
        width: 20px;
        height: 20px;
    }
    
    .setting-title {
        font-size: 0.9rem;
    }
    
    .setting-desc {
        font-size: 0.8rem;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Voice Message Styles */
.voice-message {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    min-width: 280px;
    max-width: 100%;
}

.voice-avatar {
    position: relative;
    flex-shrink: 0;
}

.voice-avatar img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.voice-mic-icon {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 20px;
    height: 20px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-primary);
}

.voice-mic-icon svg {
    width: 12px;
    height: 12px;
}

.voice-content {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.voice-play-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.voice-play-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.voice-play-btn:active {
    transform: scale(0.95);
}

.voice-waveform {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.waveform-bars {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 1;
    height: 24px;
    min-width: 0;
}

.waveform-bar {
    width: 3px;
    background: var(--primary);
    border-radius: 2px;
    opacity: 0.6;
    transition: all 0.3s ease;
}

@keyframes waveform {
    0%, 100% {
        transform: scaleY(1);
        opacity: 0.6;
    }
    50% {
        transform: scaleY(1.5);
        opacity: 1;
    }
}

.voice-duration {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    min-width: 40px;
    text-align: right;
    flex-shrink: 0;
}

/* Dark mode voice message */
[data-theme="dark"] .voice-avatar img {
    border-color: rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .voice-mic-icon {
    background: var(--primary);
    border-color: var(--bg-primary);
}

[data-theme="dark"] .voice-play-btn {
    background: var(--primary);
}

[data-theme="dark"] .voice-play-btn:hover {
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

[data-theme="dark"] .waveform-bar {
    background: var(--primary);
}

/* Remove old audio controls */
.message-audio {
    display: none;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .voice-message {
        min-width: 240px;
        gap: 10px;
        padding: 6px;
    }
    
    .voice-avatar img {
        width: 42px;
        height: 42px;
    }
    
    .voice-mic-icon {
        width: 18px;
        height: 18px;
    }
    
    .voice-mic-icon svg {
        width: 10px;
        height: 10px;
    }
    
    .voice-play-btn {
        width: 32px;
        height: 32px;
    }
    
    .waveform-bars {
        gap: 1.5px;
    }
    
    .waveform-bar {
        width: 2.5px;
    }
    
    .voice-duration {
        font-size: 12px;
        min-width: 35px;
    }
}

/* Reply Feature Styles */
.reply-preview {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-left: 3px solid var(--primary);
    margin: 0 16px;
    border-radius: 8px 8px 0 0;
}

.reply-preview-content {
    flex: 1;
    min-width: 0;
}

.reply-preview-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 4px;
}

.reply-preview-header svg {
    flex-shrink: 0;
}

.reply-preview-text {
    font-size: 14px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.reply-preview-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.reply-preview-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Quoted message in bubble */
.quoted-message {
    background: rgba(0, 0, 0, 0.1);
    border-left: 3px solid var(--primary);
    padding: 8px 12px;
    margin-bottom: 8px;
    border-radius: 6px;
}

.message-bubble.own .quoted-message {
    background: rgba(255, 255, 255, 0.2);
    border-left-color: rgba(255, 255, 255, 0.5);
}

.quoted-sender {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 2px;
}

.message-bubble.own .quoted-sender {
    color: rgba(255, 255, 255, 0.9);
}

.quoted-text {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.message-bubble.own .quoted-text {
    color: rgba(255, 255, 255, 0.7);
}

/* Reply button (desktop hover) */
.reply-btn {
    position: absolute;
    top: -10px;
    right: 10px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px var(--shadow);
    transition: all 0.3s ease;
    z-index: 10;
}

.reply-btn svg {
    width: 16px;
    height: 16px;
    color: var(--primary);
}

.reply-btn:hover {
    background: var(--primary);
    transform: scale(1.1);
}

.reply-btn:hover svg {
    color: white;
}

/* Show reply button on hover (desktop only) */
@media (min-width: 769px) {
    .message-bubble:hover .reply-btn {
        display: flex;
    }
}

/* Mobile: make entire bubble clickable for reply */
@media (max-width: 768px) {
    .message-bubble {
        cursor: pointer;
    }
    
    .reply-preview {
        margin: 0 12px;
        padding: 10px 12px;
    }
}

/* Dark mode adjustments */
[data-theme="dark"] .reply-preview {
    background: var(--bg-tertiary);
}

[data-theme="dark"] .quoted-message {
    background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .reply-btn {
    background: var(--bg-tertiary);
    border-color: var(--border);
}

/* Friends Page Styles */
.friends-container {
    max-width: 800px;
    margin: 0 auto;
    min-height: 100vh;
    background: var(--bg-secondary);
}

.friends-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.friends-header h2 {
    flex: 1;
    margin: 0;
    font-size: 1.5rem;
    color: white;
    font-weight: 700;
}

.friends-header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.friends-header .back-btn,
.friends-header .btn-icon,
.friends-header .theme-toggle {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: all 0.3s;
    flex-shrink: 0;
    text-decoration: none;
}

.friends-header .back-btn:hover,
.friends-header .btn-icon:hover,
.friends-header .theme-toggle:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

.friends-header .back-btn svg,
.friends-header .btn-icon svg,
.friends-header .theme-toggle svg {
    width: 20px;
    height: 20px;
}

.friends-content {
    padding: 20px;
}

.friends-section {
    margin-bottom: 32px;
}

.friends-section h3 {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary);
}

.friend-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.friend-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-primary);
    border-radius: 12px;
    border: 1px solid var(--border);
    transition: all 0.3s ease;
}

.friend-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow-hover);
}

.friend-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.friend-info {
    flex: 1;
    min-width: 0;
}

.friend-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.friend-email {
    font-size: 0.875rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.friend-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.friend-status {
    display: flex;
    align-items: center;
}

.badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-pending {
    background: rgba(251, 191, 36, 0.2);
    color: #f59e0b;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: var(--bg-primary);
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.empty-state svg {
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state p {
    margin-bottom: 16px;
    font-size: 1rem;
}

.empty-friends {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-friends svg {
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-friends p {
    margin-bottom: 16px;
    font-size: 0.95rem;
}

/* Button Sizes */
.btn-sm {
    padding: 6px 12px;
    font-size: 0.875rem;
}

.btn-block {
    width: 100%;
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-tertiary);
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.btn-icon:hover {
    background: var(--bg-secondary);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .friends-header {
        padding: 16px;
    }
    
    .friends-content {
        padding: 16px;
    }
    
    .friend-item {
        padding: 10px;
    }
    
    .friend-avatar {
        width: 44px;
        height: 44px;
    }
    
    .friend-actions {
        flex-direction: column;
        gap: 6px;
    }
    
    .btn-sm {
        padding: 4px 10px;
        font-size: 0.8rem;
    }
}

/* Toast Notification System */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    min-width: 300px;
    max-width: 400px;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    pointer-events: all;
    border-left: 4px solid;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast-message {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: #1f2937;
    line-height: 1.5;
}

.toast-close {
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    transition: all 0.2s;
}

.toast-close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #1f2937;
}

/* Toast Types */
.toast-success {
    border-left-color: #10b981;
}

.toast-success .toast-icon {
    color: #10b981;
}

.toast-error {
    border-left-color: #ef4444;
}

.toast-error .toast-icon {
    color: #ef4444;
}

.toast-warning {
    border-left-color: #f59e0b;
}

.toast-warning .toast-icon {
    color: #f59e0b;
}

.toast-info {
    border-left-color: #3b82f6;
}

.toast-info .toast-icon {
    color: #3b82f6;
}

/* Dark mode toast */
[data-theme="dark"] .toast {
    background: #1e293b;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .toast-message {
    color: #f1f5f9;
}

[data-theme="dark"] .toast-close {
    color: #94a3b8;
}

[data-theme="dark"] .toast-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #f1f5f9;
}

/* Confirm Dialog */
.confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.confirm-overlay.show {
    opacity: 1;
}

.confirm-dialog {
    background: white;
    border-radius: 20px;
    padding: 32px 24px;
    max-width: 380px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.confirm-dialog.show {
    transform: scale(1);
    opacity: 1;
}

.confirm-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    color: #f59e0b;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.confirm-message {
    text-align: center;
    font-size: 16px;
    font-weight: 500;
    color: #1f2937;
    margin-bottom: 28px;
    line-height: 1.6;
}

.confirm-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.confirm-actions .btn {
    flex: 1;
    padding: 14px 24px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
}

.confirm-actions .btn-secondary {
    background: #f3f4f6;
    color: #374151;
}

.confirm-actions .btn-secondary:hover {
    background: #e5e7eb;
    transform: translateY(-2px);
}

.confirm-actions .btn-primary {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.confirm-actions .btn-primary:hover {
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
    transform: translateY(-2px);
}

/* Dark mode confirm */
[data-theme="dark"] .confirm-dialog {
    background: #1e293b;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

[data-theme="dark"] .confirm-message {
    color: #f1f5f9;
}

[data-theme="dark"] .confirm-actions .btn-secondary {
    background: #334155;
    color: #f1f5f9;
}

[data-theme="dark"] .confirm-actions .btn-secondary:hover {
    background: #475569;
}

[data-theme="dark"] .confirm-actions .btn-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

[data-theme="dark"] .confirm-actions .btn-primary:hover {
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

/* Mobile responsive */
@media (max-width: 768px) {
    .toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
    }
    
    .toast {
        min-width: auto;
        max-width: none;
        width: 100%;
        padding: 14px 16px;
    }
    
    .toast-message {
        font-size: 13px;
    }
    
    .confirm-dialog {
        padding: 28px 20px;
        width: 88%;
        border-radius: 16px;
    }
    
    .confirm-icon {
        margin-bottom: 16px;
    }
    
    .confirm-icon svg {
        width: 56px;
        height: 56px;
    }
    
    .confirm-message {
        font-size: 15px;
        margin-bottom: 24px;
    }
    
    .confirm-actions {
        flex-direction: column-reverse;
        gap: 10px;
    }
    
    .confirm-actions .btn {
        width: 100%;
        padding: 16px 24px;
        font-size: 16px;
    }
}

/* Dropdown Menu */
.dropdown-menu {
    position: absolute;
    top: 60px;
    right: 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 8px 24px var(--shadow-hover);
    min-width: 200px;
    z-index: 1000;
    overflow: hidden;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-primary);
    text-decoration: none;
    background: none;
    border: none;
    width: 100%;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 15px;
}

.dropdown-item:hover {
    background: var(--bg-tertiary);
}

.dropdown-item svg {
    flex-shrink: 0;
    color: var(--primary);
}

.dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

/* Story Section */
.story-section {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-primary);
    overflow-x: auto;
    overflow-y: hidden;
    display: flex;
    gap: 12px;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.story-section::-webkit-scrollbar {
    height: 4px;
}

.story-section::-webkit-scrollbar-track {
    background: transparent;
}

.story-section::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

.story-item {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    position: relative;
    width: 64px;
}

.story-circle-wrapper {
    position: relative;
    display: block;
    width: 64px;
    height: 64px;
    flex-shrink: 0;
}

.story-circle {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    padding: 3px;
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    position: relative;
    cursor: pointer;
    transition: transform 0.3s;
}

.story-circle:hover {
    transform: scale(1.05);
}

.story-circle-new {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    padding: 3px;
    background: linear-gradient(45deg, var(--primary) 0%, var(--primary-dark) 100%);
    position: relative;
    cursor: pointer;
    transition: transform 0.3s;
}

.story-circle-new:hover {
    transform: scale(1.05);
}

.story-circle-viewed {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    padding: 3px;
    background: var(--border);
    position: relative;
    cursor: pointer;
    transition: transform 0.3s;
}

.story-circle-viewed:hover {
    transform: scale(1.05);
}

.story-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--bg-primary);
}

.my-story .story-circle {
    background: var(--border);
}

.story-add-icon {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 24px;
    height: 24px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid var(--bg-primary);
    cursor: pointer;
    transition: all 0.3s;
    z-index: 10;
}

.story-add-icon:hover {
    transform: scale(1.1);
    background: var(--primary-dark);
}

.story-add-icon svg {
    width: 12px;
    height: 12px;
}

.story-name {
    font-size: 12px;
    color: var(--text-primary);
    max-width: 64px;
    width: 64px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
    display: block;
}

.story-count {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--primary);
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* Story Upload Modal */
.story-upload-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.story-upload-content {
    background: var(--bg-primary);
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.story-upload-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.story-upload-header h3 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--text-primary);
}

.story-modal-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.story-modal-close:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.story-upload-body {
    padding: 20px;
}

.story-upload-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    border: 2px dashed var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 16px;
}

.story-upload-area:hover {
    border-color: var(--primary);
    background: var(--bg-secondary);
}

.story-upload-area svg {
    color: var(--primary);
    margin-bottom: 12px;
}

.story-upload-area p {
    font-size: 15px;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.story-upload-area span {
    font-size: 13px;
    color: var(--text-secondary);
}

.story-preview {
    margin-bottom: 16px;
    border-radius: 12px;
    overflow: hidden;
    max-height: 400px;
}

.story-preview img,
.story-preview video {
    width: 100%;
    height: auto;
    display: block;
}

.story-caption-input {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: 12px;
    font-size: 15px;
    resize: vertical;
    min-height: 80px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    margin-bottom: 16px;
    font-family: inherit;
}

.story-caption-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--shadow);
}

/* Story Viewer */
.story-viewer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 10001;
    display: none;
    flex-direction: column;
}

.story-viewer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.8), transparent);
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
}

.story-viewer-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.story-viewer-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid white;
}

.story-viewer-info {
    display: flex;
    flex-direction: column;
}

.story-viewer-name {
    color: white;
    font-weight: 600;
    font-size: 15px;
}

.story-viewer-time {
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
}

.story-viewer-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    transition: all 0.3s;
}

.story-viewer-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.story-progress-bars {
    display: flex;
    gap: 4px;
    padding: 8px 20px;
    position: absolute;
    top: 70px;
    left: 0;
    right: 0;
    z-index: 10;
}

.story-progress-bar {
    flex: 1;
    height: 3px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    overflow: hidden;
}

.story-progress-fill {
    height: 100%;
    background: white;
    width: 0%;
    transition: width 0.05s linear;
}

.story-viewer-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.story-viewer-image,
.story-viewer-video {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.story-viewer-caption {
    position: absolute;
    bottom: 80px;
    left: 20px;
    right: 20px;
    color: white;
    font-size: 16px;
    text-align: center;
    background: rgba(0, 0, 0, 0.5);
    padding: 12px 16px;
    border-radius: 12px;
    backdrop-filter: blur(10px);
}

.story-navigation {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
}

.story-nav-left,
.story-nav-right {
    flex: 1;
    cursor: pointer;
}

.story-nav-left:active,
.story-nav-right:active {
    background: rgba(255, 255, 255, 0.1);
}

/* Story Comment Input */
.story-comment-input {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px 20px;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 20;
}

.story-comment-field {
    flex: 1;
    padding: 12px 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 24px;
    font-size: 15px;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    backdrop-filter: blur(10px);
}

.story-comment-field::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.story-comment-field:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.2);
}

.story-comment-send {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: all 0.3s;
    flex-shrink: 0;
    backdrop-filter: blur(10px);
}

.story-comment-send:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.story-comment-send:active {
    transform: scale(0.95);
}

.story-comment-send svg {
    width: 20px;
    height: 20px;
}

/* Story Comment Success Animation */
.story-comment-success {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(16, 185, 129, 0.95);
    color: white;
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    z-index: 30;
    animation: commentSent 2s ease-out forwards;
    pointer-events: none;
}

[data-theme="dark"] .story-comment-success {
    background: rgba(59, 130, 246, 0.95);
}

@keyframes commentSent {
    0% {
        opacity: 0;
        transform: translateX(-50%) translateY(20px) scale(0.8);
    }
    15% {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
    }
    85% {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateX(-50%) translateY(-30px) scale(0.9);
    }
}

.story-comment-success svg {
    width: 20px;
    height: 20px;
    animation: checkPop 0.4s ease-out 0.2s;
}

@keyframes checkPop {
    0% {
        transform: scale(0);
    }
    50% {
        transform: scale(1.3);
    }
    100% {
        transform: scale(1);
    }
}

/* Sending animation for button */
.story-comment-send.sending {
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(0.95);
        opacity: 0.7;
    }
}

/* Mobile responsive */
@media (max-width: 768px) {
    .dropdown-menu {
        top: 56px;
        right: 12px;
        min-width: 180px;
    }
    
    .dropdown-item {
        padding: 10px 14px;
        font-size: 14px;
    }
    
    .story-section {
        padding: 12px;
        gap: 10px;
    }
    
    .story-item {
        width: 56px;
    }
    
    .story-circle-wrapper {
        width: 56px;
        height: 56px;
    }
    
    .story-circle,
    .story-circle-new,
    .story-circle-viewed {
        width: 56px;
        height: 56px;
    }
    
    .story-add-icon {
        width: 20px;
        height: 20px;
        border: 2px solid var(--bg-primary);
    }
    
    .story-add-icon svg {
        width: 10px;
        height: 10px;
    }
    
    .story-name {
        font-size: 11px;
        max-width: 56px;
    }
    
    .story-upload-content {
        width: 95%;
    }
    
    .story-upload-header {
        padding: 16px;
    }
    
    .story-upload-body {
        padding: 16px;
    }
    
    .story-upload-area {
        padding: 30px 16px;
    }
    
    .story-viewer-header {
        padding: 12px 16px;
    }
    
    .story-viewer-avatar {
        width: 36px;
        height: 36px;
    }
    
    .story-viewer-name {
        font-size: 14px;
    }
    
    .story-progress-bars {
        top: 60px;
        padding: 6px 16px;
    }
    
    .story-viewer-caption {
        bottom: 80px;
        left: 16px;
        right: 16px;
        font-size: 14px;
        padding: 10px 14px;
    }
    
    .story-comment-input {
        padding: 12px 16px;
        gap: 8px;
    }
    
    .story-comment-field {
        padding: 10px 16px;
        font-size: 14px;
    }
    
    .story-comment-send {
        width: 40px;
        height: 40px;
        min-width: 40px;
    }
    
    .story-comment-send svg {
        width: 18px;
        height: 18px;
    }
    
    .story-comment-success {
        bottom: 70px;
        padding: 10px 20px;
        font-size: 13px;
    }
    
    .story-comment-success svg {
        width: 18px;
        height: 18px;
    }
}

/* Story Viewer Actions */
.story-viewer-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.story-action-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    transition: all 0.3s;
    position: relative;
}

.story-action-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.story-action-btn svg {
    width: 20px;
    height: 20px;
}

.viewers-count {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--primary);
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 5px;
    border-radius: 10px;
    min-width: 16px;
    text-align: center;
}

/* Viewers Modal */
.viewers-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10002;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.viewers-modal-content {
    background: var(--bg-primary);
    border-radius: 16px;
    width: 90%;
    max-width: 400px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.viewers-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.viewers-modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.viewers-modal-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.viewers-modal-close:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.viewers-modal-body {
    padding: 16px;
    overflow-y: auto;
    max-height: 60vh;
}

.viewer-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: 12px;
    margin-bottom: 8px;
    transition: all 0.3s;
}

.viewer-item:hover {
    background: var(--bg-tertiary);
    transform: translateX(4px);
}

.viewer-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary);
}

.viewer-info {
    flex: 1;
}

.viewer-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.viewer-time {
    font-size: 12px;
    color: var(--text-secondary);
}

.empty-viewers {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

/* Mobile responsive */
@media (max-width: 768px) {
    .story-action-btn {
        width: 32px;
        height: 32px;
    }
    
    .story-action-btn svg {
        width: 18px;
        height: 18px;
    }
    
    .viewers-modal-content {
        width: 95%;
        max-height: 85vh;
    }
    
    .viewers-modal-header {
        padding: 16px;
    }
    
    .viewers-modal-header h3 {
        font-size: 1rem;
    }
    
    .viewers-modal-body {
        padding: 12px;
    }
    
    .viewer-item {
        padding: 10px;
    }
    
    .viewer-avatar {
        width: 40px;
        height: 40px;
    }
}
