:root {
    --primary-color: #5e35b1;
    --secondary-color: #00bcd4;
    --background-gradient: linear-gradient(120deg, #ede7f6 0%, #e0f7fa 100%);
    --user-message-bg: #e0f7fa;
    --user-message-color: #00796b;
    --visagpt-message-bg: #ede7f6;
    --visagpt-message-color: #5e35b1;
    --system-message-bg: #f0f4fa;
    --system-message-color: #2d3a4a;
    --button-gradient: linear-gradient(90deg, #5e35b1 0%, #00bcd4 100%);
    --button-hover-gradient: linear-gradient(90deg, #00bcd4 0%, #5e35b1 100%);
    --input-bg: #f3f6fd;
    --input-border-color: #cfd8dc;
    --input-focus-border-color: #5e35b1;
    --accent-color: #3b82f6;
    --accent-dark: #2563eb;
    --accent-light: #eaf1fb;
    --accent-bg: #f7f8fa;
    --accent-border: #d1d5db;

}

body {
    background: var(--background-gradient);
    font-family: 'Segoe UI', 'Roboto', Arial, sans-serif;
    margin: 0;
    min-height: 100vh;
}

.site {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.section {
    width: 100%;
    padding: 0;
}

.container {
    background: #fff;
    border-radius: 22px;
    box-shadow: 0 8px 32px rgba(60, 72, 88, 0.18);
    padding: 36px 28px 36px 28px;
}

.title {
    text-align: center;
    color: var(--primary-color);
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: 1px;
    margin: 0.25em !important;
    text-shadow: 0 2px 8px rgba(94, 53, 177, 0.08);
}

#chatBox {
    max-width: 100%;
    margin: 0 auto 24px auto;
    background: #f8fafc;
    border-radius: 18px;
    box-shadow: 0 4px 16px rgba(60, 72, 88, 0.10);
    padding: 24px 18px 90px 18px;
    min-height: 320px;
    max-height: 400px;
    overflow-y: auto;
    transition: box-shadow 0.2s;
}

.message {
    margin-bottom: 18px;
    padding: 0;
    animation: fadeIn 0.5s;
}

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

.chat-user {
    display: flex;
    justify-content: flex-end;
}

.chat-visagpt, .chat-system {
    display: flex;
    justify-content: flex-start;
}

.chat-user .message-body {
    background: var(--user-message-bg);
    color: var(--user-message-color);
    border-radius: 12px 12px 0 12px;
    padding: 12px 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    display: inline-block;
    max-width: 80%;
    justify-content: flex-end;
}

.chat-visagpt .message-body {
    background: var(--visagpt-message-bg);
    color: var(--visagpt-message-color);
    border-radius: 12px 12px 12px 0;
    padding: 12px 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    display: inline-block;
    max-width: 80%;
}

.chat-system .message-body {
    background: var(--system-message-bg);
    color: var(--system-message-color);
    border-radius: 12px;
    padding: 12px 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    display: inline-block;
    max-width: 80%;
    font-style: italic;
}

#inputWrapper {
    padding: 16px 20px 0 20px;
    border-radius: 12px;
    margin-top: 16px;
    position: relative;
}

#inputWrapper .has-text-right {
    position: absolute;
    bottom: 23px;
    right: 36px;
    margin-top: 0;
}

.textarea, #userInput {
    width: 100%;
    min-height: 80px;
    max-height: 180px;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--input-border-color);
    font-size: 1rem;
    outline: none;
    transition: all 0.2s;
    background: var(--input-bg);
    color: #333;
    box-sizing: border-box;
    resize: none;
    font-family: inherit;
    margin: 0;
}

.textarea:focus, #userInput:focus {
    border-color: var(--input-focus-border-color);
    background: #fff;
}

.button, #sendBtn {
    padding: 12px 24px;
    background: var(--button-gradient);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(94, 53, 177, 0.08);
    transition: background 0.2s, box-shadow 0.2s;
}

.button:hover, #sendBtn:hover {
    background: var(--button-hover-gradient);
    box-shadow: 0 4px 16px rgba(94, 53, 177, 0.12);
}

.has-text-right {
    text-align: right;
    margin-top: 8px;
}


@keyframes typing {
    0% {
        content: '\00a0';
    }
    25% {
        content: '.';
    }
    50% {
        content: '..';
    }
    75% {
        content: '...';
    }
    100% {
        content: '\00a0';
    }
}

.typing::after {
    content: '';
    animation: typing 1s steps(4, end) infinite;
}

.message-time {
    display: block;
    font-size: 0.6em;
    color: #888;
    text-align: right;
    margin-top: 8px;
}

.file-bubble-small {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    max-width: 240px;
    padding: 10px 14px;
    margin-bottom: 10px;
    border-radius: 14px;
    background: #f0f4fa;
    box-shadow: 0 2px 8px rgba(60, 60, 100, 0.07);
    border: 1px solid #e0e6ed;
    font-size: 0.96em;
    transition: box-shadow 0.2s;
    position: relative;
}

.file-bubble-small:hover {
    box-shadow: 0 4px 16px rgba(60, 60, 100, 0.13);
    background: var(--accent-light);
}

.file-bubble-small b {
    color: #2d3a4a;
    font-size: 1em;
    margin-bottom: 2px;
}

.file-bubble-small .download-btn {
    margin-top: 6px;
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.93em;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.file-bubble-small .download-btn:hover {
    text-decoration: underline;
}

.file-delete-btn {
    position: absolute;
    top: 7px;
    right: 10px;
    background: none;
    border: none;
    color: #b71c1c;
    font-size: 1.1em;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.15s;
}

.file-delete-btn:hover {
    opacity: 1;
    color: #d32f2f;
}

/* Modal d'arrière-plan */
#typeModal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

/* Contenu du modal */
#typeModal > div {
    background: #fff;
    padding: 32px 28px 24px 28px;
    border-radius: 14px;
    min-width: 340px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    display: flex;
    flex-direction: column;
    gap: 16px;
    animation: modalIn 0.25s;
}

@keyframes modalIn {
    from {
        transform: scale(0.95);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Titre */
#typeModal h3 {
    margin: 0 0 8px 0;
    font-size: 1.25em;
    color: #2a3a4d;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Sélecteur */
#typeSelect {
    width: 100%;
    padding: 8px 10px;
    border-radius: 7px;
    font-size: 1em;
    margin-bottom: 0;
    transition: border 0.2s;
}

input {
    border: 1px solid var(--accent-border);
    background: var(--accent-bg);
}


input:focus {
    border-color: var(--accent-color);
    outline: none;
}

/* Champ texte "Autre" */
input {
    padding: 8px 10px;
    border-radius: 7px;
    font-size: 1em;
    margin-bottom: 0;
    transition: border 0.2s;
}

/* Bouton Valider */
#typeValiderBtn {
    width: 100%;
    padding: 10px 0;
    background: linear-gradient(90deg, var(--accent-color) 60%, var(--accent-dark) 100%);
    color: #fff;
    font-size: 1.08em;
    font-weight: 500;
    border: none;
    border-radius: 7px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.08);
    transition: background 0.2s, box-shadow 0.2s;
}

#typeValiderBtn:hover {
    background: linear-gradient(90deg, var(--accent-dark) 60%, var(--accent-color) 100%);
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.13);
}

#typeModal > div,
#typeSelect,
#typeAutre,
#typeValiderBtn {
    box-sizing: border-box;
}

#typeAutre {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin-right: 0;
    box-sizing: border-box;
}

#uploadOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.45);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-loader {
    background: #fff;
    padding: 32px 40px;
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 5px solid #e5e7eb;
    border-top: 5px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.upload-text {
    font-size: 1.1em;
    color: var(--accent-dark);
    font-weight: 500;
    letter-spacing: 0.5px;
}

#uploadBtn {
    margin-top: 16px;
}

#typeModal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

#typeModal > div {
    background: #fff;
    padding: 24px;
    border-radius: 8px;
    min-width: 320px;
}

#typeSelect {
    width: 100%;
    margin-bottom: 12px;
}

#typeAutre {
    width: 100%;
    display: none;
    margin-bottom: 12px;
}

.disabled {
    opacity: 0.7;
    cursor: not-allowed !important;
}

.disabled > * {
    pointer-events: none;
}

#filesSidebar {
    height: 75%;
    overflow-y: auto;
}

#emailSaveBox {
    height: 25%;
    border-top: 1px solid #e0e6ed;
    padding: 12px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

#mainContainer {
    display: flex;
    flex-direction: row;
    gap: 24px;
    align-items: stretch;
    margin: 25px;
}

#chatContainer {
    width: 75%;
    min-width: 72%;
}

#rightSidebar {
    display: flex;
    flex-direction: column;
    gap: 24px;
    align-items: stretch;
}

#emailInput {
    margin-top: 16px;
    flex: 1;
    min-width: 0;
}

#emailEditBtn {
    flex-shrink: 0;
    padding: 8px;
    height: 36px;
    width: 36px;
}

.center {
    text-align: center;
}

#expirationNotice {
    font-size: 0.9em;
    color: #888;
    margin-bottom: 12px;
}

.expirationButton {
    margin-left: 5px;
    text-decoration: underline;
    cursor: pointer;
}

.expirationButton.supprimer {
    color: #b71c1c;
}

.expirationButton.reactiver {
    color: #3587e6;
}


/* Overlay de la modale */
#customModal {
    display: none;
    position: fixed;
    z-index: 1000;
    inset: 0;
    background: rgba(30, 41, 59, 0.45);
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.2s;
}

/* Contenu de la modale */
#customModal > div {
    background: #fff;
    padding: 2.5rem 2rem 2rem 2rem;
    border-radius: 18px;
    min-width: 320px;
    max-width: 90vw;
    box-shadow: 0 8px 32px rgba(30, 41, 59, 0.18);
    text-align: center;
    animation: popIn 0.25s;
}

/* Message de la modale */
#customModalMessage {
    font-size: 1.1rem;
    color: #1e293b;
    margin-bottom: 1.5rem;
}

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

@keyframes popIn {
    from {
        transform: scale(0.95);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}


.status-badge {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 12px;
    font-size: 0.95em;
    font-weight: 600;
    margin-bottom: 6px;
    color: #fff;
    background: #bdbdbd;
    box-shadow: 0 2px 8px rgba(60, 72, 88, 0.10);
    transition: opacity 0.35s cubic-bezier(.4, 0, .2, 1), background 0.35s;
    opacity: 1;
}

.status-badge.fade-out {
    opacity: 0;
}

.status-badge.fade-in {
    opacity: 1;
}

.status-badge.en_cours {
    background: var(--primary-color);
}

.status-badge.nouvelle {
    background: var(--secondary-color);
}

.status-badge.en_attente_validation {
    background: #fbc02d;
    color: #333;
}

.status-badge.terminee {
    background: #43a047;
}

.status-badge.supprimee {
    background: #b71c1c;
}

.status-badge.en_pause {
    background: var(--accent-color);
    color: #222;
}

#discussionStatusBadge {
    margin-top: 16px;
}

#emailSaveText {
    font-size: 0.95em;
    margin-left: 8px;
    margin-right: 8px;
}

#whatsappBox {
    text-align: center;
    padding: 18px 28px;
    flex-shrink: 0;
}

#whatsappBtn {
    width: 100%;
    background: linear-gradient(90deg, #25D366 0%, #128C7E 100%);
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
    transition: all 0.2s ease-in-out;
    color: #fff;
}

#whatsappBtn:hover {
    background: linear-gradient(90deg, #128C7E 0%, #25D366 100%);
    box-shadow: 0 6px 18px rgba(37, 211, 102, 0.4);
}

#whatsappBtn i.fab.fa-whatsapp {
    font-size: 1.2em;
}

/* --- RTL (Arabic) Support --- */
.rtl {
    direction: rtl;
    text-align: right;
}

.rtl .chat-user {
    justify-content: flex-start;
}

.rtl .chat-visagpt, .rtl .chat-system {
    justify-content: flex-end;
}

.rtl .chat-user .message-body {
    border-radius: 12px 12px 12px 4px;
}

.rtl .chat-visagpt .message-body {
    border-radius: 12px 12px 4px 12px;
}

.rtl #inputWrapper .has-text-right {
    right: auto;
    left: 30px;
}

.rtl #whatsappBtn {
    display: flex;
    flex-direction: row-reverse;
    justify-content: center;
}

.rtl #whatsappBtn i.fab.fa-whatsapp {
    margin-right: 0;
    margin-left: 8px;
}

.rtl .file-delete-btn {
    right: auto;
    left: 10px;
}

.language-selector {
    padding: 8px 30px 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--input-border-color);
    font-size: 0.95rem;
    outline: none;
    cursor: pointer;
    transition: all 0.2s ease-in-out;

    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;

    background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23202124%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-6.8%200-13.3%202.6-18.4%207.2A19.7%2019.7%200%200%200%200%2090.7c0%207.3%202.9%2014.2%207.4%2019.3l133%20146.3a20%2020%200%200%200%2014.8%206.8c5.4%200%2010.5-2.2%2014.5-6.6l133-146.4c4.6-5.1%207.2-11.8%207.2-18.9%200-7.7-2.9-15.1-7.7-20.7z%22%2F%3E%3C%2Fsvg%3E');
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 0.65em auto;
}

.language-selector:hover {
    border-color: var(--input-focus-border-color);
}

.language-selector:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(16, 163, 127, 0.2);
}