:root {
    --bg-color: #0f172a; /* Slate 900 */
    --surface-color: #1e293b; /* Slate 800 */
    --primary-color: #10b981; /* Emerald 500 */
    --primary-hover: #059669; /* Emerald 600 */
    --text-main: #f8fafc; /* Slate 50 */
    --text-muted: #94a3b8; /* Slate 400 */
    --border-color: #334155; /* Slate 700 */
    --ai-bubble: #1e293b;
    --user-bubble: #10b981;
    --danger-color: #ef4444;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

.app-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 600px;
    height: 100%;
    background-color: var(--bg-color);
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
}

.app-header {
    padding: 1rem;
    background-color: rgba(30, 41, 59, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    text-align: center;
    z-index: 10;
}

.header-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: var(--primary-color);
}

.header-title h1 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-main);
}

.header-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    scroll-behavior: smooth;
}

/* Scrollbar styles */
.chat-container::-webkit-scrollbar {
    width: 6px;
}
.chat-container::-webkit-scrollbar-track {
    background: transparent;
}
.chat-container::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 10px;
}

.message {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    animation: fadeIn 0.3s ease-out forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.ai-message {
    align-self: flex-start;
}

.user-message {
    align-self: flex-end;
}

.message-bubble {
    padding: 0.75rem 1rem;
    border-radius: 1.25rem;
    font-size: 0.95rem;
    line-height: 1.4;
    word-wrap: break-word;
}

.ai-message .message-bubble {
    background-color: var(--ai-bubble);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 0.25rem;
}

.user-message .message-bubble {
    background-color: var(--user-bubble);
    color: #fff;
    border-bottom-right-radius: 0.25rem;
}

.input-area {
    padding: 1rem;
    background-color: var(--surface-color);
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.image-preview-container {
    position: relative;
    align-self: flex-start;
    border-radius: 0.5rem;
    overflow: hidden;
    border: 1px solid var(--border-color);
    background-color: var(--bg-color);
    padding: 0.25rem;
}

.image-preview-container img {
    height: 60px;
    border-radius: 0.25rem;
    display: block;
}

#remove-image-btn {
    position: absolute;
    top: 0;
    right: 0;
    background: rgba(0,0,0,0.6);
    width: 24px;
    height: 24px;
    padding: 0;
    font-size: 0.75rem;
}

.input-form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background-color: var(--bg-color);
    padding: 0.5rem;
    border-radius: 2rem;
    border: 1px solid var(--border-color);
}

.input-form:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.icon-button {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.icon-button:hover {
    color: var(--text-main);
    background-color: var(--surface-color);
}

.icon-button.primary {
    color: var(--primary-color);
}
.icon-button.primary:hover {
    background-color: rgba(16, 185, 129, 0.1);
}

.icon-button.danger {
    color: var(--danger-color);
}

#message-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 0.95rem;
    font-family: inherit;
    padding: 0.5rem;
    outline: none;
}

#message-input::placeholder {
    color: var(--text-muted);
}

/* Loading animation */
.typing-indicator {
    display: flex;
    gap: 0.25rem;
    padding: 1rem;
    align-items: center;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background-color: var(--text-muted);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    text-align: center;
}

.modal-content h2 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.modal-content p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.auth-steps {
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.step {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.step-number {
    background: var(--primary-color);
    color: #fff;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
    flex-shrink: 0;
}

.step p {
    margin: 0;
    color: var(--text-main);
}

.url-container {
    background: var(--bg-color);
    padding: 1rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
    word-break: break-all;
}

.url-container a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.85rem;
}

.url-container a:hover {
    text-decoration: underline;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.auth-form input {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.75rem;
    border-radius: 0.5rem;
    font-family: inherit;
    font-size: 1rem;
    outline: none;
}

.auth-form input:focus {
    border-color: var(--primary-color);
}

.primary-btn {
    background: var(--primary-color);
    color: #fff;
    border: none;
    padding: 0.75rem;
    border-radius: 0.5rem;
    font-family: inherit;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s;
}

.primary-btn:hover {
    background: var(--primary-hover);
}
.primary-btn:disabled {
    background: var(--border-color);
    cursor: not-allowed;
}

