/* Reset et variables */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --background: #f8fafc;
    --surface: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --error: #ef4444;
    --success: #10b981;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* Container */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    text-align: center;
    padding: 40px 20px;
    background: var(--surface);
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.header h1 {
    font-size: 2rem;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Section CAPTCHA */
.captcha-section {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.captcha-box {
    background: var(--surface);
    padding: 40px;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    text-align: center;
    max-width: 400px;
    width: 100%;
}

.captcha-box h3 {
    margin-bottom: 15px;
    color: var(--text-primary);
}

.captcha-box p {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.captcha-question {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    margin: 30px 0;
    padding: 20px;
    background: var(--background);
    border-radius: 8px;
}

/* Interface de chat */
.chat-interface {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

/* Informations de session */
.session-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: var(--background);
    border-bottom: 1px solid var(--border);
}

.badge {
    background: var(--primary-color);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
}

.linkedin-link {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.linkedin-link:hover {
    color: var(--primary-hover);
}

/* Zone de messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-height: 500px;
}

.message {
    display: flex;
    animation: slideIn 0.3s ease-out;
}

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

.message-content {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 12px;
    word-wrap: break-word;
}

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

.user-message .message-content {
    background: var(--primary-color);
    color: white;
    border-bottom-right-radius: 4px;
}

.assistant-message .message-content {
    background: var(--background);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

.error-message-chat {
    background: #fee2e2;
    color: var(--error);
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 0.875rem;
}

/* Zone de saisie */
.chat-input-container {
    padding: 20px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 10px;
}

.input-wrapper {
    flex: 1;
    position: relative;
}

#user-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    resize: none;
    transition: border-color 0.2s;
}

#user-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.char-counter {
    position: absolute;
    bottom: -20px;
    right: 5px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Boutons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

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

.btn-primary {
    background: var(--primary-color);
    color: white;
    width: 100%;
    margin-top: 15px;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
}

.btn-send {
    background: var(--primary-color);
    color: white;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-send:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

/* Messages d'erreur */
.error-message {
    color: var(--error);
    font-size: 0.875rem;
    margin-top: 10px;
}

/* Message d'information */
.info-message {
    padding: 10px 20px;
    text-align: center;
    background: var(--background);
    border-top: 1px solid var(--border);
}

.info-message small {
    color: var(--text-secondary);
}

/* Footer */
.footer {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 20px;
}

/* Inputs */
input[type="text"],
textarea {
    font-family: inherit;
}

#captcha-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1.125rem;
    text-align: center;
    transition: border-color 0.2s;
}

#captcha-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Loading spinner */
.loading {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

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

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .header {
        padding: 30px 15px;
    }

    .header h1 {
        font-size: 1.5rem;
    }

    .captcha-box {
        padding: 30px 20px;
    }

    .chat-messages {
        max-height: 400px;
    }

    .message-content {
        max-width: 90%;
    }

    .session-info {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
}

/* Auto-resize textarea */
textarea {
    min-height: 40px;
    max-height: 120px;
}
