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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fileSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }

    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

@keyframes checkPop {
    0% {
        transform: scale(0);
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes pulse {
    from {
        opacity: 1;
    }

    to {
        opacity: 0.6;
    }
}

/* Boutons d'action */
.attach-button,
.voice-button {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: #6b7280;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.attach-button {
    gap: 8px;
    padding: 0;
    font-size: 13px;
    font-weight: 500;
}

    .attach-button span {
        display: none;
    }

    .attach-button:hover {
        color: var(--secondary);
    }

.voice-button {
    width: 36px;
    height: 36px;
}

    .voice-button:hover {
        background: #f3f4f6;
        color: var(--text-dark);
    }

.send-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--contrast);
    border: none;
    color: #ffffff;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
}

    .send-button:hover:not(:disabled) {
        transform: scale(1.05);
        box-shadow: 0 4px 12px rgba(246, 62, 99, 0.3);
    }

    .send-button:active:not(:disabled) {
        transform: scale(0.98);
    }

    .send-button:disabled {
        background: #e5e7eb;
        cursor: not-allowed;
        opacity: 0.6;
    }

        .send-button:disabled svg {
            color: #9ca3af;
        }

/* Gestion des fichiers */
.file-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: all 0.2s ease;
}

    .file-item:hover {
        border-color: #d1d5db;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    }

.file-preview {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 6px;
    overflow: hidden;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
}

.file-icon {
    font-size: 20px;
    color: var(--secondary);
}

.file-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.file-name {
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-size {
    font-size: 11px;
    color: #9ca3af;
}

.remove-file-button {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: #9ca3af;
    cursor: pointer;
    transition: all 0.2s ease;
}

    .remove-file-button:hover {
        background: #fee2e2;
        color: #ef4444;
    }

/* Wrapper d'input universel */
.input-wrapper {
    background: white;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: all 0.2s ease;
}

    .input-wrapper.has-files {
        border-radius: 0 0 16px 16px;
        border-top: none;
    }

    .input-wrapper:focus-within {
        border-color: var(--secondary);
        box-shadow: 0 4px 12px rgba(41, 132, 161, 0.12);
    }

    .input-wrapper textarea {
        width: 100%;
        border: none;
        outline: none;
        resize: none;
        font-size: 15px;
        font-family: inherit;
        color: var(--text-dark);
        background: transparent;
        min-height: 24px;
        max-height: 200px;
        line-height: 1.5;
        padding: 0;
        overflow-y: auto;
        transition: height 0.1s ease;
    }

        .input-wrapper textarea::-webkit-scrollbar {
            width: 4px;
        }

        .input-wrapper textarea::-webkit-scrollbar-track {
            background: transparent;
        }

        .input-wrapper textarea::-webkit-scrollbar-thumb {
            background: #d1d5db;
            border-radius: 2px;
        }

            .input-wrapper textarea::-webkit-scrollbar-thumb:hover {
                background: #9ca3af;
            }

        .input-wrapper textarea::placeholder {
            color: #9ca3af;
        }

        .input-wrapper textarea:disabled {
            opacity: 0.6;
            cursor: not-allowed;
        }

.home-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.home-content {
    width: 100%;
    max-width: 1200px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Section bienvenue */
.welcome-section {
    text-align: center;
    margin-bottom: 1rem;
}

.welcome-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.welcome-subtitle {
    font-size: 1.25rem;
    color: var(--text-light);
    margin: 0;
}

/* Zone de saisie Home */
.input-container {
    width: 100%;
    margin: 0 auto;
}

.input-files {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 16px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 16px 16px 0 0;
    margin-bottom: -1px;
}

    /* Variantes spécifiques pour Home */
    .input-files .file-item {
        background: #f9fafb;
        max-width: 45%;
        animation: fileSlideIn 0.3s ease;
    }

    .input-files .file-preview {
        width: 36px;
        height: 36px;
    }

    .input-files .file-icon {
        font-size: 18px;
    }

.input-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 4px;
}

.input-right-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Cartes des agents */
.agents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(480px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.agent-card {
    position: relative;
    background: white;
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    gap: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

    .agent-card input[type="radio"] {
        position: absolute;
        opacity: 0;
        pointer-events: none;
    }

    .agent-card:hover {
        border-color: var(--secondary);
        box-shadow: 0 4px 12px rgba(41, 132, 161, 0.15);
        transform: translateY(-2px);
    }

    .agent-card.selected {
        border-color: var(--secondary);
        background: linear-gradient(135deg, rgba(41, 132, 161, 0.05) 0%, rgba(57, 181, 221, 0.05) 100%);
        box-shadow: 0 4px 12px rgba(41, 132, 161, 0.2);
    }

        .agent-card.selected .agent-icon {
            background: linear-gradient(135deg, var(--secondary) 0%, var(--third-color) 100%);
            box-shadow: 0 4px 12px rgba(41, 132, 161, 0.3);
        }

    .agent-card .agent-check {
        position: absolute;
        top: 1rem;
        right: 1rem;
        width: 24px;
        height: 24px;
        border-radius: 50%;
        background: var(--secondary);
        color: white;
        display: none;
        align-items: center;
        justify-content: center;
    }

    .agent-card.selected .agent-check {
        display: flex;
        animation: checkPop 0.3s ease;
    }

.agent-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--secondary) 0%, var(--third-color) 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.agent-content {
    flex: 1;
}

.agent-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0 0 0.5rem 0;
}

.agent-description {
    font-size: 0.8rem;
    color: var(--text-light);
    line-height: 1.5;
    margin: 0;
}


.chatroom-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.chatroom-messages {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

    .chatroom-messages::-webkit-scrollbar {
        width: 8px;
    }

    .chatroom-messages::-webkit-scrollbar-track {
        background: transparent;
    }

    .chatroom-messages::-webkit-scrollbar-thumb {
        background: var(--secondary);
        border-radius: 4px;
    }

        .chatroom-messages::-webkit-scrollbar-thumb:hover {
            background: var(--third-color);
        }

.chatroom-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-light);
    text-align: center;
}

    .chatroom-empty h3 {
        font-size: 1.5rem;
        color: var(--text-dark);
        margin-bottom: 0.5rem;
    }

    .chatroom-empty p {
        font-size: 1rem;
        margin: 0;
    }

.empty-icon {
    font-size: 4rem;
    color: var(--secondary);
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Messages */
.message-row {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    animation: fadeIn 0.3s ease;
}

    .message-row.user {
        flex-direction: row-reverse;
        justify-content: flex-start;
    }

    .message-row.assistant {
        flex-direction: row;
        justify-content: flex-start;
    }

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.avatar-user {
    background: linear-gradient(135deg, var(--secondary) 0%, var(--third-color) 100%);
    color: white;
}

.avatar-assistant {
    background: linear-gradient(135deg, var(--contrast) 0%, #e02851 100%);
    color: white;
}

.message-content-wrapper {
    display: flex;
    flex-direction: column;
    max-width: 70%;
    gap: 0.5rem;
}

.message-row.user .message-content-wrapper {
    align-items: flex-end;
}

.message-row.assistant .message-content-wrapper {
    align-items: flex-start;
}

.bubble {
    padding: 1rem 1.25rem;
    border-radius: 16px;
    font-size: 0.85rem;
    line-height: 1.6;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.bubble-user {
    background: linear-gradient(135deg, var(--secondary) 0%, var(--third-color) 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.bubble-assistant {
    background: white;
    color: var(--text-dark);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-bottom-left-radius: 4px;
}

.message-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-message-action {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: var(--text-light);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

    .btn-message-action:hover {
        background: var(--bg-light);
        color: var(--third-color);
    }

/* Indicateur de frappe */
.typing-indicator {
    display: flex;
    gap: 0.4rem;
    padding: 0.5rem 0;
}

    .typing-indicator span {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background-color: var(--secondary);
        animation: typing 1.4s infinite;
    }

        .typing-indicator span:nth-child(2) {
            animation-delay: 0.2s;
        }

        .typing-indicator span:nth-child(3) {
            animation-delay: 0.4s;
        }

/* Zone de saisie ChatRoom */
.chat-input-container {
    width: 100%;
    padding: 16px 24px;
    background: transparent;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
}

.attached-files {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 16px;
    max-width: 1000px;
    margin: 0 auto;
    width: 100%;
}

.chat-input-container .input-wrapper {
    max-width: 1000px;
    margin: 0 auto;
    width: 100%;
}

.actions-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 4px;
}

.right-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Contrôles spécifiques ChatRoom */
.domain-select {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: white;
    color: var(--text-dark);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

    .domain-select:hover {
        border-color: var(--secondary);
    }

    .domain-select:focus {
        outline: none;
        border-color: var(--secondary);
        box-shadow: 0 0 0 3px rgba(41, 132, 161, 0.1);
    }

.history-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    color: #6b7280;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
}

    .history-button:hover {
        background: #f3f4f6;
        color: var(--text-dark);
    }

    .history-button.active {
        background: var(--secondary);
        color: white;
    }

    .history-button.desactive {
        opacity: 0.5;
    }

@media (min-width: 640px) {
    .attach-button span {
        display: inline;
    }
}

@media (max-width: 768px) {
    /* Home */
    .home-content {
        gap: 2rem;
    }

    .welcome-title {
        font-size: 2rem;
    }

    .welcome-subtitle {
        font-size: 1.125rem;
    }

    .agents-grid {
        grid-template-columns: 1fr;
    }

    /* ChatRoom */
    .chatroom-messages {
        padding: 1rem;
    }

    .message-content-wrapper {
        max-width: 85%;
    }

    .chat-input-container {
        padding: 12px 16px;
    }

    .attached-files {
        padding: 10px 12px;
        gap: 6px;
    }

    /* Fichiers */
    .file-item {
        padding: 6px 10px;
        max-width: 200px;
    }

    .file-preview {
        width: 36px;
        height: 36px;
    }

    .file-name {
        font-size: 12px;
    }

    .file-size {
        font-size: 10px;
    }

    .remove-file-button {
        width: 20px;
        height: 20px;
    }

    /* Input wrapper */
    .input-wrapper {
        padding: 12px 16px;
        border-radius: 14px;
    }

        .input-wrapper.has-files {
            border-radius: 0 0 14px 14px;
        }

        .input-wrapper textarea {
            font-size: 14px;
        }

    /* Actions */
    .actions-row .right-actions {
        gap: 6px;
    }

    .voice-button,
    .send-button {
        width: 32px;
        height: 32px;
    }

    .domain-select {
        font-size: 12px;
        padding: 4px 8px;
    }
}

@media (max-width: 480px) {
    .bubble {
        padding: 0.875rem 1rem;
        font-size: 0.95rem;
    }

    .avatar {
        width: 36px;
        height: 36px;
    }

    .agent-card {
        padding: 1rem;
    }

    .agent-icon {
        width: 40px;
        height: 40px;
    }

    .agent-name {
        font-size: 1rem;
    }

    .agent-description {
        font-size: 0.85rem;
    }
}
