/* ═══════════════════════════════════════
   ТАБ: СОН — стартовый экран, чат,
   сообщения, ввод, аватарка, typing
   ═══════════════════════════════════════ */

/* ─── Стартовый экран ─── */
.dream-start {
    text-align: center;
    padding: 40px 24px;
    background: radial-gradient(ellipse at center, rgba(232,130,14,0.07) 0%, transparent 70%);
    border-radius: var(--radius-2xl);
}
.dream-start-icon {
    font-size: 52px;
    margin-bottom: 16px;
    filter: drop-shadow(0 0 24px var(--accent-glow));
}
.dream-start h2 {
    font-family: var(--font-display);
    font-size: 26px;
    color: var(--text-primary);
    margin: 0 0 10px;
    font-weight: 600;
}
.dream-start p {
    color: var(--text-muted);
    font-size: 14px;
    margin: 0 0 36px;
    line-height: 1.6;
}
.dream-start-btns {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 280px;
    margin: 0 auto;
}

/* ─── Чат — каркас ─── */
.chat-wrap {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}
.chat-header {
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(232,130,14,0.08);
    background: rgba(10,8,15,0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    flex-shrink: 0;
    z-index: 10;
}
.chat-back {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 22px;
    cursor: pointer;
    padding: 4px 8px 4px 0;
}
.chat-header-info { flex: 1; }
.chat-header-name {
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 600;
    font-family: var(--font-display);
}
.chat-header-sub {
    color: var(--text-dim);
    font-size: 11px;
}
.chat-header-balance {
    background: rgba(232,130,14,0.1);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    color: var(--accent);
    font-size: 12px;
    font-weight: 600;
}

/* ─── Область сообщений ─── */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 16px 10px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.chat-empty {
    text-align: center;
    padding: 60px 24px;
}
.chat-empty-icon {
    font-size: 36px;
    margin-bottom: 14px;
    opacity: 0.5;
}
.chat-empty p {
    color: var(--text-dim);
    font-size: 14px;
    line-height: 1.6;
}

/* ─── Бабблы сообщений ─── */
.msg { animation: slideUp 0.35s ease-out; }

.msg-user {
    display: flex;
    justify-content: flex-end;
}
.msg-user-bubble {
    max-width: 82%;
    padding: 12px 16px;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    border-radius: 18px 18px 4px 18px;
    color: #fff;
}

.msg-bot {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}
.msg-bot-bubble {
    max-width: 82%;
    padding: 14px 16px;
    background: rgba(40,30,52,0.75);
    border-radius: 18px 18px 18px 4px;
    border: 1px solid var(--accent-border);
    color: #e8ddd0;
}

.msg-text {
    font-size: 14px;
    line-height: 1.7;
    white-space: pre-wrap;
    word-wrap: break-word;
}
.msg-time {
    font-size: 10px;
    opacity: 0.4;
    text-align: right;
    margin-top: 6px;
}
.msg-user .msg-time { opacity: 0.6; }

/* ─── Аватарка Морфея ─── */
.morpheus-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1a0a2e, #2d1b4e);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid rgba(232,130,14,0.6);
    flex-shrink: 0;
    box-shadow: 0 0 10px rgba(232,130,14,0.2);
    font-size: 15px;
}
.morpheus-avatar-lg {
    width: 34px;
    height: 34px;
    font-size: 17px;
}

/* ─── Индикатор набора ─── */
.typing {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}
.typing-dots {
    background: rgba(40,30,52,0.75);
    padding: 14px 22px;
    border-radius: 18px 18px 18px 4px;
    border: 1px solid var(--accent-border);
    display: flex;
    gap: 6px;
}
.typing-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
}
.typing-dot:nth-child(1) { animation: pulse 1.2s ease-in-out 0s infinite; }
.typing-dot:nth-child(2) { animation: pulse 1.2s ease-in-out 0.2s infinite; }
.typing-dot:nth-child(3) { animation: pulse 1.2s ease-in-out 0.4s infinite; }

/* ─── Кнопка "Новый сон" ─── */
.btn-new-dream {
    background: var(--accent-subtle);
    border: 1px solid rgba(232,130,14,0.15);
    border-radius: var(--radius-md);
    padding: 12px;
    color: var(--accent);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    font-family: var(--font-body);
    transition: all 0.25s;
    width: 100%;
}

/* ─── Поле ввода (чат) ─── */
.chat-input-bar {
    padding: 10px 16px 16px;
    border-top: 1px solid rgba(232,130,14,0.06);
    background: rgba(10,8,15,0.95);
    display: flex;
    gap: 10px;
    align-items: flex-end;
    flex-shrink: 0;
}
.chat-input {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--accent-border);
    border-radius: 22px;
    padding: 12px 18px;
    color: #e8ddd0;
    font-size: 15px;
    resize: none;
    outline: none;
    font-family: var(--font-body);
    height: 48px;
    max-height: 120px;
    line-height: 1.4;
    transition: border-color 0.2s;
    overflow: hidden;
    -webkit-appearance: none;
    appearance: none;
}
.chat-input:focus {
    border-color: var(--accent-border-hover);
}
/* ─── Кнопка отправки ─── */
.chat-send {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    background: rgba(232,130,14,0.12);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    flex-shrink: 0;
    padding: 0;
}
.chat-send svg {
    width: 22px;
    height: 22px;
    stroke: #fff;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}
.chat-send.active {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    box-shadow: 0 2px 12px rgba(232,130,14,0.3);
}

/* ─── Нижний отступ для таб-бара в чате ─── */

/* ─── Voice Record Bar ─── */
.voice-record-bar {
    padding: 10px 16px 14px;
    border-top: 1px solid rgba(232,130,14,0.06);
    background: rgba(10,8,15,0.95);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    animation: fadeIn 0.2s ease-out;
}
.voice-rec-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #e03e3e;
    flex-shrink: 0;
    animation: voicePulse 1s ease-in-out infinite;
}
@keyframes voicePulse {
    0%,100% { opacity:1; transform:scale(1); }
    50% { opacity:0.4; transform:scale(0.7); }
}
#voiceTimer {
    color: #e03e3e;
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font-display);
    min-width: 34px;
}
.voice-cancel-btn {
    background: rgba(232,130,14,0.08);
    border: 1px solid rgba(232,130,14,0.15);
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 13px;
    padding: 6px 12px;
    cursor: pointer;
    flex-shrink: 0;
}
/* Кнопка микрофона активная (запись) */
.chat-send.recording {
    background: rgba(224,62,62,0.2);
    animation: recordGlow 1.2s ease-in-out infinite;
}
@keyframes recordGlow {
    0%,100% { box-shadow: 0 0 0 0 rgba(224,62,62,0); }
    50% { box-shadow: 0 0 12px 4px rgba(224,62,62,0.25); }
}

/* ─── Joint invite banner ─── */
.joint-invite-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(150,100,232,0.1);
    border: 1px solid rgba(150,100,232,0.2);
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    text-align: left;
}
.joint-invite-icon { font-size: 24px; flex-shrink: 0; }
.btn-accent-sm {
    background: rgba(150,100,232,0.15);
    border: 1px solid rgba(150,100,232,0.25);
    border-radius: 8px;
    color: #b894f5;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}
