/* ===== VARIABLES CSS ===== */
:root {
    --claude-bg: #ffffff;
    --claude-sidebar: #f7f7f8;
    --claude-border: #e5e7eb;
    --claude-text: #2d333a;
    --claude-text-light: #6b7280;
    --claude-primary: #ff6b35;
    --claude-hover: #f3f4f6;
    --claude-success: #10b981;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--claude-bg);
    color: var(--claude-text);
    overflow-x: hidden;
}

/* ===== HEADER MOBILE ===== */
.mobile-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--claude-bg);
    border-bottom: 1px solid var(--claude-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    z-index: 1000;
}

.hamburger-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: background 0.2s;
}

.hamburger-btn:hover {
    background: var(--claude-hover);
}

.header-logo {
    font-size: 1rem;
    font-weight: 600;
    color: var(--claude-text);
    text-align: center;
    flex: 1;
}

.home-btn-header {
    background: var(--claude-primary);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 0.5rem;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
}

.home-btn-header:hover {
    opacity: 0.9;
    transform: scale(1.05);
}

/* ===== SIDEBAR MOBILE ===== */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 300px;
    max-width: 80vw;
    background: var(--claude-sidebar);
    border-right: 1px solid var(--claude-border);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 1002;
    overflow-y: auto;
    padding: 1rem;
}

.sidebar.active {
    transform: translateX(0);
}

.sidebar-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--claude-text-light);
}

/* ===== SECTIONS SIDEBAR ===== */
.sidebar-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--claude-border);
}

.sidebar-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--claude-text);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ===== HISTORIQUE ===== */
.conversation-item {
    padding: 0.5rem;
    border-radius: 6px;
    margin-bottom: 0.25rem;
    cursor: pointer;
    font-size: 0.875rem;
    border: 1px solid transparent;
    transition: all 0.2s;
}

.conversation-item:hover {
    background-color: var(--claude-hover);
    border-color: var(--claude-border);
}

.conversation-active {
    background-color: var(--claude-primary);
    color: white;
}

.conversation-date {
    font-size: 0.75rem;
    color: var(--claude-text-light);
    margin-bottom: 0.25rem;
}

.conversation-preview {
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.no-history {
    padding: 1rem;
    text-align: center;
    color: var(--claude-text-light);
    font-size: 0.875rem;
    font-style: italic;
    border: 1px dashed var(--claude-border);
    border-radius: 6px;
    background: var(--claude-hover);
    margin: 0.5rem 0;
}

/* ===== SYMPTÔMES ===== */
.symptom-select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--claude-border);
    border-radius: 6px;
    background: var(--claude-bg);
    font-size: 0.875rem;
    cursor: pointer;
}

.symptom-btn {
    width: 100%;
    background: var(--claude-hover);
    border: 1px solid var(--claude-border);
    border-radius: 6px;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
    text-align: left;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.symptom-btn:hover {
    background: var(--claude-primary);
    color: white;
    border-color: var(--claude-primary);
}

/* ===== AUDIO SETTINGS ===== */
.audio-controls {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toggle-switch {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.switch {
    position: relative;
    width: 44px;
    height: 24px;
    background: var(--claude-border);
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.switch.active {
    background: var(--claude-primary);
}

.switch-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
}

.switch.active .switch-thumb {
    transform: translateX(20px);
}

.lang-select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--claude-border);
    border-radius: 6px;
    background: var(--claude-bg);
    font-size: 0.875rem;
}

/* ===== ACTIONS ===== */
.action-buttons {
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid var(--claude-border);
    border-radius: 6px;
    background: var(--claude-bg);
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.action-btn:hover {
    background: var(--claude-hover);
}

.action-btn.danger {
    color: #dc2626;
    border-color: #dc2626;
}

.action-btn.danger:hover {
    background: #dc2626;
    color: white;
}

/* ===== FEEDBACK ===== */
.feedback-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.feedback-textarea {
    width: 100%;
    min-height: 80px;
    padding: 0.5rem;
    border: 1px solid var(--claude-border);
    border-radius: 6px;
    resize: vertical;
    font-family: inherit;
    font-size: 0.875rem;
}

.feedback-submit {
    padding: 0.5rem 1rem;
    background: var(--claude-primary);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: opacity 0.2s;
}

.feedback-submit:hover {
    opacity: 0.9;
}

/* ===== CHAT CONTAINER ===== */
.chat-container {
    margin-top: 60px;
    margin-bottom: 80px;
    padding: 1rem;
    min-height: calc(100vh - 140px);
    position: relative;
    overflow-x: hidden;
}

.chat-container::after {
    content: "";
    display: table;
    clear: both;
}

/* ===== WELCOME SCREEN ===== */
.welcome-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem 1rem;
    min-height: 60vh;
}

.welcome-screen h1 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--claude-primary);
}

.welcome-screen h2 {
    font-size: 1.125rem;
    margin-bottom: 2rem;
    color: var(--claude-text-light);
    line-height: 1.6;
}

.welcome-features {
    max-width: 600px;
    margin-bottom: 2rem;
}

.welcome-features h3 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--claude-text);
}

.welcome-features ul {
    text-align: left;
    margin-bottom: 1.5rem;
}

.welcome-features li {
    margin-bottom: 0.5rem;
    color: var(--claude-text-light);
}

.objective {
    background: var(--claude-hover);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    color: var(--claude-text);
}

.beta-notice {
    background: #fef3c7;
    color: #92400e;
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid #f59e0b;
}

.start-examples {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
    max-width: 400px;
}

.example-btn {
    padding: 0.75rem 1rem;
    background: var(--claude-hover);
    border: 1px solid var(--claude-border);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
    color: var(--claude-text);
}

.example-btn:hover {
    background: var(--claude-primary);
    color: white;
    border-color: var(--claude-primary);
}

/* ===== MESSAGES ===== */
.message {
    margin-bottom: 1rem;
    max-width: 85%;
    word-wrap: break-word;
    padding: 0.75rem 1rem;
    clear: both;
}

.message.user {
    margin-left: auto;
    margin-right: 0;
    background: white;
    color: black;
    border: 1px solid var(--claude-border);
    border-radius: 18px 18px 4px 18px;
    float: right;
    display: block;
}

.message.assistant {
    margin-left: 0;
    margin-right: auto;
    background: var(--claude-hover);
    color: var(--claude-text);
    border-radius: 18px 18px 18px 4px;
    border: 1px solid var(--claude-border);
    float: left;
    display: block;
}

.streaming-live {
    opacity: 0.95;
    border-left: 3px solid var(--claude-primary);
    animation: pulse 1.5s infinite;
}

.message-complete {
    opacity: 1;
    border-left: none;
    animation: none;
}

@keyframes pulse {
    0%, 100% { opacity: 0.95; }
    50% { opacity: 1; }
}

.message-content {
    line-height: 1.6;
}

.message-content strong {
    font-weight: 600;
    color: var(--claude-primary);
}

.message.assistant .message-content strong {
    color: var(--claude-primary);
}

.message.user .message-content strong {
    color: black;
    font-weight: 600;
}

/* ===== STREAMING INDICATOR ===== */
.streaming-indicator {
    display: none;
    align-items: center;
    gap: 0.5rem;
    background: var(--claude-hover);
    padding: 0.75rem 1rem;
    border-radius: 18px;
    margin-bottom: 1rem;
    max-width: 85%;
    border: 1px solid var(--claude-border);
    overflow: hidden;
    clear: both;
}

.streaming-indicator.active {
    display: flex;
}

.streaming-indicator span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.typing-dots {
    display: flex;
    gap: 0.25rem;
}

.dot {
    width: 6px;
    height: 6px;
    background: var(--claude-primary);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

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

/* ===== INPUT CONTAINER ===== */
.input-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--claude-bg);
    border-top: 1px solid var(--claude-border);
    padding: 1rem;
    display: flex;
    gap: 0.5rem;
    z-index: 100;
}

.message-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--claude-border);
    border-radius: 24px;
    font-size: 1rem;
    outline: none;
    background: var(--claude-bg);
}

.message-input:focus {
    border-color: var(--claude-primary);
}

.send-btn {
    background: var(--claude-primary);
    color: white;
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    cursor: pointer;
    font-size: 1.125rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.send-btn:hover {
    opacity: 0.9;
    transform: scale(1.05);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.message-content br.question-break {
    margin-bottom: 0.5rem;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 480px) {
    .sidebar {
        width: 280px;
    }
    
    .header-logo {
        font-size: 0.9rem;
    }
    
    .message {
        max-width: 90%;
    }
    
    .welcome-screen h1 {
        font-size: 1.5rem;
    }
    
    .start-examples {
        padding: 0 1rem;
    }
}

/* Bouton déconnexion header */
.logout-btn-header {
    background: rgba(255, 59, 48, 0.9);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s;
}

.logout-btn-header:hover {
    background: rgba(255, 59, 48, 1);
    transform: scale(1.05);
}

/* Section utilisateur sidebar */
.user-info {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    margin-bottom: 15px;
}

#userInfoDisplay {
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    margin-top: 10px;
}

/* Bouton login (non connecté) */
.login-btn-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s;
}

.login-btn-header:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* Animation pulse pour attirer l'attention */
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Banner consultation passée */
.consultation-banner {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border: 2px solid #ffc107;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(255, 193, 7, 0.2);
}

.banner-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 14px;
    font-weight: 500;
}

.btn-new-consultation {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-new-consultation:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-new-consultation:active {
    transform: translateY(0);
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-overlay.active {
    display: flex;
}

.loading-content {
    background: white;
    padding: 30px 50px;
    border-radius: 16px;
    font-size: 18px;
    font-weight: 600;
    color: #333;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

/* Player Audio */
.audio-player-container {
    margin: 10px 0;
    padding: 10px;
    background: rgba(76, 175, 80, 0.1);
    border-radius: 8px;
    border-left: 3px solid #4CAF50;
}

audio {
    width: 100%;
    height: 40px;
    outline: none;
}

audio::-webkit-media-controls-panel {
    background-color: #f5f5f5;
}

audio::-webkit-media-controls-play-button,
audio::-webkit-media-controls-pause-button {
    background-color: #4CAF50;
    border-radius: 50%;
}