/* ============================================
   MAESTRO — CSS minimal pro
   ============================================ */

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

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    color: #1a1a1a;
    background: #f7f7f9;
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* ---------- Navbar ---------- */
.navbar {
    background: #0f1729;
    color: #ffffff;
    padding: 0 24px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    box-shadow: 0 1px 0 rgba(0,0,0,0.06);
}
.nav-brand {
    display: flex;
    align-items: baseline;
    gap: 10px;
}
.brand-icon { font-size: 20px; }
.brand-name { font-weight: 700; font-size: 18px; letter-spacing: 0.3px; }
.brand-subtitle { color: #93a5c2; font-size: 13px; }

.nav-links {
    display: flex;
    align-items: center;
    gap: 20px;
}
.nav-links a {
    color: #cfd8e8;
    text-decoration: none;
    font-size: 14px;
    padding: 6px 10px;
    border-radius: 6px;
    transition: background 0.15s;
}
.nav-links a:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-links a.active { background: rgba(255,255,255,0.14); color: #fff; }
.nav-user {
    color: #93a5c2;
    font-size: 13px;
    padding-left: 12px;
    border-left: 1px solid rgba(255,255,255,0.12);
}
.logout-link {
    color: #ff9b9b !important;
    font-size: 13px !important;
}

/* ---------- Content ---------- */
.content {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.flash {
    padding: 10px 16px;
    margin: 10px;
    border-radius: 6px;
}
.flash-error { background: #fee; color: #c00; border: 1px solid #fbb; }

/* ---------- Login ---------- */
.login-page {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f1729 0%, #1e3a5f 100%);
}
.login-card {
    background: #ffffff;
    padding: 40px;
    border-radius: 12px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}
.login-header { text-align: center; margin-bottom: 24px; }
.login-header h1 { margin: 0 0 8px 0; font-size: 28px; }
.tagline { color: #555; font-size: 13px; margin: 0; }
.login-form label {
    display: block;
    margin-bottom: 14px;
    font-size: 13px;
    color: #333;
    font-weight: 600;
}
.login-form input {
    display: block;
    width: 100%;
    padding: 10px 12px;
    margin-top: 6px;
    border: 1px solid #d4d4d8;
    border-radius: 6px;
    font-size: 14px;
}
.login-form input:focus { outline: none; border-color: #1e3a5f; }
.login-form .primary-btn { width: 100%; margin-top: 8px; }
.login-hint { text-align: center; color: #888; margin-top: 16px; font-size: 12px; }
.login-hint code { background: #f0f0f3; padding: 2px 6px; border-radius: 4px; font-size: 12px; }

/* ---------- Workspace (study + interview) ---------- */
.workspace {
    flex: 1;
    display: grid;
    grid-template-columns: 280px 1fr;
    overflow: hidden;
}

.sidebar {
    background: #ffffff;
    border-right: 1px solid #e6e6ea;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}
.sidebar-header {
    padding: 14px 16px;
    border-bottom: 1px solid #e6e6ea;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.sidebar-header h3 { margin: 0; font-size: 14px; text-transform: uppercase; letter-spacing: 0.5px; color: #555; }

.session-list { list-style: none; padding: 8px 0; margin: 0; }
.session-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0;
    border-left: 3px solid transparent;
}
.session-list li.active { background: #f0f4ff; border-left-color: #1e3a5f; }
.session-list li.empty {
    padding: 16px;
    color: #999;
    font-size: 12px;
    font-style: italic;
}
.session-list li a {
    flex: 1;
    padding: 10px 14px;
    color: #1a1a1a;
    text-decoration: none;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.session-list li a:hover { background: #f5f5f8; }
.delete-session {
    background: transparent;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 4px 10px;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.15s;
}
.session-list li:hover .delete-session { opacity: 1; }
.delete-session:hover { color: #c00; }

.status-badge {
    display: inline-block;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    background: #d1f0d8;
    color: #155724;
    margin-left: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* ---------- Chat area ---------- */
.chat-area {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-header {
    padding: 14px 24px;
    border-bottom: 1px solid #e6e6ea;
    background: #ffffff;
}
.chat-header h2 { margin: 0 0 6px 0; font-size: 18px; }
.chat-help { margin: 0; color: #555; font-size: 13px; line-height: 1.5; }
.chat-help code { background: #f0f0f3; padding: 1px 6px; border-radius: 4px; font-size: 12px; }
.interview-actions { margin-top: 12px; }

/* ---------- Pause Help (encart astuce PAUSE) ---------- */
.pause-help {
    margin-top: 10px;
    padding: 10px 14px;
    background: #fff8e6;
    border: 1px solid #ffd699;
    border-radius: 8px;
    font-size: 13px;
}
.pause-help summary {
    cursor: pointer;
    padding: 4px 0;
    user-select: none;
    color: #8a5b00;
}
.pause-help summary:hover { color: #5a3d00; }
.pause-help-body {
    margin-top: 10px;
    line-height: 1.55;
}
.pause-help-body p { margin: 8px 0; }
.pause-help-body code {
    background: #ffe1a8;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    color: #5a3d00;
}
.pause-help-body ul { margin: 8px 0; padding-left: 22px; }
.pause-help-body li { margin: 3px 0; }

.pause-example {
    background: #ffffff;
    border: 1px solid #f0d090;
    border-radius: 8px;
    padding: 10px 14px;
    margin: 10px 0;
    font-size: 13px;
}
.pause-example .ex-msg {
    padding: 6px 0;
    border-bottom: 1px dashed #f0d090;
}
.pause-example .ex-msg:last-child { border-bottom: none; }
.pause-example .ex-label {
    display: inline-block;
    font-weight: 600;
    margin-right: 8px;
    color: #555;
    font-size: 12px;
}
.pause-example .ex-david .ex-label { color: #c08400; }
.pause-example .ex-naima .ex-label { color: #1e3a5f; }
.pause-example .ex-maestro .ex-label { color: #117a4a; }

.pause-keywords { font-size: 12px; color: #5a3d00; margin-top: 12px !important; }

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background: #f7f7f9;
}

.msg {
    margin-bottom: 18px;
    max-width: 90%;
}
.msg-role {
    font-size: 12px;
    color: #555;
    margin-bottom: 4px;
    font-weight: 600;
}
.msg-content {
    background: #ffffff;
    padding: 12px 16px;
    border-radius: 10px;
    line-height: 1.55;
    border: 1px solid #e6e6ea;
}
.msg-content h1, .msg-content h2, .msg-content h3 { margin: 0.6em 0 0.3em; }
.msg-content h1 { font-size: 18px; }
.msg-content h2 { font-size: 16px; }
.msg-content h3 { font-size: 14px; }
.msg-content p { margin: 0.4em 0; }
.msg-content ul, .msg-content ol { margin: 0.4em 0; padding-left: 22px; }
.msg-content code {
    background: #f0f0f3;
    padding: 2px 5px;
    border-radius: 4px;
    font-family: Menlo, Monaco, monospace;
    font-size: 13px;
}
.msg-content pre {
    background: #2d2d34;
    color: #f5f5f5;
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
    font-size: 13px;
}
.msg-content pre code { background: transparent; padding: 0; color: inherit; }

.msg-user .msg-content { background: #e8f0ff; border-color: #b8d0ff; }
.msg-naima .msg-content { background: #e8f0ff; border-color: #b8d0ff; }
.msg-david .msg-content { background: #fff4e6; border-color: #ffd699; }
.msg-david { max-width: 85%; }

.msg.loading .msg-content { opacity: 0.7; }

.msg-sources {
    margin-top: 6px;
    font-size: 12px;
    color: #666;
}
.msg-sources summary {
    cursor: pointer;
    padding: 4px 0;
    user-select: none;
}
.msg-sources ul { list-style: none; padding-left: 0; margin: 6px 0 0; }
.msg-sources li {
    padding: 4px 0;
    border-bottom: 1px dashed #eee;
    display: flex;
    justify-content: space-between;
    gap: 12px;
}
.msg-sources li:last-child { border-bottom: none; }
.msg-sources a { color: #1e3a5f; text-decoration: none; }
.msg-sources a:hover { text-decoration: underline; }
.score { color: #999; font-size: 11px; flex-shrink: 0; }

/* ---------- Debrief panel ---------- */
.debrief-panel {
    background: #f0f8ff;
    border: 2px solid #1e3a5f;
    border-radius: 10px;
    padding: 20px 24px;
    margin-bottom: 20px;
}
.debrief-panel h3 { margin-top: 0; color: #1e3a5f; }
.debrief-content { line-height: 1.6; }
.debrief-content h2 { font-size: 16px; margin-top: 18px; color: #1e3a5f; }

/* ---------- Chat input ---------- */
.chat-input {
    display: flex;
    gap: 10px;
    padding: 16px 24px;
    background: #ffffff;
    border-top: 1px solid #e6e6ea;
    align-items: flex-end;
}
.chat-input textarea {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #d4d4d8;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    line-height: 1.5;
}
.chat-input textarea:focus { outline: none; border-color: #1e3a5f; }
.chat-input button { white-space: nowrap; }

/* ---------- Buttons ---------- */
.primary-btn {
    background: #1e3a5f;
    color: #ffffff;
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
}
.primary-btn:hover { background: #2a4f7d; }
.primary-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.primary-btn.large { padding: 14px 24px; font-size: 16px; margin-top: 12px; }

.warning-btn {
    background: #c0392b;
    color: #ffffff;
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
}
.warning-btn:hover { background: #a23022; }
.warning-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.small-btn {
    background: #1e3a5f;
    color: #ffffff;
    padding: 4px 10px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
}
.small-btn:hover { background: #2a4f7d; }
