html {
    height: 100%;
}
body {
    background: linear-gradient(-45deg, #f5f5f5 0%, #fafafa 100%);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    height: 100%;
    color: #333333;
}
@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
.chat-header img {
    height: 52px;
    width: auto;
    object-fit: cover;
}
p, li, pre {
    font-size: 0.8rem;
    color: #444444;
}
h3 {
    font-size: 1.0rem;
    color: #222222;
}
h2 {
    font-size: 1.0rem;
    color: #2a2a2a;
}
h1 {
    font-size: 0.9rem;
    color: #1a1a1a;
}
td, th {
    font-size: 0.8rem;
    color: #3a3a3a;
}
.typing-text {
    font-size: 0.8rem;
    color: #555555;
}
#balance {
    font-size: 0.7rem;
    color: #404040;
    font-style: italic;
}
strong {
    font-size: 0.8rem;
    color: #222222;
}

.form-control::placeholder {
    color: #999999;
    opacity: 1;
}

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

p img {
    width: 60%;
    border-radius: 1rem;
    border: 1px solid #cccccc;
    box-shadow: 1px 2px 0.8rem 0 rgba(200, 200, 200, 0.3);
    filter: grayscale(100%) contrast(110%);
}

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

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

.chat-header {
    background: linear-gradient(90deg, #e8e8e8 0%, #f0f0f0 100%);
    background-size: 200% 200%;
    animation: headerGlow 8s ease infinite;
    color: #333333;
    padding: 0.3rem 1.6rem;
    border-radius: 15px 15px 0 0;
    border: 1px solid #c8c8c8;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
}
@keyframes headerGlow {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

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

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

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

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

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

.chat-messages::-webkit-scrollbar-thumb {
    background: linear-gradient(to bottom, #d0d0d0, #c0c0c0);
    border-radius: 5px;
    border: 2px solid #f8f8f8;
}

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

.chat-messages {
    scrollbar-width: thin;
    scrollbar-color: #c0c0c0 #f8f8f8;
}

.user-message {
    background: linear-gradient(135deg, #f0f0f0 0%, #f8f8f8 100%);
    margin-left: auto;
    border-bottom-right-radius: 0;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
    border: 1px solid #d8d8d8;
    color: #2a2a2a;
}

.ai-message {
    background: linear-gradient(135deg, #f8f8f8 0%, #ffffff 100%);
    margin-right: auto;
    border-bottom-left-radius: 0;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.03);
    border: 1px solid #e0e0e0;
    color: #2a2a2a;
}

.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(255, 255, 255, 0.9);
    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(0, 0, 0, 0.08);
    color: #666666;
    border: 1px solid #e0e0e0;
}

.copy-btn:hover {
    transform: scale(1.1);
    background: #ffffff;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
    color: #333333;
    border-color: #cccccc;
}

.typing-indicator {
    display: flex;
    align-items: center;
    padding: 0.6rem 1.2rem;
    background: transparent;
    border: 1px solid #e0e0e0;
    border-radius: 15px;
    width: fit-content;
    box-shadow: 0px 0px 10px rgba(200, 200, 200, 0.2);
    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, #888888 0%, #666666 100%);
    border-radius: 50%;
    margin: 0 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    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: #ffffff;
    border-bottom-left-radius: 1rem;
    border-bottom-right-radius: 1rem;
    border-left: 1px solid #c8c8c8;
    border-right: 1px solid #c8c8c8;
    border-bottom: 1px solid #c8c8c8;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.02);
}

.btn {
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    border-radius: 12px;
    border: 1px solid #b0b0b0;
    box-shadow: 2px 3px 4px rgba(0, 0, 0, 0.15);
    color: #333333;
}

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

.btn:hover {
    transform: scale(0.95);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

#sendBtn {
    background: linear-gradient(180deg, #f0f0f0 0%, #e8e8e8 100%);
    box-shadow: none;
    border: 1px solid #d8d8d8;
    color: #444444;
}

#sendBtn:hover {
    color: #222222;
    transform: scale(0.97);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.06);
    background: linear-gradient(180deg, #f8f8f8 0%, #f0f0f0 100%);
}

.form-control {
    border-radius: 15px;
    border: none;
    border-top: 1px solid #c8c8c8;
    transition: all 0.3s;
    padding: 0.8rem 1rem;
    font-size: 0.8rem;
    background-color: #f8f8f8;
    color: #333333;
    caret-color: #666666;
}

.form-control:focus {
    outline: none;
    border-color: #a5a5a5;
    background-color: #ffffff;
    color: #222222;
    box-shadow: 0 0 0 0.20rem rgba(200, 200, 200, 0.2);
}

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

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

.form-control::selection {
    background-color: rgba(200, 200, 200, 0.3);
    color: #222222;
}

.typing-indicator span {
    color: #555555;
    font-weight: 500;
}