/* style.css (Complete Redesign) */

:root {
    --bg-color: #11101D;
    --surface-color: #1D1B31;
    --primary-text-color: #E4E3E9;
    --secondary-text-color: #8D8B9B;
    --accent-gradient: linear-gradient(110deg, #FF7B4B, #FF45A3);
    --accent-text-color: #FFFFFF;
    --font-family: 'Inter', sans-serif;
}

/* --- Basic Setup & Custom Scrollbar --- */
* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--primary-text-color);
    overscroll-behavior: none;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover { background-color: rgba(255, 255, 255, 0.2); }

/* --- Main Layout --- */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100%;
    max-width: 820px;
    margin: 0 auto;
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    flex-shrink: 0;
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.icon-button {
    background: none;
    border: none;
    color: var(--secondary-text-color);
    padding: 0.5rem;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    transition: background-color 0.2s, color 0.2s;
}
.icon-button:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--primary-text-color);
}

.search-input {
    background-color: var(--surface-color);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--primary-text-color);
    border-radius: 8px;
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
    width: 0px;
    padding-left: 0;
    padding-right: 0;
    opacity: 0;
    border-color: transparent;
    transition: all 0.3s ease;
}
.search-input.active {
    width: 180px;
    opacity: 1;
    padding-left: 0.8rem;
    padding-right: 0.8rem;
    border-color: rgba(255,255,255,0.1);
}
.search-input:focus {
    outline: none;
    border-color: #FF7B4B;
}

.chat-log {
    flex-grow: 1;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.message {
    display: flex;
    gap: 1rem;
    max-width: 85%;
    align-items: flex-start;
}
.message[data-visible="false"] {
    display: none;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
}

.ai-message { align-self: flex-start; }
.ai-message .avatar {
    background-color: var(--surface-color);
    border: 1px solid rgba(255,255,255,0.1);
}
.ai-message .avatar-glow {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-gradient);
    filter: blur(8px);
    opacity: 0.6;
}

.user-message { align-self: flex-end; }

.message-content {
    background-color: var(--surface-color);
    padding: 0.8rem 1.2rem;
    border-radius: 12px;
}
.user-message .message-content {
    background: var(--accent-gradient);
    color: var(--accent-text-color);
}
.message-content p {
    margin: 0;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
}
.message-content p:not(:last-child) {
    margin-bottom: 1rem;
}


/* --- Input Area --- */
.input-area-footer {
    padding: 1rem 1.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    flex-shrink: 0;
}
.loading-indicator {
    display: flex;
    padding-bottom: 0.5rem;
}
.dot-flashing {
  position: relative;
  width: 8px; height: 8px;
  border-radius: 5px;
  background-color: var(--secondary-text-color);
  color: var(--secondary-text-color);
  animation: dot-flashing 1s infinite linear alternate;
  animation-delay: .5s;
}
.dot-flashing::before, .dot-flashing::after {
  content: '';
  display: inline-block;
  position: absolute;
  top: 0;
  width: 8px; height: 8px;
  border-radius: 5px;
  background-color: var(--secondary-text-color);
  color: var(--secondary-text-color);
}
.dot-flashing::before {
  left: -15px;
  animation: dot-flashing 1s infinite alternate;
  animation-delay: 0s;
}
.dot-flashing::after {
  left: 15px;
  animation: dot-flashing 1s infinite alternate;
  animation-delay: 1s;
}
@keyframes dot-flashing { 0% { opacity: 0; } 50%, 100% { opacity: 1; } }

.chat-form {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    background-color: var(--surface-color);
    border-radius: 12px;
    padding: 0.5rem;
    border: 1px solid var(--surface-color);
    transition: border-color 0.2s;
}
.chat-form:focus-within {
    border-color: #4A485E;
}

#user-input {
    flex-grow: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--primary-text-color);
    font-family: var(--font-family);
    font-size: 1rem;
    padding: 0.5rem;
    resize: none;
    line-height: 1.5;
    max-height: 200px;
}
#user-input::placeholder {
    color: var(--secondary-text-color);
}

.send-button {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background: var(--accent-gradient);
    color: var(--accent-text-color);
    border: none;
    cursor: pointer;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
    transition: transform 0.1s ease;
}
.send-button:hover { transform: scale(1.05); }
.send-button:active { transform: scale(0.98); }
.send-button svg {
    position: relative;
    z-index: 2;
    transform: rotate(-45deg);
    transition: transform 0.3s ease;
}
.send-button .glow-effect {
    stroke: white;
    filter: blur(4px);
    opacity: 0.7;
}
#user-input:not(:placeholder-shown) + .send-button svg {
    transform: rotate(0deg);
}