/* Основные стили для Mesme */

/* Чат интерфейс */
.chat-container {
    height: calc(100vh - 80px);
    display: flex;
}

.chat-sidebar {
    width: 350px;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Список контактов */
.contacts-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.contacts-search {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 15px;
    width: 100%;
    color: var(--text-primary);
}

.contacts-search:focus {
    outline: none;
    border-color: var(--primary);
}

.contacts-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.contact-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 5px;
}

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

.contact-item.active {
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.contact-info {
    flex: 1;
    margin-left: 12px;
    overflow: hidden;
}

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

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

.contact-meta {
    text-align: right;
    margin-left: 10px;
}

.contact-time {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.unread-badge {
    background: var(--primary);
    color: white;
    font-size: 12px;
    font-weight: 600;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Область сообщений */
.chat-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-user-info {
    display: flex;
    align-items: center;
}

.chat-status {
    font-size: 13px;
    color: var(--text-muted);
}

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

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: var(--bg-dark);
}

.message-date {
    text-align: center;
    margin: 20px 0;
}

.message-date span {
    background: var(--bg-surface);
    color: var(--text-muted);
    font-size: 12px;
    padding: 5px 15px;
    border-radius: 15px;
}

.message-container {
    display: flex;
    margin-bottom: 15px;
}

.message-container.sent {
    justify-content: flex-end;
}

.message-container.received {
    justify-content: flex-start;
}

.message-bubble {
    max-width: 65%;
    padding: 12px 16px;
    border-radius: 18px;
    position: relative;
}

.message-bubble.sent {
    background: var(--gradient-primary);
    color: white;
    border-bottom-right-radius: 5px;
}

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

.message-text {
    word-wrap: break-word;
    line-height: 1.5;
}

.message-time {
    font-size: 11px;
    opacity: 0.8;
    margin-top: 5px;
    text-align: right;
}

.message-status {
    font-size: 11px;
    opacity: 0.8;
    margin-left: 5px;
}

/* Форма ввода сообщения */
.chat-input-area {
    padding: 20px;
    border-top: 1px solid var(--border);
    background: var(--bg-card);
}

.message-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: center;
}

.message-attachments {
    display: flex;
    gap: 5px;
}

.message-input {
    flex: 1;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 25px;
    padding: 12px 20px;
    color: var(--text-primary);
    font-size: 15px;
}

.message-input:focus {
    outline: none;
    border-color: var(--primary);
}

.send-button {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--gradient-primary);
    border: none;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.send-button:hover {
    transform: scale(1.05);
}

/* Анимации */
@keyframes messageIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-container {
    animation: messageIn 0.3s ease-out;
}

/* Уведомления */
.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger);
    color: white;
    font-size: 11px;
    font-weight: 600;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-card);
}

/* Загрузка */
.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s linear infinite;
}

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

/* Адаптивность */
@media (max-width: 768px) {
    .chat-container {
        height: calc(100vh - 60px);
    }
    
    .chat-sidebar {
        width: 100%;
    }
    
    .message-bubble {
        max-width: 85%;
    }
    
    .auth-wrapper {
        padding: 20px;
    }
    
    .card {
        border-radius: 15px !important;
    }
}

/* Тёмная тема для светлого режима */
[data-bs-theme="light"] {
    --bg-dark: #f8fafc;
    --bg-card: #ffffff;
    --bg-surface: #f1f5f9;
    --bg-hover: rgba(99, 102, 241, 0.05);
    
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #64748b;
    
    --border: rgba(148, 163, 184, 0.2);
}

/* Утилиты */
.hover-lift {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.cursor-pointer {
    cursor: pointer;
}

.transition-all {
    transition: all 0.3s ease;
}

/* Кастомные стили для форм */
.input-group:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.25rem rgba(99, 102, 241, 0.25);
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.25rem rgba(99, 102, 241, 0.25);
}

/* Кастомные кнопки */
.btn {
    border-radius: 12px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-lg {
    border-radius: 15px;
    padding: 12px 30px;
}

.btn-primary {
    background: var(--gradient-primary);
    border: none;
}

.btn-primary:hover {
    background: var(--gradient-primary);
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.btn-outline-primary {
    border: 2px solid var(--primary);
    color: var(--primary);
}

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

/* Специальные классы */
.glass-effect {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.shadow-soft {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.rounded-xl {
    border-radius: 20px;
}

.rounded-2xl {
    border-radius: 30px;
}

/* Иконки */
.icon-wrapper {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-surface);
    color: var(--text-secondary);
}

.icon-wrapper-primary {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
}

.icon-wrapper-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.icon-wrapper-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.icon-wrapper-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

/* Декоративные элементы */
.decoration-circle {
    position: absolute;
    border-radius: 50%;
    background: var(--gradient-primary);
    opacity: 0.1;
    filter: blur(40px);
    z-index: -1;
}

.decoration-circle-1 {
    width: 300px;
    height: 300px;
    top: -150px;
    right: -150px;
}

.decoration-circle-2 {
    width: 200px;
    height: 200px;
    bottom: -100px;
    left: -100px;
    background: var(--gradient-accent);
}