* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;

    overflow: hidden;
}

body {
    font-family: Arial, sans-serif;

    background: #111111;
    color: #ffffff;
}

button,
input,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

.hidden {
    display: none !important;
}


/* ========================================================= */
/* AUTH */
/* ========================================================= */

.screen {
    width: 100%;
    height: 100vh;
    min-height: 100vh;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 20px;

    overflow: auto;
}

.auth-box {
    width: 100%;
    max-width: 420px;

    padding: 30px;

    background: #181818;
    border: 1px solid #2d2d2d;
    border-radius: 16px;
}

.auth-box h1 {
    margin-top: 0;
}

.auth-subtitle {
    color: #888888;
}

.auth-box form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-box input {
    padding: 13px;

    border: 1px solid #333333;
    border-radius: 9px;

    background: #111111;
    color: #ffffff;

    outline: none;
}

.auth-box input:focus {
    border-color: #666666;
}

.auth-box form button {
    padding: 13px;

    border: none;
    border-radius: 9px;

    background: #ffffff;
    color: #111111;

    font-weight: bold;
}

.link-button {
    margin-top: 15px;

    border: none;
    background: none;

    color: #aaaaaa;
}

.error {
    min-height: 20px;

    color: #ff7070;
}


/* ========================================================= */
/* APP */
/* ========================================================= */

.app {
    width: 100%;
    height: 100vh;
    min-height: 0;

    display: flex;

    overflow: hidden;
}


/* ========================================================= */
/* SIDEBAR */
/* ========================================================= */

.sidebar {
    width: 290px;
    height: 100vh;
    min-height: 0;

    flex-shrink: 0;

    display: flex;
    flex-direction: column;

    border-right: 1px solid #292929;

    background: #171717;

    overflow: hidden;
}

.sidebar-header {
    flex-shrink: 0;

    padding: 18px;

    display: flex;
    justify-content: space-between;

    gap: 10px;

    border-bottom: 1px solid #292929;
}

.sidebar-header div {
    min-width: 0;

    display: flex;
    flex-direction: column;

    gap: 4px;
}

#username {
    color: #888888;

    font-size: 13px;

    overflow: hidden;

    white-space: nowrap;
    text-overflow: ellipsis;
}

.small-button {
    padding: 8px 11px;

    border: 1px solid #333333;
    border-radius: 8px;

    background: #222222;
    color: #ffffff;

    flex-shrink: 0;
}

.small-button:hover {
    background: #2a2a2a;
}


/* ========================================================= */
/* NOUVELLE CONVERSATION */
/* ========================================================= */

.new-conversation {
    width: calc(100% - 28px);

    flex-shrink: 0;

    margin: 14px;

    padding: 12px;

    display: flex;
    align-items: center;
    justify-content: center;

    gap: 8px;

    border: 1px solid #333333;
    border-radius: 9px;

    background: #222222;
    color: #ffffff;

    transition:
        background-color 0.15s ease,
        border-color 0.15s ease;
}

.new-conversation:hover {
    background: #292929;
    border-color: #444444;
}


/* ========================================================= */
/* LISTE CONVERSATIONS */
/* ========================================================= */

.conversation-list {
    flex: 1;

    min-height: 0;

    overflow-y: auto;
    overflow-x: hidden;

    padding: 0 10px 10px;
}

.conversation-item {
    width: 100%;

    display: flex;
    align-items: center;

    margin-bottom: 5px;

    border-radius: 8px;

    transition:
        background-color 0.15s ease;
}

.conversation-item:hover {
    background: #242424;
}

.conversation-item.active {
    background: #2b2b2b;
}

.conversation-main {
    min-width: 0;
    flex: 1;

    display: flex;
    align-items: center;

    gap: 8px;

    padding: 10px;

    border: none;
    border-radius: 8px;

    background: transparent;
    color: #ffffff;

    text-align: left;
}

.conversation-icon {
    flex-shrink: 0;
}

.conversation-name {
    min-width: 0;
    flex: 1;

    overflow: hidden;

    white-space: nowrap;
    text-overflow: ellipsis;
}

.conversation-actions {
    display: flex;
    align-items: center;

    gap: 2px;

    padding-right: 4px;

    opacity: 0;

    transform: translateX(3px);

    pointer-events: none;

    transition:
        opacity 0.15s ease,
        transform 0.15s ease;
}

.conversation-item:hover .conversation-actions,
.conversation-item.active .conversation-actions {
    opacity: 1;

    transform: translateX(0);

    pointer-events: auto;
}

.conversation-action {
    width: 28px;
    height: 28px;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0;

    border: none;
    border-radius: 6px;

    background: transparent;
    color: #ffffff;

    font-size: 14px;

    opacity: 0.7;

    transition:
        background-color 0.15s ease,
        opacity 0.15s ease,
        transform 0.15s ease;
}

.conversation-action:hover {
    opacity: 1;

    background: #333333;

    transform: scale(1.05);
}


/* ========================================================= */
/* PARAMÈTRES PROFIL SIDEBAR */
/* ========================================================= */

.profile-settings {
    width: calc(100% - 20px);

    flex-shrink: 0;

    margin: 0 10px 10px;

    padding: 11px 12px;

    display: flex;
    align-items: center;

    gap: 9px;

    border: 1px solid transparent;
    border-radius: 9px;

    background: transparent;
    color: #aaaaaa;

    text-align: left;

    transition:
        background-color 0.15s ease,
        color 0.15s ease,
        border-color 0.15s ease;
}

.profile-settings:hover {
    background: #242424;
    border-color: #303030;
    color: #ffffff;
}


/* ========================================================= */
/* MAIN */
/* ========================================================= */

.main {
    min-width: 0;
    min-height: 0;

    width: 100%;
    height: 100vh;

    flex: 1;

    display: flex;
    flex-direction: column;

    overflow: hidden;
}

.chat-header {
    min-height: 70px;

    flex-shrink: 0;

    padding: 0 22px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    border-bottom: 1px solid #292929;
}

.chat-header h2 {
    min-width: 0;

    margin: 0;

    font-size: 18px;

    max-width: 600px;

    overflow: hidden;

    white-space: nowrap;
    text-overflow: ellipsis;
}

.chat {
    flex: 1;

    min-height: 0;

    overflow-y: auto;
    overflow-x: hidden;

    padding: 30px;

    display: flex;
    flex-direction: column;

    gap: 16px;
}

.welcome {
    margin: auto;

    text-align: center;

    color: #aaaaaa;
}


/* ========================================================= */
/* MESSAGES */
/* ========================================================= */

.message {
    width: 100%;

    display: flex;

    flex-shrink: 0;
}

.message.user {
    justify-content: flex-end;
}

.message.assistant {
    justify-content: flex-start;
}

.message-content {
    max-width: 75%;

    padding: 13px 16px;

    border-radius: 14px;

    word-break: break-word;
}

.message.user .message-content {
    background: #2d2d2d;

    white-space: pre-wrap;
}

.message.assistant .message-content {
    background: #1c1c1c;

    border: 1px solid #2a2a2a;
}


/* ========================================================= */
/* MARKDOWN */
/* ========================================================= */

.message-content p {
    margin: 0 0 10px;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.message-content h1,
.message-content h2,
.message-content h3 {
    margin-top: 16px;
    margin-bottom: 8px;
}

.message-content ul,
.message-content ol {
    margin: 8px 0;

    padding-left: 24px;
}

.message-content li {
    margin: 4px 0;
}

.message-content blockquote {
    margin: 10px 0;

    padding-left: 14px;

    border-left: 3px solid #555555;

    color: #aaaaaa;
}

.message-content code {
    padding: 2px 5px;

    border-radius: 5px;

    background: #111111;

    font-family:
        Consolas,
        "Courier New",
        monospace;
}

.message-content pre {
    overflow-x: auto;

    margin: 12px 0;

    padding: 14px;

    border-radius: 9px;

    background: #101010;
}

.message-content pre code {
    padding: 0;

    background: transparent;
}

.message-content a {
    color: #8ab4f8;
}


/* ========================================================= */
/* THINKING                                                  */
/* ========================================================= */

.thinking-message {
    opacity: 0.75;
    margin: 4px 0;
}

.thinking-message .message-content {
    padding: 6px 10px;
    font-size: 13px;
}

.thinking-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.thinking-indicator [data-lucide] {
    width: 14px;
    height: 14px;

    flex-shrink: 0;

    color: #aaaaaa;
}

.thinking-dots {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.thinking-dots span {
    width: 4px;
    height: 4px;

    border-radius: 50%;
    background: currentColor;

    animation:
        thinkingDot
        1.2s
        infinite
        ease-in-out;
}

.thinking-dots span:nth-child(2) {
    animation-delay: 0.15s;
}

.thinking-dots span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes thinkingDot {
    0%,
    80%,
    100% {
        opacity: 0.25;
        transform: translateY(0);
    }

    40% {
        opacity: 1;
        transform: translateY(-2px);
    }
}


/* ========================================================= */
/* COMPOSER */
/* ========================================================= */

.composer {
    flex-shrink: 0;

    padding: 16px;

    display: flex;

    gap: 10px;

    border-top: 1px solid #292929;

    background: #171717;
}

textarea {
    flex: 1;

    min-width: 0;

    min-height: 46px;
    max-height: 180px;

    resize: none;

    padding: 13px;

    border: 1px solid #333333;
    border-radius: 10px;

    background: #111111;
    color: #ffffff;

    outline: none;
}

textarea:focus {
    border-color: #555555;
}

textarea:disabled {
    opacity: 0.5;
}

.composer > button {
    width: 50px;

    flex-shrink: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0;

    border: none;
    border-radius: 10px;

    background: #000000;
    color: #ffffff;

    font-weight: bold;
}

.composer > button:disabled {
    opacity: 0.45;

    cursor: not-allowed;
}


/* ========================================================= */
/* MODALES */
/* ========================================================= */

.modal {
    position: fixed;

    inset: 0;

    z-index: 1000;

    display: flex;

    align-items: center;
    justify-content: center;

    padding: 20px;

    overflow: auto;
}

.modal-overlay {
    position: absolute;

    inset: 0;

    background: rgba(0, 0, 0, 0.68);

    backdrop-filter: blur(5px);
}

.modal-box {
    position: relative;

    z-index: 1;

    width: 100%;
    max-width: 520px;

    max-height: calc(100vh - 40px);

    overflow: auto;

    background: #181818;

    border: 1px solid #303030;

    border-radius: 16px;

    box-shadow:
        0 24px 70px
        rgba(0, 0, 0, 0.45);

    animation:
        modalAppear
        0.16s
        ease-out;
}

@keyframes modalAppear {
    from {
        opacity: 0;

        transform:
            translateY(8px)
            scale(0.98);
    }

    to {
        opacity: 1;

        transform:
            translateY(0)
            scale(1);
    }
}

.modal-header {
    padding: 20px 22px;

    display: flex;
    align-items: flex-start;
    justify-content: space-between;

    border-bottom: 1px solid #2b2b2b;
}

.modal-eyebrow {
    display: block;

    margin-bottom: 5px;

    color: #777777;

    font-size: 12px;
    font-weight: bold;

    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.modal-header h2 {
    margin: 0;

    font-size: 20px;
}

.modal-close {
    width: 32px;
    height: 32px;

    display: flex;
    align-items: center;
    justify-content: center;

    flex-shrink: 0;

    padding: 0;

    border: none;
    border-radius: 8px;

    background: transparent;

    color: #888888;

    font-size: 24px;

    line-height: 1;

    transition:
        background-color 0.15s ease,
        color 0.15s ease;
}

.modal-close:hover {
    background: #292929;

    color: #ffffff;
}

.modal-content {
    padding: 22px;
}

.modal-footer {
    padding: 16px 22px;

    display: flex;
    justify-content: flex-end;

    gap: 10px;

    border-top: 1px solid #2b2b2b;
}


/* ========================================================= */
/* FORM MODALE */
/* ========================================================= */

.setting-group {
    display: flex;
    flex-direction: column;

    gap: 8px;

    margin-bottom: 18px;
}

.setting-group label {
    color: #aaaaaa;

    font-size: 13px;
}

.setting-group input {
    width: 100%;

    padding: 12px 13px;

    border: 1px solid #343434;
    border-radius: 9px;

    background: #111111;
    color: #ffffff;

    outline: none;
}

.setting-group input:focus {
    border-color: #5a5a5a;
}

.setting-group input:disabled {
    color: #777777;

    cursor: not-allowed;
}


/* ========================================================= */
/* BOUTONS MODALE */
/* ========================================================= */

.primary-button,
.secondary-button,
.danger-button {
    padding: 10px 14px;

    border-radius: 9px;

    font-weight: 600;
}

.primary-button {
    border: 1px solid #ffffff;

    background: #ffffff;

    color: #111111;
}

.primary-button:hover {
    background: #dddddd;
}

.secondary-button {
    border: 1px solid #343434;

    background: #222222;

    color: #ffffff;
}

.secondary-button:hover {
    background: #2b2b2b;
}


/* ========================================================= */
/* DANGER ZONE */
/* ========================================================= */

.danger-zone {
    padding: 15px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 15px;

    border: 1px solid #452828;

    border-radius: 10px;

    background: #211717;
}

.danger-zone strong {
    display: block;

    margin-bottom: 5px;
}

.danger-zone p {
    margin: 0;

    color: #888888;

    font-size: 13px;
}

.danger-button {
    flex-shrink: 0;

    border: 1px solid #653333;

    background: #321c1c;

    color: #ff8989;
}

.danger-button:hover {
    background: #422121;
}


/* ========================================================= */
/* PROFIL */
/* ========================================================= */

.profile-card {
    margin-bottom: 22px;

    padding: 15px;

    display: flex;
    align-items: center;

    gap: 12px;

    border: 1px solid #2f2f2f;

    border-radius: 11px;

    background: #141414;
}

.profile-avatar {
    width: 44px;
    height: 44px;

    display: flex;
    align-items: center;
    justify-content: center;

    flex-shrink: 0;

    border-radius: 50%;

    background: #292929;

    color: #ffffff;

    font-weight: bold;
}

.profile-card > div:last-child {
    min-width: 0;

    display: flex;
    flex-direction: column;

    gap: 3px;
}

#profile-username {
    overflow: hidden;

    white-space: nowrap;
    text-overflow: ellipsis;
}

#profile-email {
    color: #888888;

    font-size: 13px;

    overflow: hidden;

    white-space: nowrap;
    text-overflow: ellipsis;
}

.setting-card {
    padding: 15px;

    border: 1px solid #2f2f2f;

    border-radius: 10px;

    background: #141414;
}

.setting-card strong {
    display: block;

    margin-bottom: 5px;
}

.setting-card p {
    margin: 0;

    color: #888888;

    font-size: 13px;
}


/* ========================================================= */
/* SUPPRESSION */
/* ========================================================= */

.delete-modal-box {
    max-width: 460px;
}

.delete-message {
    margin: 0 0 10px;

    color: #aaaaaa;
}

.delete-conversation-name {
    padding: 12px 14px;

    border: 1px solid #343434;

    border-radius: 9px;

    background: #111111;

    color: #ffffff;

    font-weight: 600;

    overflow: hidden;

    white-space: nowrap;
    text-overflow: ellipsis;
}

.delete-warning {
    margin: 12px 0 0;

    color: #ff7777;

    font-size: 13px;
}


/* ========================================================= */
/* LUCIDE */
/* ========================================================= */

[data-lucide] {
    width: 17px;
    height: 17px;

    flex-shrink: 0;

    stroke-width: 2;
}

.conversation-action svg {
    width: 16px;
    height: 16px;
}

#new-conversation svg {
    width: 18px;
    height: 18px;
}


/* ========================================================= */
/* SCROLLBARS */
/* ========================================================= */

.conversation-list,
.chat,
.modal-box {
    scrollbar-width: thin;
    scrollbar-color: #3a3a3a transparent;
}

.conversation-list::-webkit-scrollbar,
.chat::-webkit-scrollbar,
.modal-box::-webkit-scrollbar {
    width: 7px;
}

.conversation-list::-webkit-scrollbar-track,
.chat::-webkit-scrollbar-track,
.modal-box::-webkit-scrollbar-track {
    background: transparent;
}

.conversation-list::-webkit-scrollbar-thumb,
.chat::-webkit-scrollbar-thumb,
.modal-box::-webkit-scrollbar-thumb {
    background: #3a3a3a;

    border-radius: 10px;
}

.conversation-list::-webkit-scrollbar-thumb:hover,
.chat::-webkit-scrollbar-thumb:hover,
.modal-box::-webkit-scrollbar-thumb:hover {
    background: #4a4a4a;
}


/* ========================================================= */
/* RESPONSIVE */
/* ========================================================= */

@media (max-width: 700px) {
    .sidebar {
        width: 240px;
    }

    .chat {
        padding: 20px;
    }

    .message-content {
        max-width: 90%;
    }

    .chat-header {
        padding: 0 16px;
    }

    .composer {
        padding: 12px;
    }
}

@media (max-width: 520px) {
    .sidebar {
        width: 210px;
    }

    .new-conversation {
        margin: 10px;
        width: calc(100% - 20px);
    }

    .conversation-list {
        padding-left: 6px;
        padding-right: 6px;
    }

    .chat {
        padding: 14px;
    }

    .message-content {
        max-width: 94%;
    }
}

:root {
    --bg-main: #111111;
    --bg-sidebar: #171717;
    --bg-secondary: #181818;
    --bg-input: #111111;
    --bg-message: #1c1c1c;
    --bg-message-user: #2d2d2d;
    --border: #292929;
    --border-light: #333333;
    --text: #ffffff;
    --text-muted: #888888;
    --text-secondary: #aaaaaa;
    --button-bg: #000000;
    --button-text: #ffffff;
}

body {
    background: var(--bg-main);
    color: var(--text);
}

.sidebar {
    background: var(--bg-sidebar);
    border-color: var(--border);
}

.main {
    background: var(--bg-main);
}

.chat-header {
    border-color: var(--border);
}

.composer {
    background: var(--bg-sidebar);
    border-color: var(--border);
}

textarea {
    background: var(--bg-input);
    color: var(--text);
    border-color: var(--border-light);
}

.message.user .message-content {
    background: var(--bg-message-user);
}

.message.assistant .message-content {
    background: var(--bg-message);
    border-color: var(--border);
}

.composer > button {
    background: var(--button-bg);
    color: var(--button-text);
}

/* ========================================================= */
/* FICHIERS / IMAGES */
/* ========================================================= */

.composer {
    position: relative;
}


.attach-button {
    width: 42px;
    height: 42px;

    flex-shrink: 0;

    border: none;
    border-radius: 12px;

    background: transparent;

    display: flex;
    align-items: center;
    justify-content: center;

    cursor: pointer;

    transition:
        background 0.15s ease,
        opacity 0.15s ease;
}


.attach-button:hover:not(:disabled) {
    background: rgba(
        255,
        255,
        255,
        0.06
    );
}


.attach-button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}


.attach-button svg {
    width: 20px;
    height: 20px;
}


.pending-files {
    position: absolute;

    left: 12px;
    right: 12px;

    bottom: calc(100% + 8px);

    display: flex;
    gap: 8px;

    flex-wrap: wrap;

    padding: 8px;

    border-radius: 14px;

    background: var(
        --composer-background,
        #171717
    );

    border: 1px solid rgba(
        255,
        255,
        255,
        0.08
    );

    box-shadow:
        0 10px 30px
        rgba(0, 0, 0, 0.25);
}


.pending-files.hidden {
    display: none;
}


.pending-file {
    min-width: 0;

    max-width: 280px;

    display: flex;
    align-items: center;

    gap: 8px;

    padding: 6px 8px;

    border-radius: 10px;

    background: rgba(
        255,
        255,
        255,
        0.05
    );
}


.pending-file-preview {
    width: 36px;
    height: 36px;

    flex-shrink: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    overflow: hidden;

    border-radius: 8px;

    background: rgba(
        255,
        255,
        255,
        0.06
    );
}


.pending-file-preview img {
    width: 100%;
    height: 100%;

    object-fit: cover;
}


.pending-file-preview svg {
    width: 18px;
    height: 18px;
}


.pending-file-info {
    min-width: 0;

    display: flex;
    flex-direction: column;
    gap: 2px;
}


.pending-file-info strong {
    overflow: hidden;

    text-overflow: ellipsis;

    white-space: nowrap;

    font-size: 13px;
}


.pending-file-info span {
    font-size: 11px;

    opacity: 0.6;
}


.pending-file-remove {
    width: 28px;
    height: 28px;

    flex-shrink: 0;

    border: none;

    border-radius: 8px;

    background: transparent;

    display: flex;
    align-items: center;
    justify-content: center;

    cursor: pointer;
}


.pending-file-remove:hover {
    background: rgba(
        255,
        255,
        255,
        0.08
    );
}


.pending-file-remove svg {
    width: 16px;
    height: 16px;
}


/* ========================================================= */
/* FICHIERS DANS LES MESSAGES */
/* ========================================================= */

.message-files {
    display: flex;

    flex-wrap: wrap;

    gap: 8px;

    margin-bottom: 8px;
}


.message-file {
    max-width: 320px;

    display: flex;
    align-items: center;

    gap: 8px;

    padding: 7px;

    border-radius: 12px;

    background: rgba(
        255,
        255,
        255,
        0.05
    );

    border: 1px solid rgba(
        255,
        255,
        255,
        0.07
    );
}


.message-file img {
    width: 120px;
    height: 90px;

    object-fit: cover;

    border-radius: 8px;
}


.message-file-info {
    min-width: 0;

    display: flex;
    flex-direction: column;

    gap: 3px;
}


.message-file-info strong {
    overflow: hidden;

    text-overflow: ellipsis;

    white-space: nowrap;

    font-size: 13px;
}


.message-file-info span {
    font-size: 11px;

    opacity: 0.6;
}


@media (
    max-width: 700px
) {
    .pending-files {
        left: 6px;
        right: 6px;
    }

    .pending-file {
        max-width: 100%;
        width: 100%;
    }

    .message-file {
        max-width: 100%;
        width: 100%;
    }
}

/* ========================================================= */
/* SÉLECTEUR DE MODE                                         */
/* ========================================================= */

.chat-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.model-mode-wrapper {
    display: flex;
    align-items: center;

    gap: 8px;

    padding: 0 10px;

    border: 1px solid #333333;
    border-radius: 8px;

    background: #1c1c1c;

    transition:
        border-color 0.15s ease,
        background-color 0.15s ease;
}

.model-mode-wrapper:hover {
    background: #262626;
    border-color: #454545;
}

.model-mode-wrapper:focus-within {
    border-color: #666666;
}

.model-mode-icon {
    width: 16px;
    height: 16px;

    flex-shrink: 0;

    color: #888888;

    pointer-events: none;
}

.model-mode-select {
    appearance: none;

    padding: 8px 4px 8px 0;

    border: none;
    outline: none;

    background: transparent;

    color: #ffffff;

    font-size: 13px;
    font-weight: 500;

    cursor: pointer;
}

.model-mode-select option {
    background: #1c1c1c;
    color: #ffffff;
}

@media (max-width: 700px) {
    .chat-header-actions {
        display: none;
    }
}


/* ========================================================= */
/* LOADER D'IMAGE IA                                         */
/* ========================================================= */

.image-loader {
    width: 100%;
    max-width: 512px;

    margin: 12px 0;

    border-radius: 14px;

    background:
        linear-gradient(
            135deg,
            #1c1c1c 0%,
            #262626 25%,
            #1c1c1c 50%,
            #262626 75%,
            #1c1c1c 100%
        );

    background-size: 300% 300%;

    border: 1px solid #2a2a2a;

    overflow: hidden;

    animation:
        imageLoaderShimmer
        3s ease-in-out infinite;

    box-shadow:
        0 8px 28px
        rgba(0, 0, 0, 0.35);
}

.image-loader-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    gap: 18px;

    padding: 56px 24px;

    text-align: center;
}

.image-loader-spinner {
    position: relative;

    width: 44px;
    height: 44px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 50%;

    border: 3px solid
        rgba(255, 255, 255, 0.08);

    border-top-color: #ffffff;

    animation:
        imageLoaderSpin
        0.9s linear infinite;
}

.image-loader-spinner [data-lucide] {
    position: absolute;

    width: 20px;
    height: 20px;

    color: #ffffff;

    /*
     * Compensation inverse : l'icône reste
     * droite pendant que le cercle tourne.
     */
    animation:
        imageLoaderSpinReverse
        0.9s linear infinite;
}

.image-loader-text {
    display: flex;
    flex-direction: column;

    gap: 6px;

    max-width: 100%;
}

.image-loader-text strong {
    color: #ffffff;

    font-size: 14px;
    font-weight: 600;

    letter-spacing: 0.02em;
}

.image-loader-prompt {
    color: #888888;

    font-size: 12px;

    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;

    max-width: 380px;
}

.image-loader-error {
    background:
        linear-gradient(
            135deg,
            #2a1c1c,
            #1c1313
        );

    border-color: #452828;

    animation: none;
}

.image-loader-error-icon {
    width: 44px;
    height: 44px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 50%;

    background: rgba(255, 100, 100, 0.08);

    color: #ff8989;
}

.image-loader-error-icon [data-lucide] {
    width: 22px;
    height: 22px;
}


@keyframes imageLoaderSpin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes imageLoaderSpinReverse {
    to {
        transform: rotate(-360deg);
    }
}

@keyframes imageLoaderShimmer {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}


/* ========================================================= */
/* IMAGE GÉNÉRÉE                                             */
/* ========================================================= */

.ai-generated-image {
    display: block;

    width: auto;
    height: auto;

    max-width: min(100%, 320px);
    max-height: 320px;

    object-fit: contain;

    margin: 10px 0;

    border-radius: 12px;

    border: 1px solid #2a2a2a;

    box-shadow:
        0 6px 20px
        rgba(0, 0, 0, 0.35);

    animation:
        imageAppear
        0.4s ease-out;

    cursor: pointer;

    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

.ai-generated-image:hover {
    transform: scale(1.02);

    box-shadow:
        0 10px 28px
        rgba(0, 0, 0, 0.45);
}

@keyframes imageAppear {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ========================================================= */
/* LOADER D'IMAGE IA — V2                                    */
/* ========================================================= */

.image-loader {
    width: 100%;
    max-width: 340px;

    margin: 12px 0;

    border-radius: 16px;

    background:
        radial-gradient(
            circle at top left,
            rgba(255, 255, 255, 0.03),
            transparent 60%
        ),
        linear-gradient(
            145deg,
            #161616 0%,
            #1a1a1a 100%
        );

    border: 1px solid #262626;

    box-shadow:
        0 10px 32px rgba(0, 0, 0, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.03);

    overflow: hidden;

    animation:
        imageLoaderAppear
        0.3s ease-out;
}

.image-loader[data-mode="slow"] {
    border-color: #2e2a1f;

    background:
        radial-gradient(
            circle at top left,
            rgba(255, 200, 100, 0.05),
            transparent 60%
        ),
        linear-gradient(
            145deg,
            #161411 0%,
            #1a1815 100%
        );
}

.image-loader-inner {
    display: flex;
    align-items: center;

    gap: 16px;

    padding: 16px 18px;
}

/* ========================================================= */
/* VISUEL                                                    */
/* ========================================================= */

.image-loader-visual {
    position: relative;

    width: 56px;
    height: 56px;

    flex-shrink: 0;

    display: flex;
    align-items: center;
    justify-content: center;
}

.image-loader-ring {
    position: absolute;
    inset: 0;

    border-radius: 50%;

    border: 2px solid
        rgba(255, 255, 255, 0.06);

    border-top-color: #ffffff;
    border-right-color: #888888;

    animation:
        imageLoaderSpin
        1.4s linear infinite;
}

.image-loader[data-mode="slow"] .image-loader-ring {
    border-top-color: #ffcc66;
    border-right-color: #aa8833;

    animation-duration: 2.4s;
}

.image-loader-glow {
    position: absolute;

    width: 34px;
    height: 34px;

    border-radius: 50%;

    background: radial-gradient(
        circle,
        rgba(255, 255, 255, 0.12),
        transparent 70%
    );

    animation:
        imageLoaderPulse
        1.8s ease-in-out infinite;
}

.image-loader[data-mode="slow"] .image-loader-glow {
    background: radial-gradient(
        circle,
        rgba(255, 200, 100, 0.15),
        transparent 70%
    );
}

.image-loader-glyph {
    position: relative;

    width: 22px !important;
    height: 22px !important;

    color: #ffffff;

    z-index: 1;
}

.image-loader[data-mode="slow"] .image-loader-glyph {
    color: #ffcc66;
}

/* ========================================================= */
/* INFOS                                                     */
/* ========================================================= */

.image-loader-info {
    min-width: 0;
    flex: 1;

    display: flex;
    flex-direction: column;

    gap: 6px;
}

.image-loader-headline {
    display: flex;
    align-items: center;
    gap: 8px;
}

.image-loader-title {
    color: #ffffff;

    font-size: 13px;
    font-weight: 600;

    letter-spacing: 0.02em;
}

.image-loader-meta {
    display: flex;
    align-items: center;

    gap: 6px;

    font-size: 11px;
}

.image-loader-mode {
    color: #ffffff;

    font-weight: 600;

    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.image-loader[data-mode="fast"] .image-loader-mode {
    color: #7dd3fc;
}

.image-loader[data-mode="slow"] .image-loader-mode {
    color: #ffcc66;
}

.image-loader-dot {
    width: 3px;
    height: 3px;

    border-radius: 50%;

    background: #444444;
}

.image-loader-time {
    color: #888888;

    font-size: 11px;

    font-variant-numeric: tabular-nums;
}

/* ========================================================= */
/* PROGRESSION                                               */
/* ========================================================= */

.image-loader-progress {
    width: 100%;
    height: 3px;

    margin: 2px 0;

    border-radius: 3px;

    background: rgba(255, 255, 255, 0.04);

    overflow: hidden;
}

.image-loader-progress-bar {
    height: 100%;
    width: 5%;

    border-radius: 3px;

    background: linear-gradient(
        90deg,
        #7dd3fc,
        #ffffff
    );

    transition: width 0.8s ease-out;

    box-shadow: 0 0 8px
        rgba(125, 211, 252, 0.4);
}

.image-loader[data-mode="slow"] .image-loader-progress-bar {
    background: linear-gradient(
        90deg,
        #aa8833,
        #ffcc66
    );

    box-shadow: 0 0 8px
        rgba(255, 204, 102, 0.4);
}

/* ========================================================= */
/* PROMPT                                                    */
/* ========================================================= */

.image-loader-prompt {
    color: #666666;

    font-size: 11px;
    font-style: italic;

    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;

    max-width: 100%;
}

/* ========================================================= */
/* ERREUR                                                    */
/* ========================================================= */

.image-loader-error {
    border-color: #452828 !important;

    background:
        linear-gradient(
            145deg,
            #231717 0%,
            #1a1313 100%
        ) !important;
}

.image-loader-error .image-loader-ring {
    display: none;
}

.image-loader-error .image-loader-glow {
    background: radial-gradient(
        circle,
        rgba(255, 100, 100, 0.15),
        transparent 70%
    );
}

.image-loader-error .image-loader-glyph,
.image-loader-error-icon [data-lucide] {
    color: #ff8989;
}

.image-loader-error-icon {
    width: 56px;
    height: 56px;

    flex-shrink: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 50%;

    background: rgba(255, 100, 100, 0.08);
}

.image-loader-error-icon [data-lucide] {
    width: 22px;
    height: 22px;
}

/* ========================================================= */
/* ANIMATIONS                                                */
/* ========================================================= */

@keyframes imageLoaderSpin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes imageLoaderPulse {
    0%,
    100% {
        opacity: 0.5;
        transform: scale(0.9);
    }

    50% {
        opacity: 1;
        transform: scale(1.1);
    }
}

@keyframes imageLoaderAppear {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}