/* Speaking Resume — Dark themed UI
 * ray.so-inspired background, chatbox styling, message bubbles,
 * typing indicator, lead form, and responsive layout.
 */

:root {
    --bg-page: #0a0a0a;
    --bg-chatbox: #141414;
    --bg-user-msg: #2a1a1a;
    --bg-bot-msg: #1a1a1a;
    --bg-input: #1e1e1e;
    --accent: #dc3545;
    --accent-hover: #c82333;
    --text-primary: #e8e8e8;
    --text-secondary: #888;
    --text-error: #ff6b6b;
    --border: #2a2a2a;
    --rounded-xl: 0.75rem;
    --font: 'IBM Plex Sans', sans-serif;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

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

body {
    font-family: var(--font);
    color: var(--text-primary);
    background-color: var(--bg-page);
    background-image:
        radial-gradient(ellipse 80% 60% at 75% 20%, rgba(180, 40, 50, 0.08) 0%, transparent 60%),
        radial-gradient(ellipse 60% 50% at 20% 80%, rgba(60, 40, 120, 0.06) 0%, transparent 60%),
        radial-gradient(circle 1px at center, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 100% 100%, 100% 100%, 24px 24px;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* Screen transitions */
.screen {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.screen.active {
    opacity: 1;
    visibility: visible;
}

/* Auth screen */
.auth-card {
    background: var(--bg-chatbox);
    border-radius: var(--rounded-xl);
    box-shadow: var(--shadow);
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.auth-title {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.auth-tagline {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

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

.auth-form input {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--rounded-xl);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.95rem;
    padding: 0.75rem 1rem;
    outline: none;
    transition: border-color 0.2s ease;
    text-align: center;
    letter-spacing: 0.05em;
}

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

.auth-form input::placeholder {
    color: var(--text-secondary);
    letter-spacing: normal;
}

.auth-form button {
    background: var(--accent);
    border: none;
    border-radius: var(--rounded-xl);
    color: #fff;
    cursor: pointer;
    font-family: var(--font);
    font-size: 0.95rem;
    font-weight: 500;
    padding: 0.75rem;
    transition: background 0.2s ease;
}

.auth-form button:hover:not(:disabled) {
    background: var(--accent-hover);
}

.auth-form button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.auth-error {
    color: var(--text-error);
    font-size: 0.85rem;
    margin-top: 1rem;
    min-height: 1.25rem;
}

/* Chat screen */
.chatbox {
    background: var(--bg-chatbox);
    border-radius: var(--rounded-xl);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    height: 85vh;
    width: 100%;
    max-width: 840px;
    overflow: hidden;
}

.chat-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.bot-name {
    font-weight: 600;
    font-size: 1rem;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Message bubbles */
.msg {
    max-width: 80%;
    padding: 0.625rem 0.875rem;
    border-radius: var(--rounded-xl);
    font-size: 0.9rem;
    line-height: 1.5;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.msg-user {
    background: var(--bg-user-msg);
    align-self: flex-end;
}

.msg-bot-wrapper {
    align-self: flex-start;
    max-width: 80%;
}

.bot-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-bottom: 0.2rem;
    font-weight: 500;
}

.msg-bot {
    background: var(--bg-bot-msg);
    border-radius: var(--rounded-xl);
    padding: 0.625rem 0.875rem;
    font-size: 0.9rem;
    line-height: 1.5;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.msg-bot a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s ease;
}

.msg-bot a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

.msg-system {
    align-self: center;
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-align: center;
    padding: 0.25rem 0;
}

/* Typing indicator */
.typing-indicator {
    align-self: flex-start;
    display: flex;
    gap: 4px;
    padding: 0.5rem 0;
}

.typing-indicator.hidden {
    display: none;
}

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

.typing-indicator .dot:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator .dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes pulse {
    0%, 80%, 100% { opacity: 0.2; transform: scale(0.8); }
    40% { opacity: 1; transform: scale(1); }
}

/* Lead form */
.lead-form {
    align-self: flex-start;
    background: var(--bg-bot-msg);
    border: 1px solid var(--border);
    border-radius: var(--rounded-xl);
    padding: 1rem;
    max-width: 85%;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.lead-form input,
.lead-form textarea {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.85rem;
    padding: 0.5rem 0.75rem;
    outline: none;
    width: 100%;
    transition: border-color 0.2s ease;
}

.lead-form input:focus,
.lead-form textarea:focus {
    border-color: var(--accent);
}

.lead-form textarea {
    resize: vertical;
    min-height: 3rem;
    max-height: 6rem;
}

.lead-form input::placeholder,
.lead-form textarea::placeholder {
    color: var(--text-secondary);
}

.lead-form button {
    background: var(--accent);
    border: none;
    border-radius: 0.5rem;
    color: #fff;
    cursor: pointer;
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.5rem;
    transition: background 0.2s ease;
}

.lead-form button:hover:not(:disabled) {
    background: var(--accent-hover);
}

.lead-form button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Chat input area */
.chat-input-area {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.chat-input-area input {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--rounded-xl);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.9rem;
    padding: 0.625rem 1rem;
    outline: none;
    transition: border-color 0.2s ease;
}

.chat-input-area input:focus {
    border-color: var(--accent);
}

.chat-input-area input::placeholder {
    color: var(--text-secondary);
}

.chat-input-area input:disabled {
    opacity: 0.5;
}

.chat-input-area button {
    background: var(--accent);
    border: none;
    border-radius: var(--rounded-xl);
    color: #fff;
    cursor: pointer;
    font-family: var(--font);
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.625rem 1.25rem;
    transition: background 0.2s ease;
    flex-shrink: 0;
}

.chat-input-area button:hover:not(:disabled) {
    background: var(--accent-hover);
}

.chat-input-area button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

/* Responsive */
@media (max-width: 640px) {
    .auth-card {
        margin: 0 1rem;
    }

    .chatbox {
        max-width: none;
        width: 95%;
        height: 90vh;
    }

    .chat-messages {
        padding: 0.75rem;
    }

    .chat-input-area {
        padding: 0.75rem;
    }
}
