/* =============================================
   MAGISTER CHAT — Conversation bidirectionnelle
   ============================================= */

/* Configuration */
.config-bloc {
    background: linear-gradient(135deg, #fefcf6 0%, #faf6ec 100%);
    border: 1px solid #d4c8a8;
    border-radius: 10px;
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.config-mode p {
    margin: 0.5rem 0;
}

.mode-statique {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    border-radius: 4px;
    background: rgba(155, 28, 28, 0.1);
    color: var(--bordeaux, #9b1c1c);
    font-weight: 600;
}

.mode-connecte {
    background: rgba(34, 139, 34, 0.15) !important;
    color: #228b22 !important;
}

.config-api {
    background: #ffffff;
    border-left: 4px solid var(--safran, #e8a532);
    padding: 1rem;
    border-radius: 0 6px 6px 0;
    margin: 1rem 0;
}

.config-api label {
    display: block;
    margin-bottom: 0.4rem;
}

.config-api input[type="password"] {
    width: calc(100% - 250px);
    min-width: 250px;
    padding: 0.5rem;
    border: 1px solid #d4c8a8;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9rem;
    margin-right: 0.5rem;
}

.config-aide {
    font-size: 0.85rem;
    color: #6b5544;
    margin-top: 0.6rem;
}

.config-options {
    margin-top: 1rem;
    padding-top: 0.8rem;
    border-top: 1px dashed rgba(155, 28, 28, 0.2);
}

.config-options label {
    display: inline-block;
    cursor: pointer;
}

/* Modes */
.modes-bloc {
    margin: 1.5rem 0;
}

.modes-grille {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin: 1rem 0;
}

@media (min-width: 720px) {
    .modes-grille {
        grid-template-columns: repeat(3, 1fr);
    }
}

.mode-carte {
    background: #ffffff;
    border: 1px solid #d4c8a8;
    border-radius: 10px;
    padding: 1.2rem;
    text-align: left;
    cursor: pointer;
    transition: box-shadow 0.3s, transform 0.3s, border-color 0.3s;
    font-family: inherit;
}

.mode-carte:hover {
    box-shadow: 0 6px 18px rgba(155, 28, 28, 0.15);
    transform: translateY(-2px);
    border-color: var(--bordeaux, #9b1c1c);
}

.mode-carte.actif {
    border-color: var(--bordeaux, #9b1c1c);
    background: linear-gradient(135deg, #ffffff 0%, #fef8eb 100%);
    box-shadow: 0 4px 14px rgba(155, 28, 28, 0.18);
}

.mode-icone {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.5rem;
}

.mode-carte h3 {
    margin: 0.3rem 0;
    color: var(--bordeaux, #9b1c1c);
    font-size: 1.05rem;
    border: none;
    padding: 0;
}

.mode-carte p {
    margin: 0;
    font-size: 0.92rem;
    color: #4a3e30;
    line-height: 1.4;
}

/* Conversation */
.conversation-bloc {
    background: #ffffff;
    border: 1px solid #d4c8a8;
    border-radius: 10px;
    padding: 1.2rem;
    margin: 1.5rem 0;
}

.conversation-en-tete {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e0d4b8;
    padding-bottom: 0.6rem;
    margin-bottom: 1rem;
}

.conversation-en-tete h2 {
    margin: 0;
    border: none;
}

.btn-tertiaire {
    background: transparent;
    border: 1px solid #d4c8a8;
    color: #6b5544;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

.btn-tertiaire:hover {
    background: rgba(155, 28, 28, 0.05);
    border-color: var(--bordeaux, #9b1c1c);
    color: var(--bordeaux, #9b1c1c);
}

.conversation-zone {
    min-height: 200px;
    max-height: 60vh;
    overflow-y: auto;
    padding: 1rem;
    background: linear-gradient(135deg, #fefcf6 0%, #faf6ec 100%);
    border-radius: 8px;
    margin-bottom: 1rem;
}

.message {
    margin: 0.8rem 0;
    padding: 0.8rem 1rem;
    border-radius: 8px;
    line-height: 1.55;
    animation: messageApparition 0.4s ease;
}

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

.message-magister {
    background: #ffffff;
    border-left: 4px solid var(--bordeaux, #9b1c1c);
    padding-left: 1rem;
}

.message-magister::before {
    content: "𝕁 Professeur Tryphon";
    display: block;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--bordeaux, #9b1c1c);
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.message-utilisateur {
    background: rgba(232, 165, 50, 0.15);
    border-left: 4px solid var(--safran, #e8a532);
    padding-left: 1rem;
}

.message-utilisateur::before {
    content: "Vous";
    display: block;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #9c6f1f;
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.message-systeme {
    background: rgba(107, 85, 68, 0.1);
    border-left: 4px solid #6b5544;
    padding-left: 1rem;
    font-style: italic;
    font-size: 0.92rem;
}

.message-systeme::before {
    content: "ℹ Information";
    display: block;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b5544;
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.message-erreur {
    background: rgba(220, 38, 38, 0.1);
    border-left: 4px solid #dc2626;
    padding-left: 1rem;
    color: #7f1d1d;
}

.message-erreur::before {
    content: "⚠ Erreur";
    display: block;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #dc2626;
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.message p {
    margin: 0.3rem 0;
}

.message [lang="la"], .message [lang="grc"], .message [lang="he"] {
    font-style: italic;
}

.message-attente {
    color: #6b5544;
    font-style: italic;
    text-align: center;
    padding: 0.8rem;
}

.message-attente::after {
    content: " ⏳";
    animation: pendulum 1.4s infinite;
    display: inline-block;
}

@keyframes pendulum {
    0%, 100% { transform: rotate(-10deg); }
    50% { transform: rotate(10deg); }
}

/* Saisie */
.conversation-saisie {
    border-top: 1px solid #e0d4b8;
    padding-top: 0.8rem;
}

.conversation-saisie textarea {
    width: 100%;
    padding: 0.7rem;
    border: 1px solid #d4c8a8;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.97rem;
    resize: vertical;
    background: #fefcf6;
}

.conversation-saisie textarea:focus {
    outline: none;
    border-color: var(--bordeaux, #9b1c1c);
    box-shadow: 0 0 0 3px rgba(155, 28, 28, 0.1);
}

.saisie-actions {
    display: flex;
    gap: 0.6rem;
    margin-top: 0.6rem;
    flex-wrap: wrap;
}

.btn-primaire {
    background: var(--bordeaux, #9b1c1c);
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    transition: background 0.2s;
}

.btn-primaire:hover {
    background: #7a1414;
}

.btn-primaire:disabled {
    background: #c0a888;
    cursor: not-allowed;
}

.btn-secondaire {
    background: var(--safran, #e8a532);
    color: #4a3e30;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    transition: background 0.2s;
}

.btn-secondaire:hover {
    background: #d09525;
}

.btn-secondaire:disabled {
    background: #e8d8c0;
    cursor: not-allowed;
}

/* Profil */
.profil-bloc {
    background: linear-gradient(135deg, #fefcf6 0%, #faf6ec 100%);
    border: 1px solid #d4c8a8;
    border-radius: 10px;
    padding: 1.2rem;
    margin: 1.5rem 0;
}

#profil-affichage {
    margin: 0.6rem 0;
    font-size: 0.95rem;
}

#profil-affichage dl {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.3rem 1rem;
    margin: 0;
}

#profil-affichage dt {
    font-weight: 600;
    color: var(--bordeaux, #9b1c1c);
}

#profil-affichage dd {
    margin: 0;
}

/* Aide */
.aide-bloc {
    margin: 1.5rem 0;
}

.aide-bloc h3 {
    margin-top: 1.2rem;
}

/* Indicateur de recherche web */
.web-search-indicator {
    display: inline-block;
    margin-left: 0.6rem;
    padding: 0.2rem 0.6rem;
    background: rgba(34, 139, 34, 0.15);
    color: #228b22;
    border-radius: 4px;
    font-size: 0.78rem;
    font-weight: 600;
}

.message-citation-web {
    margin-top: 0.6rem;
    padding: 0.5rem 0.7rem;
    background: rgba(34, 139, 34, 0.05);
    border-left: 3px solid #228b22;
    border-radius: 0 4px 4px 0;
    font-size: 0.85rem;
}

.message-citation-web a {
    color: #228b22;
    text-decoration: none;
}

.message-citation-web a:hover {
    text-decoration: underline;
}
