html {
    height: 100%;
}
body {
    background: linear-gradient(-45deg, #1a140f 0%, #221b14 100%);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    height: 100%;
    color: #e8d9c5;
}
@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
.chat-header img {
    height: 50px;
    width: auto; /* сохраняет пропорции */
    object-fit: cover; /* опционально: для корректного масштабирования */
}
p, li, pre {
    font-size: 0.8rem;
    color: #e0d0c0;
}
h3 {
    font-size: 1.1rem;
    color: #f0e0c8;
}
h2 {
    font-size: 1.0rem;
    color: #e8d9c5;
}
h1 {
    font-size: 0.9rem;
    color: #f2e5d0;
}
td, th {
    font-size: 0.8rem;
    color: #e0d0c0;
}
.typing-text {
    font-size: 0.8rem;
    color: #d8c9b0;
}
#balance {
    font-size: 0.7rem;
    color: #d8c9b0;
    font-style: italic;
}
strong {
    font-size: 0.8rem;
    color: #f2e5d0;
}

.form-control::placeholder {
    color: #a89270;       /* тёплый серо-коричневый, мягкий, но читаемый */
    opacity: 1;           /* отключаем стандартное затемнение */
}

.form-control::-webkit-input-placeholder { color: #a89270; opacity: 1; }
.form-control::-moz-placeholder { color: #a89270; opacity: 1; }
.form-control:-ms-input-placeholder { color: #a89270; opacity: 1; }
.form-control:-moz-placeholder { color: #a89270; opacity: 1; }

p img {
    width: 60%;
    border-radius: 1rem;
    border: 1px solid #8b6e4d;
    box-shadow: 1px 2px 0.8rem 0 rgba(139, 110, 77, 0.5);
}

p:has(img) {
    text-align: center;
}

.chat-container {
    max-width: 800px;
    height: 100%;
    box-sizing: border-box;
    border-radius: 15px;
}

.chat-header {
    background: linear-gradient(90deg, #3a2a1f 0%, #5a422d 100%);
    background-size: 200% 200%;
    animation: headerGlow 8s ease infinite;
    color: #f5e8d0;
    padding: 0.3rem 1.6rem;
    border-radius: 15px 15px 0 0;
    border: 1px solid #6d553f;
    box-shadow: 0 4px 15px rgba(101, 67, 33, 0.5);
    position: relative;
    overflow: hidden;
}
@keyframes headerGlow {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* .chat-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(90, 111, 208, 0.1), transparent);
    animation: shimmer 8s ease-in-out infinite;
}
@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
} */

.chat-messages {
    height: calc(50vh);
    overflow-y: auto;
    background-color: #1f1810;
    border-right: 1px solid #4a3a2a;
    border-left: 1px solid #4a3a2a;
}

.message {
    max-width: 80%;
    padding: 0.5rem 0.8rem 0 0.8rem;
    border-radius: 15px;
    border: 1px solid #5a4835;
    position: relative;
    word-wrap: break-word;
    opacity: 0;
    transform: translateY(10px);
    animation: messageAppear 0.4s ease-out forwards;
    box-shadow: 0 4px 10px rgba(90, 65, 40, 0.4);
    margin-bottom: 1rem;
    color: #e8d9c5;
}

@keyframes messageAppear {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-messages::-webkit-scrollbar {
    width: 10px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #1f1810;
    border-radius: 5px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: linear-gradient(to bottom, #5a422d, #7a5a3a);
    border-radius: 5px;
    border: 2px solid #1f1810;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(to bottom, #7a5a3a, #b08c5d);
}

.chat-messages {
    scrollbar-width: thin;
    scrollbar-color: #7a5a3a #1f1810;
}

.user-message {
    background: linear-gradient(135deg, #2a2016 0%, #3a2d1e 100%);
    margin-left: auto;
    border-bottom-right-radius: 0;
    box-shadow: 0 4px 15px rgba(140, 90, 50, 0.3);
    border: 1px solid #6b4922;
}

.ai-message {
    background: linear-gradient(135deg, #251e15 0%, #32281b 100%);
    margin-right: auto;
    border-bottom-left-radius: 0;
    box-shadow: 0 4px 15px rgba(110, 80, 50, 0.3);
    border: 1px solid #635545;
}

.message:hover .copy-btn {
    opacity: 1;
}

.copy-btn {
    position: absolute;
    right: 5px;
    bottom: 5px;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    background: rgba(40, 30, 20, 0.8);
    border: none;
    border-radius: 50%;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 3px 4px 8px 0 rgba(101, 67, 33, 0.5);
    color: #e0c8a0;
}

.copy-btn:hover {
    transform: scale(1.1);
    background: #3a2d1e;
    box-shadow: 0 6px 12px rgba(139, 110, 77, 0.4);
}

.typing-indicator {
    display: flex;
    align-items: center;
    padding: 0.6rem 1.2rem;
    background: transparent;
    border: 1px solid #5a4835;
    border-radius: 15px;
    width: fit-content;
    box-shadow: 0px 0px 10px rgba(140, 110, 70, 0.4);
    transform: scale(0.7);
    opacity: 0;
    animation: typingAppear 0.8s ease-out forwards;
}

@keyframes typingAppear {
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.typing-dot {
    width: 10px;
    height: 10px;
    background: linear-gradient(135deg, #b08c5d 0%, #d4a06a 100%);
    border-radius: 50%;
    margin: 0 4px;
    box-shadow: 0 2px 4px rgba(180, 130, 80, 0.5);
    animation: typingAnimation 1.4s infinite ease-in-out;
}

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

@keyframes typingAnimation {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-5px); }
}

.input-container {
    background: #1f1810;
    border-bottom-left-radius: 1rem;
    border-bottom-right-radius: 1rem;
    border-left: 1px solid #4a3a2a;
    border-right: 1px solid #4a3a2a;
    border-bottom: 1px solid #4a3a2a;
}

.btn {
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    border-radius: 12px;
    border: 1px solid #33220f;
    box-shadow: 0 4px 8px rgba(44, 29, 13, 0.4);
    color: #f5e8d0;
}

.btn-dark {
    margin-left: 0.5rem;
    background: linear-gradient(180deg, #4a3522 0%, #52371f 100%);
}

.btn:hover {
    transform: scale(0.95);
    box-shadow: 0 6px 12px rgba(156, 113, 63, 0.5);
}

#sendBtn {
    background: linear-gradient(180deg, #755232 0%, #5f4022 100%);
    box-shadow: none;
    border: none;
}

#sendBtn:hover {
    color: #ffd7a0; /* чуть ярче при наведении */
    transform: scale(0.97);
    box-shadow: 0 6px 12px rgba(56, 40, 22, 0.5);
}

.form-control {
    border-radius: 15px;
    border: none;
    border-top: 1px solid #5a4835;
    transition: all 0.3s;
    padding: 0.8rem 1rem;
    font-size: 0.8rem;
    background-color: #2a2016; /* тёплый тёмный фон */
    color: #e8d9c5;            /* тёплый светлый текст */
    caret-color: #d4b895;      /* цвет курсора — мягкий янтарный */
}

.form-control:focus {
    outline: none;
    border-color: #836845;
    background-color: #2e2418;
    color: #f0e0c8;
    box-shadow: 0 0 0 0.20rem rgba(176, 140, 93, 0.4);
}

.message::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 15px;
    background: linear-gradient(135deg, rgba(90, 111, 208, 0.1), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.message:hover::after {
    opacity: 1;
}