/* CSS Variables */
:root {
    --bg-primary: #f7f6f3;
    --bg-secondary: #ffffff;
    --text-primary: #37352f;
    --text-secondary: #787774;
    --accent: #2383e2;
    --accent-hover: #1a73e8;
    --border: #e9e5e3;
    --shadow: rgba(15, 15, 15, 0.05);
    --modal-bg: rgba(0, 0, 0, 0.5);
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    height: 100vh;
    overflow: hidden;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Header */
.header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 12px 20px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-text {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.lang-switcher {
    background: none;
    border: 1px solid var(--border);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.lang-switcher:hover {
    background: var(--bg-primary);
}

.auth-button {
    background: var(--accent);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

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

/* Main Container */
.main-container {
    flex: 1;
    display: flex;
    justify-content: center;
    padding-top: 65px; /* Header height + padding */
    overflow: hidden;
}

.chat-container {
    width: 100%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    margin: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 4px var(--shadow);
    overflow: hidden;
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    scroll-behavior: smooth;
}

.welcome-message {
    text-align: center;
    padding: 40px 20px;
}

.welcome-message h1 {
    font-size: 32px;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.welcome-message p {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 32px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.quick-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.quick-action {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    color: var(--text-primary);
}

.quick-action:hover {
    background: white;
    border-color: var(--accent);
}

/* Chat Messages */
.message {
    margin-bottom: 16px;
    display: flex;
    gap: 12px;
    animation: fadeIn 0.3s ease;
}

.message.user {
    justify-content: flex-end;
}

.message-content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 12px;
    background: var(--bg-primary);
}

.message.user .message-content {
    background: var(--accent);
    color: white;
}

.message.ai .message-content {
    background: var(--bg-primary);
}

/* Action Buttons in Messages */
.message-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.action-button {
    padding: 6px 12px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
    color: var(--text-primary);
}

.action-button:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* Input Container */
.input-container {
    border-top: 1px solid var(--border);
    padding: 16px 20px;
    background: var(--bg-secondary);
}

.input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 8px;
}

.attach-button {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.attach-button:hover {
    background: var(--bg-secondary);
}

.message-input {
    flex: 1;
    border: none;
    background: none;
    padding: 8px 12px;
    font-size: 15px;
    resize: none;
    outline: none;
    max-height: 120px;
    font-family: inherit;
}

.send-button {
    background: var(--accent);
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.send-button:hover {
    background: var(--accent-hover);
}

.send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.input-hint {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 8px;
    text-align: center;
}

/* File Drop Indication */
.message-input.drag-over {
    background: rgba(35, 131, 226, 0.1);
    border: 2px dashed var(--accent);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--modal-bg);
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 32px;
    width: 90%;
    max-width: 400px;
    position: relative;
    animation: slideUp 0.3s ease;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--bg-primary);
}

.modal-content h2 {
    margin-bottom: 8px;
    font-size: 24px;
}

.modal-subtitle {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

/* Auth Options */
.auth-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-option {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
    width: 100%;
}

.auth-option:hover {
    background: var(--bg-primary);
    border-color: var(--accent);
}

.auth-option.google:hover {
    border-color: #4285F4;
}

.auth-divider {
    text-align: center;
    color: var(--text-secondary);
    margin: 16px 0;
    font-size: 14px;
}

.email-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.email-input {
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
    outline: none;
    transition: all 0.2s;
}

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

.auth-footer {
    margin-top: 24px;
    font-size: 13px;
    color: var(--text-secondary);
    text-align: center;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .header {
        padding: 12px;
    }
    
    .chat-container {
        margin: 10px;
        border-radius: 0;
        height: calc(100vh - 85px);
    }
    
    .welcome-message h1 {
        font-size: 24px;
    }
    
    .quick-actions {
        flex-direction: column;
    }
    
    .quick-action {
        width: 100%;
    }
    
    .message-content {
        max-width: 85%;
    }
    
    .modal-content {
        padding: 24px;
        margin: 16px;
    }
}

@media (max-width: 480px) {
    .logo-text {
        font-size: 18px;
    }
    
    .lang-switcher span {
        display: none;
    }
    
    .lang-switcher::after {
        content: "🌐";
    }
}

/* Loading Spinner */
.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}

.message.ai .loading-spinner {
    border-color: rgba(35, 131, 226, 0.3);
    border-top-color: var(--accent);
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* User avatar for authenticated state */
.auth-button svg {
    margin-right: 4px;
}

/* Message typing indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--text-secondary);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

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

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* File upload progress */
.upload-progress {
    margin-top: 8px;
    background: var(--bg-primary);
    border-radius: 4px;
    height: 4px;
    overflow: hidden;
}

.upload-progress-bar {
    height: 100%;
    background: var(--accent);
    transition: width 0.3s ease;
}

/* Copy button for titles */
.copy-button {
    position: absolute;
    right: 8px;
    top: 8px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.2s;
}

.message-content:hover .copy-button {
    opacity: 1;
}

.copy-button:hover {
    background: var(--bg-primary);
}

/* Error state */
.error-message {
    background: #fee;
    border: 1px solid #fcc;
    color: #c33;
    padding: 8px 12px;
    border-radius: 6px;
    margin-bottom: 12px;
    font-size: 14px;
}

/* Success state */
.success-message {
    background: #efe;
    border: 1px solid #cfc;
    color: #363;
    padding: 8px 12px;
    border-radius: 6px;
    margin-bottom: 12px;
    font-size: 14px;
}

/* Mobile landscape adjustments */
@media (max-height: 500px) and (orientation: landscape) {
    .header {
        padding: 8px 12px;
    }
    
    .chat-container {
        margin: 8px;
    }
    
    .welcome-message {
        padding: 20px;
    }
    
    .welcome-message h1 {
        font-size: 24px;
    }
    
    .input-container {
        padding: 12px;
    }
} 