/* Floca.ru v6.0 - Modern Minimalist Design */

:root {
    /* Dark theme (default) */
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: rgba(18, 18, 26, 0.8);
    --bg-hover: rgba(99, 102, 241, 0.1);
    --text-primary: #f0f0f5;
    --text-secondary: #888899;
    --text-muted: #555566;
    --accent: #6366f1;
    --accent-light: #818cf8;
    --accent-dark: #4f46e5;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --border: rgba(255, 255, 255, 0.08);
    --shadow: rgba(0, 0, 0, 0.5);
    --glow: rgba(99, 102, 241, 0.4);
    --gradient-1: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
    --gradient-2: linear-gradient(135deg, #10b981 0%, #6366f1 100%);
}

[data-theme="light"] {
    --bg-primary: #f8f9fc;
    --bg-secondary: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.95);
    --bg-hover: rgba(99, 102, 241, 0.08);
    --text-primary: #1a1a2e;
    --text-secondary: #666677;
    --text-muted: #9999aa;
    --accent: #6366f1;
    --accent-light: #818cf8;
    --accent-dark: #4f46e5;
    --border: rgba(0, 0, 0, 0.08);
    --shadow: rgba(0, 0, 0, 0.1);
    --glow: rgba(99, 102, 241, 0.25);
}

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

::selection {
    background: var(--accent);
    color: white;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
}

@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }
}

/* ================= HEADER ================= */
.header {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    padding: 14px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: all 0.3s ease;
}

.header.scrolled {
    padding: 10px 0;
    box-shadow: 0 4px 30px var(--shadow);
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.2s ease;
}

.logo:hover {
    transform: scale(1.02);
    opacity: 0.9;
}

.logo-icon {
    font-size: 32px;
    filter: drop-shadow(0 0 10px var(--glow));
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Header Navigation */
.header-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    margin-right: 16px;
}

.header-nav .nav-link {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s ease;
}

.header-nav .nav-link:hover {
    background: var(--bg-hover);
    color: var(--accent);
}

.header-nav .nav-link.active {
    background: var(--accent);
    color: white;
}

.header-nav .nav-link .nav-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--error);
    color: white;
    font-size: 10px;
    font-weight: 600;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    animation: pulse 2s infinite;
}

/* Base Avatar Initials */
.avatar-initials {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-1);
    color: white;
    font-weight: 600;
    border-radius: 50%;
    text-transform: uppercase;
}

/* ================= BUTTONS ================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    text-decoration: none;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-dark);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px var(--glow);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent);
    transform: translateY(-1px);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

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

.btn-back {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-back:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.btn-back.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.btn-icon {
    width: 42px;
    height: 42px;
    padding: 0;
    border-radius: 12px;
}

.btn-sm {
    padding: 8px 14px;
    font-size: 13px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

.btn-full {
    width: 100%;
}

.auth-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
}

.auth-buttons .btn {
    white-space: nowrap;
}

/* ================= THEME TOGGLE ================= */
.theme-toggle {
    position: relative;
    overflow: hidden;
}

.theme-toggle::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, var(--accent) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.theme-toggle:hover::before {
    opacity: 0.15;
}

.theme-toggle svg {
    position: relative;
    z-index: 1;
}

.sun-icon, .moon-icon {
    display: block;
    transition: opacity 0.2s ease, transform 0.3s ease;
}

[data-theme="dark"] .sun-icon { display: none; }
[data-theme="dark"] .moon-icon { display: block; }
[data-theme="light"] .sun-icon { display: block; }
[data-theme="light"] .moon-icon { display: none; }

/* ================= USER AVATAR ================= */
.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-1);
    color: white;
    font-weight: 700;
    font-size: 15px;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 2px 12px var(--shadow);
}

.user-avatar:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 20px var(--glow);
}

/* ================= STATS BAR ================= */
.stats-bar {
    background: var(--bg-card);
    backdrop-filter: blur(8px);
    padding: 16px 24px;
    border-radius: 16px;
    margin: 24px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 16px;
}

.stats-counter {
    display: flex;
    align-items: center;
    gap: 12px;
}

.stats-counter strong {
    font-size: 24px;
    font-weight: 700;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stats-actions {
    display: flex;
    gap: 10px;
}

@media (max-width: 600px) {
    .stats-bar {
        flex-direction: column;
        text-align: center;
    }
}

/* ================= GRID ================= */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
    padding: 24px 0 40px;
}

@media (max-width: 768px) {
    .grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 16px;
    }
}

/* ================= CARD ================= */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(8px);
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid var(--border);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
}

.card:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: var(--accent);
    box-shadow: 0 20px 60px var(--shadow);
}

.card-img-container {
    position: relative;
    aspect-ratio: 1;
    background: var(--bg-secondary);
    overflow: hidden;
}

.card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.card-img-container.loaded .card-img {
    opacity: 1;
}

.card-img-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
}

.card-img-spinner::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

.card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, transparent 60%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.card:hover .card-overlay {
    opacity: 1;
}

.card-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.card-actions .btn {
    flex: 1;
    background: rgba(255, 255, 255, 0.95);
    color: #1a1a2e;
    padding: 12px;
    font-weight: 600;
}

.card-actions .btn:hover {
    background: white;
    transform: scale(1.05);
}

.card-actions .btn-favorite {
    background: rgba(239, 68, 68, 0.9);
    color: white;
}

.card-actions .btn-favorite:hover {
    background: #ef4444;
}

.card-actions .btn-favorite.active {
    background: #ef4444;
    color: white;
}

/* ================= LIGHTBOX ================= */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.98);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lightbox.active {
    display: flex;
    opacity: 1;
}

.lightbox-content {
    max-width: 95%;
    max-height: 95%;
    position: relative;
    animation: zoomIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.lightbox-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    color: white;
}

.lightbox-counter {
    font-size: 14px;
    font-weight: 500;
    opacity: 0.8;
    background: rgba(255, 255, 255, 0.1);
    padding: 6px 14px;
    border-radius: 20px;
}

.lightbox-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.lightbox-body {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-img {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 20px 80px rgba(0, 0, 0, 0.8);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-50%) scale(1.1);
}

.lightbox-prev { left: -80px; }
.lightbox-next { right: -80px; }

@media (max-width: 900px) {
    .lightbox-prev { left: 10px; }
    .lightbox-next { right: 10px; }
    .lightbox-nav {
        width: 48px;
        height: 48px;
    }
}

.lightbox-footer {
    margin-top: 24px;
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.lightbox-download, .lightbox-favorite, .lightbox-slideshow {
    background: var(--accent);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 12px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 15px;
    transition: all 0.2s ease;
}

.lightbox-download:hover, .lightbox-favorite:hover, .lightbox-slideshow:hover {
    background: var(--accent-light);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px var(--glow);
}

.lightbox-hint {
    color: var(--text-secondary);
    font-size: 14px;
    text-align: center;
    padding: 10px;
}

.lightbox-favorite.active {
    background: var(--error);
}

.lightbox-slideshow.active {
    background: var(--success);
}

/* ================= LOADING & ERROR STATES ================= */
.loading {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

.error, .end-message, .empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-secondary);
}

.error svg, .end-message svg, .empty-state svg {
    margin-bottom: 20px;
    opacity: 0.5;
}

.error h3, .end-message h3, .empty-state h3 {
    color: var(--text-primary);
    margin-bottom: 8px;
}

.error button, .end-message button {
    margin-top: 24px;
    padding: 12px 28px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

.error button:hover, .end-message button:hover {
    background: var(--accent-light);
    transform: translateY(-2px);
}

/* ================= FOOTER ================= */
.footer {
    background: var(--bg-card);
    backdrop-filter: blur(8px);
    border-top: 1px solid var(--border);
    padding: 40px 0;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 60px;
}

/* ================= MESSAGES ================= */
.messages-container {
    padding-top: 80px;
    padding-bottom: 40px;
    min-height: calc(100vh - 60px);
}

.page-title {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 24px;
    color: var(--text-primary);
}

/* Conversations List */
.conversations-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.conversation-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.conversation-item:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px var(--shadow);
}

.conv-avatar {
    position: relative;
    width: 48px;
    height: 48px;
    flex-shrink: 0;
}

.conv-avatar .avatar-initials {
    width: 48px;
    height: 48px;
    font-size: 18px;
}

.unread-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--error);
    color: white;
    font-size: 11px;
    font-weight: 600;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
}

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

.conv-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.conv-preview {
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conv-time {
    font-size: 12px;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* Chat View */
.chat-view {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 200px);
    max-width: 800px;
    margin: 0 auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    position: relative; /* Для позиционирования emoji picker */
    border-radius: 20px;
    overflow: hidden;
}

.chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
}

.chat-partner {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-partner .avatar-initials {
    width: 36px;
    height: 36px;
    font-size: 14px;
}

.partner-name {
    font-weight: 600;
    color: var(--text-primary);
}

.chat-partner-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
}

.typing-dots {
    display: flex;
    gap: 3px;
    align-items: center;
}

.typing-dot {
    width: 4px;
    height: 4px;
    background: var(--text-muted);
    border-radius: 50%;
    display: inline-block;
    animation: typing-bounce 1.4s infinite ease-in-out both;
}

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

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

.typing-dot:nth-child(3) {
    animation-delay: 0s;
}

@keyframes typing-bounce {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 16px;
    animation: fadeIn 0.2s ease;
}

.message.sent {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
    color: white;
    border-bottom-right-radius: 4px;
    border-top-right-radius: 16px;
    border-top-left-radius: 16px;
    border-bottom-left-radius: 16px;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.message.received {
    align-self: flex-start;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    border-bottom-right-radius: 16px;
    border: 1px solid var(--border);
}

/* Аватарка собеседника для полученных сообщений */
.message.received {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.message.received .message-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--gradient-1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: white;
    flex-shrink: 0;
    margin-bottom: 4px;
}

.message-content-wrapper {
    flex: 1;
}

.message-content {
    word-wrap: break-word;
    line-height: 1.4;
}

.message-time {
    font-size: 11px;
    opacity: 0.7;
    margin-top: 4px;
    text-align: right;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
}

/* Status checkmarks */
.message-status {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 14px;
}

.message-status .check {
    opacity: 0.5;
}

.message-status .check.delivered {
    opacity: 1;
}

.message-status .check.read {
    color: #4fc3f7; /* Голубой цвет как в Telegram */
    opacity: 1;
}

.no-messages {
    text-align: center;
    color: var(--text-muted);
    padding: 40px;
}

.chat-input-form {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
}

.chat-input-form input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 24px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.2s ease;
}

.chat-input-form input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--glow);
}

.chat-input-form .btn {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 50%;
    flex-shrink: 0;
}

.chat-input-form .btn-emoji {
    background: transparent;
    color: var(--text-muted);
    border: none;
    transition: all 0.2s ease;
}

.chat-input-form .btn-emoji:hover {
    color: var(--accent);
    transform: scale(1.1);
}

/* Emoji Picker */
.emoji-picker {
    position: absolute;
    bottom: 80px;
    left: 16px;
    width: 320px;
    max-width: calc(100% - 32px);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 8px 32px var(--shadow);
    z-index: 1000;
    overflow: hidden;
}

.emoji-tabs {
    display: flex;
    gap: 4px;
    padding: 8px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
}

.emoji-tab {
    flex: 1;
    padding: 8px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    font-size: 20px;
    transition: all 0.2s ease;
}

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

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
    padding: 12px;
    max-height: 200px;
    overflow-y: auto;
}

.emoji-item {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.15s ease;
    user-select: none;
}

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

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state svg {
    margin-bottom: 20px;
    opacity: 0.3;
}

.empty-state p {
    margin-bottom: 8px;
}

.empty-state .hint {
    font-size: 13px;
    opacity: 0.7;
}

/* Messages header with button */
.messages-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.messages-header .page-title {
    margin-bottom: 0;
}

/* Users list page */
.users-container {
    padding-top: 80px;
    padding-bottom: 40px;
    min-height: calc(100vh - 60px);
}

.page-subtitle {
    color: var(--text-muted);
    margin-bottom: 32px;
    font-size: 15px;
}

.users-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.user-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.user-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px var(--shadow);
}

.user-avatar-large {
    width: 56px;
    height: 56px;
    flex-shrink: 0;
}

.user-avatar-large .avatar-initials {
    width: 56px;
    height: 56px;
    font-size: 20px;
}

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

.user-name {
    font-weight: 600;
    font-size: 16px;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.user-bio {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    line-height: 1.4;
}

.user-bio.empty {
    color: var(--text-muted);
    font-style: italic;
}

.user-meta {
    font-size: 12px;
    color: var(--text-muted);
}

.user-action {
    flex-shrink: 0;
}

@media (max-width: 600px) {
    .messages-container {
        padding-top: 70px;
        padding-bottom: 0;
    }

    .chat-view {
        height: calc(100vh - 70px);
        border-radius: 0;
        border-left: none;
        border-right: none;
        border-bottom: none;
    }

    .message {
        max-width: 85%;
    }

    /* Скрываем footer на странице сообщений на мобильных */
    body.page-messages .footer {
        display: none;
    }

    /* Увеличиваем область чата на весь экран */
    body.page-messages main {
        min-height: calc(100vh - 70px);
    }

    /* Компактный заголовок чата */
    .chat-header {
        padding: 12px 16px;
    }

    /* Уменьшаем отступы в сообщениях */
    .chat-messages {
        padding: 12px;
    }

    .message {
        padding: 10px 14px;
    }

    /* Компактная форма ввода */
    .chat-input-form {
        padding: 12px;
    }

    .chat-input-form input {
        padding: 10px 14px;
    }

    /* Emoji picker на мобильных */
    .emoji-picker {
        left: 8px;
        width: calc(100% - 16px);
        max-width: none;
        bottom: 70px;
        z-index: 1000;
    }

    .emoji-grid {
        max-height: 150px;
        grid-template-columns: repeat(7, 1fr);
        padding: 8px;
    }

    .emoji-item {
        font-size: 20px;
    }

    /* Список диалогов на всю высоту */
    .conversations-view {
        min-height: calc(100vh - 70px);
    }

    .conversation-item {
        padding: 12px;
        gap: 12px;
    }

    .conv-avatar,
    .conv-avatar .avatar-initials {
        width: 44px;
        height: 44px;
        font-size: 16px;
    }
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 20px;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-links a:hover {
    color: var(--accent);
}

/* Notification badge for messages */
.nav-messages {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.nav-badge {
    background: var(--error);
    color: white;
    font-size: 11px;
    font-weight: 600;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    animation: pulse 2s infinite;
}

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

/* ================= SCROLLBAR ================= */
::-webkit-scrollbar {
    width: 10px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 5px;
}

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

/* ================= FOCUS STYLES ================= */
.btn:focus, .theme-toggle:focus, input:focus, textarea:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ================= ANIMATIONS ================= */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.card {
    animation: fadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) backwards;
}

.card:nth-child(1) { animation-delay: 0.05s; }
.card:nth-child(2) { animation-delay: 0.1s; }
.card:nth-child(3) { animation-delay: 0.15s; }
.card:nth-child(4) { animation-delay: 0.2s; }
.card:nth-child(5) { animation-delay: 0.25s; }
.card:nth-child(6) { animation-delay: 0.3s; }
.card:nth-child(7) { animation-delay: 0.35s; }
.card:nth-child(8) { animation-delay: 0.4s; }
.card:nth-child(9) { animation-delay: 0.45s; }
.card:nth-child(10) { animation-delay: 0.5s; }
.card:nth-child(11) { animation-delay: 0.55s; }
.card:nth-child(12) { animation-delay: 0.6s; }

/* ================= TOAST NOTIFICATIONS ================= */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    color: var(--text-primary);
    padding: 14px 24px;
    border-radius: 14px;
    border: 1px solid var(--border);
    z-index: 3000;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 8px 32px var(--shadow);
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast-success {
    border-color: var(--success);
}

.toast-success svg {
    color: var(--success);
}

.toast-error {
    border-color: var(--error);
}

.toast-error svg {
    color: var(--error);
}

.toast-info {
    border-color: var(--accent);
}

.toast-info svg {
    color: var(--accent);
}

/* ================= PROGRESS BAR ================= */
.progress-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--border);
    z-index: 3000;
}

.progress-bar {
    height: 100%;
    background: var(--gradient-1);
    width: 0%;
    transition: width 0.3s ease;
}

/* ================= BADGES ================= */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-primary {
    background: var(--accent);
    color: white;
}

.badge-success {
    background: var(--success);
    color: white;
}

.badge-warning {
    background: var(--warning);
    color: white;
}

/* ================= SKELETON LOADER ================= */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-secondary) 25%,
        var(--bg-hover) 50%,
        var(--bg-secondary) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
}

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

.skeleton-card {
    height: 300px;
    border-radius: 20px;
}

/* ================= PROFILE PAGE ================= */
.profile-container {
    padding-top: 40px;
    padding-bottom: 60px;
}

.profile-content {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 32px;
    align-items: start;
}

@media (max-width: 900px) {
    .profile-content {
        grid-template-columns: 1fr;
    }
}

.profile-sidebar {
    position: sticky;
    top: 100px;
}

.profile-card {
    background: var(--bg-card);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 32px;
    text-align: center;
    transition: all 0.3s ease;
}

.profile-card:hover {
    border-color: var(--accent);
    box-shadow: 0 8px 32px var(--shadow);
}

.profile-avatar-section {
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.profile-avatar {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-1);
    color: white;
    font-size: 42px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    box-shadow: 0 8px 32px var(--shadow);
    overflow: visible;
    transition: all 0.3s ease;
    margin: 0 auto;
    position: relative;
}

.profile-avatar:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 48px var(--glow);
}

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

/* Avatar initials inside profile avatar should inherit parent's background */
.profile-avatar .avatar-initials {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: inherit;
    font-size: inherit;
    font-weight: inherit;
    border-radius: 50%;
}

.avatar-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 8px;
}

.profile-username {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.profile-joined {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 24px;
}

.profile-stats {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 24px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
}

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

.stat-card .label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}
/* Кликабельная ссылка для статистики */
.stat-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px var(--shadow);
}

.stat-card-link .stat-card {
    cursor: pointer;
}

.stat-card-link:hover .label {
    color: var(--text-primary);
}

/* Светлая тема - исправления для профиля */
[data-theme="light"] .stat-card-link:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .stat-card {
    background: rgba(0, 0, 0, 0.02);
}


.btn-logout {
    width: 100%;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--error);
    padding: 14px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s ease;
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: var(--error);
    transform: translateY(-1px);
}

.btn-messages {
    width: 100%;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: var(--accent);
    padding: 14px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    margin-bottom: 16px;
    transition: all 0.2s ease;
}

.btn-messages:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: var(--accent);
    transform: translateY(-1px);
    color: var(--accent);
}

/* Profile form */
.profile-section {
    background: var(--bg-card);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 32px;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.subsection-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 28px 0 16px;
}

.form-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 28px 0;
}

/* Password section - отдельная секция */
.password-section {
    margin-top: 24px;
    border-color: var(--accent);
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(99, 102, 241, 0.05) 100%);
}

.profile-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* ================= PROFILE SECTIONS ================= */
.profile-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    position: relative;
}

.profile-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-1);
    border-radius: 16px 16px 0 0;
}

.profile-section .section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}

.profile-section .section-title svg {
    width: 18px;
    height: 18px;
    color: var(--accent);
}

.profile-section .section-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: -12px;
    margin-bottom: 4px;
}

/* Password section - special styling */
.password-section {
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(239, 68, 68, 0.03) 100%);
}

.password-section::before {
    background: linear-gradient(90deg, var(--error) 0%, var(--warning) 100%);
}

.password-section .section-title svg {
    color: var(--error);
}

/* Info section */
.info-section::before {
    background: linear-gradient(90deg, var(--accent) 0%, var(--success) 100%);
}

.info-section .section-title svg {
    color: var(--accent);
}

/* Avatar section */
.avatar-section::before {
    background: var(--gradient-1);
}

.avatar-section .section-title svg {
    color: var(--accent-light);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group textarea,
.form-group select {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 16px;
    font-size: 14px;
    color: var(--text-primary);
    font-family: inherit;
    transition: all 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.04);
    box-shadow: 0 0 0 3px var(--glow);
}

/* Placeholder styles */
.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

.form-group input[type="password"] {
    color: var(--text-primary);
    font-family: inherit;
}

/* Form validation styles */
.form-group input:user-invalid,
.form-group textarea:user-invalid {
    border-color: var(--error);
    background: rgba(239, 68, 68, 0.05);
}

.form-group input:user-invalid:focus,
.form-group textarea:user-invalid:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

.form-group input:user-valid {
    border-color: var(--success);
}

/* Focus visible for accessibility */
.btn:focus-visible,
.toggle-password:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Smooth transitions for theme changes */
* {
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

.form-group input[readonly] {
    background: rgba(255, 255, 255, 0.01);
    cursor: not-allowed;
    opacity: 0.6;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-hint {
    font-size: 12px;
    color: var(--text-muted);
}

.char-counter {
    font-size: 12px;
    color: var(--text-muted);
    text-align: right;
}

.form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 600px) {
    .form-row-2 {
        grid-template-columns: 1fr;
    }
}

.password-input {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input input {
    width: 100%;
    padding-right: 44px;
}

.toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
    z-index: 2;
    pointer-events: auto;
    padding: 8px;
    border-radius: 8px;
}

.toggle-password:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.toggle-password:active {
    transform: translateY(-50%) scale(0.95);
}

/* Ensure SVG inside toggle button is clickable */
.toggle-password svg {
    pointer-events: none;
    display: block;
}

.form-message {
    padding: 14px 18px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    display: none;
    animation: slideDown 0.2s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.form-message.success {
    display: block;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--success);
}

.form-message.error {
    display: block;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--error);
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.btn-submit {
    background: var(--accent);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 12px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s ease;
}

.btn-submit:hover:not(:disabled) {
    background: var(--accent-light);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px var(--glow);
}

.btn-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-submit.loading .btn-text {
    display: none;
}

.btn-submit .btn-loading {
    display: none;
}

.btn-submit.loading .btn-loading {
    display: inline-flex;
}

.btn-submit .spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.unsaved-changes {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-muted);
}

/* ================= AUTH PAGES ================= */
.auth-container {
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.auth-card {
    background: var(--bg-card);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 440px;
}

.auth-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    text-align: center;
}

.auth-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 32px;
}

.auth-card .form-group {
    margin-bottom: 20px;
}

.auth-card .form-message {
    margin-bottom: 20px;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 24px;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    cursor: pointer;
}

.checkbox-group label {
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
}

.btn-submit-full {
    width: 100%;
    justify-content: center;
}

.auth-divider {
    margin: 28px 0;
    text-align: center;
    position: relative;
}

.auth-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--border);
}

.auth-divider span {
    position: relative;
    background: var(--bg-card);
    padding: 0 16px;
    font-size: 13px;
    color: var(--text-muted);
}

.auth-links {
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
}

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

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

/* ================= ERROR PAGE ================= */
.error-page {
    text-align: center;
    padding: 100px 20px;
}

.error-page h1 {
    font-size: 96px;
    font-weight: 800;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 16px;
    line-height: 1;
}

.error-page p {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

/* ================= FAVORITES PAGE ================= */
.favorites-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.favorites-count {
    font-size: 14px;
    color: var(--text-secondary);
}

.btn-clear {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 10px 18px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-clear:hover {
    background: rgba(239, 68, 68, 0.2);
    transform: translateY(-1px);
}

/* ================= TABS ================= */
.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 16px;
}

.tab {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 10px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.tab:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.tab.active {
    background: var(--accent);
    color: white;
}

/* ================= EMPTY STATE ================= */
.empty-state {
    padding: 100px 20px;
}

.empty-state svg {
    width: 80px;
    height: 80px;
    margin-bottom: 24px;
    opacity: 0.3;
}

.empty-state h3 {
    font-size: 20px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

/* ================= AVATAR UPLOAD ================= */
.avatar-upload-btn {
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.avatar-upload-btn:hover {
    transform: scale(1.05);
}

.avatar-upload-btn .spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.avatar-upload-btn svg {
    transition: transform 0.2s ease;
}

.avatar-upload-btn:hover svg {
    transform: scale(1.1);
}

.avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

/* ================= LOADING OVERLAY ================= */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 4000;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 20px;
}

.loading-overlay .spinner {
    width: 64px;
    height: 64px;
    border-width: 4px;
}

.loading-overlay p {
    font-size: 16px;
    color: var(--text-primary);
    font-weight: 500;
}

/* ================= IMAGE PREVIEW ================= */
.image-preview {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 16px;
}

/* ================= RESPONSIVE AVATAR ================= */
@media (max-width: 768px) {
    .profile-avatar {
        width: 100px;
        height: 100px;
        font-size: 30px;
        overflow: visible;
    }
}

/* Mobile responsive for users grid */
@media (max-width: 600px) {
    .users-grid {
        grid-template-columns: 1fr;
    }

    .user-card {
        padding: 16px;
    }

    .user-avatar-large {
        width: 48px;
        height: 48px;
    }

    .user-avatar-large .avatar-initials {
        width: 48px;
        height: 48px;
        font-size: 16px;
    }

    .messages-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .messages-header .btn {
        width: 100%;
        justify-content: center;
    }

    /* Mobile header nav */
    .header-nav {
        gap: 4px;
        margin-right: 8px;
    }

    .header-nav .nav-link {
        width: 36px;
        height: 36px;
    }
}
}

/* ===== Users Page Improvements ===== */
.users-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.users-controls {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.search-form {
    display: flex;
    gap: 8px;
    align-items: center;
}

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

.search-input-wrapper svg {
    position: absolute;
    left: 12px;
    color: var(--text-muted);
    pointer-events: none;
}

.search-input {
    width: 260px;
    padding: 10px 36px 10px 40px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

/* Светлая тема - поле поиска */
[data-theme="light"] .search-input {
    background: rgba(0, 0, 0, 0.03);
    color: var(--text-primary);
}

[data-theme="light"] .search-input::placeholder {
    color: var(--text-muted);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.search-clear {
    position: absolute;
    right: 8px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.search-clear:hover {
    color: var(--text-primary);
}

.btn-search {
    padding: 10px 20px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.btn-search:hover {
    background: var(--accent-light);
    transform: translateY(-1px);
}

/* Светлая тема - кнопка поиска */
[data-theme="light"] .btn-search {
    background: var(--accent);
    color: white;
}

[data-theme="light"] .btn-search:hover {
    background: var(--accent-light);
}

.sort-select {
    padding: 10px 36px 10px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    transition: border-color 0.2s;
}

.sort-select:focus {
    outline: none;
    border-color: var(--primary);
}

.users-stats {
    margin-bottom: 20px;
}

.users-count {
    font-size: 14px;
    color: var(--text-muted);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 32px;
    padding: 20px 0;
}

.pagination-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 14px;
    text-decoration: none;
    transition: background 0.2s, border-color 0.2s;
}

.pagination-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--primary);
}

.pagination-numbers {
    display: flex;
    gap: 6px;
}

.pagination-number {
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 14px;
    text-decoration: none;
    transition: all 0.2s;
}

.pagination-number:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--primary);
}

.pagination-number.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    font-weight: 600;
}

/* Responsive */
@media (max-width: 768px) {
    .users-header {
        flex-direction: column;
    }
    
    .users-controls {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-form {
        flex-direction: column;
    }
    
    .search-input-wrapper {
        width: 100%;
    }
    
    .search-input {
        width: 100%;
    }
    
    .btn-search {
        width: 100%;
    }
    
    .sort-select {
        width: 100%;
    }
}

/* ===== Header Navigation Improvements ===== */
.profile-nav-link {
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.profile-nav-link:hover {
    border-color: var(--border);
    background: rgba(255, 255, 255, 0.03);
}

.profile-nav-link.active {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.15);
}

/* Tooltip для навигации */
.header-nav .nav-link {
    position: relative;
}

.header-nav .nav-link:hover::after {
    content: attr(title);
    position: absolute;
    bottom: -32px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 12px;
    white-space: nowrap;
    border: 1px solid var(--border);
    box-shadow: 0 4px 12px var(--shadow);
    z-index: 100;
    pointer-events: none;
}

/* ===== Users Page Light Theme Fixes ===== */
[data-theme="light"] .users-grid {
    gap: 16px;
}

[data-theme="light"] .user-card {
    background: var(--bg-card);
    border-color: var(--border);
}

[data-theme="light"] .user-card:hover {
    background: var(--bg-secondary);
    border-color: var(--accent);
}

[data-theme="light"] .search-input-wrapper svg {
    color: var(--text-muted);
}

[data-theme="light"] .sort-select {
    background-color: rgba(0, 0, 0, 0.03);
}

[data-theme="light"] .pagination-btn,
[data-theme="light"] .pagination-number {
    background: rgba(0, 0, 0, 0.03);
}

[data-theme="light"] .pagination-btn:hover,
[data-theme="light"] .pagination-number:hover {
    background: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .pagination-number.active {
    background: var(--accent);
}
