

.chat-interface {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 1200px;
    margin: 0 auto;
    background: linear-gradient(to bottom, #f9fafb 0%, #ffffff 100%);
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.08);
    border-radius: 28px;
    padding: 0.75rem 0.75rem 1rem;
}

/* Header styles */
.chat-header { 
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
    border-radius: 20px 20px 0 0;
    margin-bottom: 0.5rem;
}

.chat-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #111827;
}

.new-session-button {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

.new-session-button:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
    transform: translateY(-1px);
}

.new-session-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

.chat-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: #111827;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #6b7280;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ef4444;
    animation: pulse 2s infinite;
}

.connection-status.connected .status-dot {
    background: #10b981;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.error-message {
    margin-top: 0.5rem;
    padding: 0.75rem;
    background: #fee2e2;
    color: #dc2626;
    border-radius: 0.5rem;
    font-size: 0.875rem;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 2rem 1.5rem;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    scroll-behavior: smooth;
}

.empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #9ca3af;
    font-size: 1.125rem;
}

.welcome-message {
    display: block;
    margin-bottom: 1rem;
}

.welcome-message .message {
    animation: none; /* Прибираємо анімацію для початкового повідомлення */
}

.message {
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.3s ease-in;
    gap: 0.25rem;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    align-items: flex-end;
}

.message.assistant {
    align-items: flex-start;
}

.message-content {
    display: flex;
    gap: 0;
    max-width: 78%;
    align-items: flex-start;
}

.message.user .message-content {
    flex-direction: row-reverse;
}

.message-avatar {
    display: none !important;
}




.user-avatar {
    background: #3b82f6;
}

.assistant-avatar {
    background: #10b981;
}

.message-text {
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    line-height: 1.5;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.message.user .message-text {
    background: #2563eb;
    color: #ffffff;
    border: none;
    border-bottom-right-radius: 0.25rem;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.18);
}

.message.assistant .message-text {
    background: #ffffff;
    color: #111827;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 0.25rem;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}

.message.error .message-text {
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.message.system .message-text {
    background: #f3f4f6;
    color: #6b7280;
    border: 1px solid #d1d5db;
    font-style: italic;
    text-align: center;
    border-radius: 0.75rem;
}

.streaming-cursor {
    display: inline-block;
    width: 2px;
    height: 1.2em;
    background: #3b82f6;
    margin-left: 2px;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 0.75rem 1rem;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #9ca3af;
    animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

.chat-input-container {
    border-top: 1px solid #e5e7eb;
    background: transparent;
    padding: 1.25rem 1.5rem;
}

.selected-files {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e5e7eb;
}

.file-preview {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: #f3f4f6;
    border-radius: 0.5rem;
    font-size: 0.875rem;
}

.file-name {
    color: #374151;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.remove-file {
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.remove-file:hover {
    background: #e5e7eb;
    color: #111827;
}

.chat-input-container {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e5e7eb;
    background: #ffffff;
}

.chat-input-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    padding: 0.8rem 0.85rem 0.8rem 0.75rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
    box-shadow: 0 12px 34px rgba(17, 24, 39, 0.08);
    position: relative;
}

.voice-waveform-full {
    display: none;
    flex: 1;
    height: 100%;
    border: none;
    background: transparent;
}

.voice-waveform-full.recording {
    display: block;
}

.chat-input-wrapper:focus-within {
    border-color: #111827;
    box-shadow: 0 16px 40px rgba(17, 24, 39, 0.16);
    transform: translateY(-1px);
}

.icon-button {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    color: #111827;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    font-weight: 600;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease, background 0.2s ease;
    box-shadow: 0 4px 10px rgba(17, 24, 39, 0.08);
    line-height: 0;
}

.icon-button:hover {
    border-color: #111827;
    background: #f9fafb;
    box-shadow: 0 6px 14px rgba(17, 24, 39, 0.12);
}

.icon-button:active {
    transform: translateY(0);
}

.input-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.attach-button {
    position: relative;
    overflow: hidden;
}

.attach-label {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.35rem;
    font-weight: 700;
    color: inherit;
}

.icon-button img {
    width: 22px;
    height: 22px;
    object-fit: contain;
    display: block;
}

.voice-button {
    width: 56px;
    height: 56px;
    position: relative;
    overflow: visible;
}

.voice-button img {
    position: relative;
    z-index: 2;
    transition: opacity 0.2s ease;
}

.voice-waveform {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.voice-button.recording .voice-waveform {
    opacity: 1;
}

.voice-button.recording img {
    opacity: 0.3;
}

.chat-input {
    flex: 1;
    border: none;
    background: transparent;
    resize: none;
    outline: none;
    font-size: 1.05rem;
    line-height: 1.5;
    padding: 0.35rem 0;
    max-height: 120px;
    font-family: inherit;
    color: #0f172a;
    min-height: 32px;
}

.chat-input::placeholder {
    color: #9ca3af;
    font-weight: 500;
    letter-spacing: 0.01em;
}

.voice-button.recording {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #b91c1c;
    box-shadow: 0 8px 18px rgba(239, 68, 68, 0.35);
    animation: pulse-red 1.5s infinite;
}

@keyframes pulse-red {
    0%, 100% { background: #fee2e2; }
    50% { background: #fecaca; }
}

.send-button {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: #0f172a;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    box-shadow: 0 14px 30px rgba(17, 24, 39, 0.28);
    flex-shrink: 0;
}

.send-button:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 18px 40px rgba(17, 24, 39, 0.32);
    background: #111827;
}

.send-button:disabled {
    background: #cbd5e1;
    color: #ffffff;
    cursor: not-allowed;
    box-shadow: none;
}

.send-button.loading {
    position: relative;
}

.send-button.loading .wave-icon,
.send-button.loading .arrow-icon {
    opacity: 0;
}

.send-button.loading::after {
    content: '';
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.35);
    border-top-color: #ffffff;
    animation: spin 0.9s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.wave-icon {
    display: flex;
    align-items: flex-end;
    gap: 4px;
}

.wave-icon span {
    width: 4px;
    height: 12px;
    background: #ffffff;
    border-radius: 2px;
    display: block;
    animation: wavePulse 1.1s ease-in-out infinite;
}

.wave-icon span:nth-child(2) {
    height: 18px;
    animation-delay: 0.12s;
}

.wave-icon span:nth-child(3) {
    height: 14px;
    animation-delay: 0.24s;
}

@keyframes wavePulse {
    0%, 100% { transform: scaleY(0.55); opacity: 0.9; }
    50% { transform: scaleY(1); opacity: 1; }
}

.arrow-icon {
    width: 56px;
    height: 56px;
    color: #ffffff;
    display: none;
    transition: transform 0.2s ease;
}

.stop-icon {
    font-size: 20px;
    color: #ffffff;
    display: none;
    font-weight: 600;
    user-select: none;
    transition: transform 0.2s ease;
}

.send-button:hover:not(:disabled) .arrow-icon,
.send-button:hover:not(:disabled) .stop-icon {
    transform: translateY(-2px);
}

.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.recording-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    position: relative;
    z-index: 2;
}

.control-button {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: #0f172a;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    flex-shrink: 0;
    padding: 0;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.2);
}

.control-button:hover {
    background: #111b2f;
    transform: translateY(-1px);
}

.control-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.18);
}

.control-button svg {
    stroke-width: 2.6;
    width: 15px;
    height: 15px;
    stroke: currentColor;
}

/* Voice waveform in input wrapper */
.voice-waveform-full {
    display: none;
    flex: 1;
    height: 32px;
    border: none;
    background: transparent;
    margin: 0 0.75rem;
    width: 100%;
}

.voice-waveform-full.recording {
    display: block;
}

/* Notifications */
@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

.notification {
    animation: slideIn 0.3s ease;
}

.notification-success {
    background: #10b981;
}

.notification-error {
    background: #ef4444;
}

.notification-info {
    background: #3b82f6;
}

