/* ============================================
   CHAT ASSISTANT - STYLES
   ============================================ */

.ib-chat-page .ib-content-inner {
    padding: 40px 32px 0 32px !important;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.ib-chat-wrapper {
    display: flex;
    flex-direction: column;
    flex: 1;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
    height: calc(100vh - 120px);
}

/* Messages Area */
.ib-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px 0;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.ib-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.ib-chat-messages::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

/* Message Bubbles */
.ib-message {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    opacity: 0;
    transform: translateY(10px);
    animation: messageSlideIn 0.4s ease-out forwards;
}

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

.ib-message--assistant {
    flex-direction: row;
}

.ib-message--user {
    flex-direction: row-reverse;
}

.ib-message__avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

.ib-message__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ib-message__content {
    max-width: 70%;
    padding: 14px 18px;
    border-radius: 16px;
    font-size: 15px;
    line-height: 1.5;
    word-wrap: break-word;
    position: relative;
}

.ib-message--assistant .ib-message__content {
    background: #ffffff;
    color: #111827;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.ib-message--user .ib-message__content {
    background: #0047FF;
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

/* Typing Indicator - PULSE DOT EXACT (comme compare-energy) */
.ib-typing-indicator {
    display: flex;
    gap: 12px;
    align-items: center;
    opacity: 0;
    transform: translateY(10px);
    animation: messageSlideIn 0.4s ease-out forwards;
}

.ib-typing-indicator .ib-message__avatar {
    width: 40px;
    height: 40px;
}

.ib-typing-dot {
    width: 12px;
    height: 12px;
    background: #000000;
    border-radius: 50%;
    animation: pulseDotEnergy 1s ease-in-out infinite;
    margin-left: 0;
}

body.wp-dark-mode-active .ib-typing-dot,
html.wp-dark-mode-active .ib-typing-dot,
.wp-dark-mode-active .ib-typing-dot,
body[data-theme="dark"] .ib-typing-dot {
    background: #9ca3af;
}

@keyframes pulseDotEnergy {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.5);
        opacity: 0.7;
    }
}

/* Input Area - EXACTEMENT COMME HOMEPAGE */
.ib-chat-input-wrapper {
	position: relative !important;
    padding: 20px 0;
    background: #F3F6FB;
	overflow: visible !important;
}

.ib-chat-limit-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    background: #FEF3C7;
    border: 1px solid #FDE68A;
    border-radius: 12px;
    margin-bottom: 12px;
    font-size: 13px;
    color: #92400E;
}

.ib-chat-limit-info svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Search Wrapper - STYLE HOMEPAGE */
.ib-search-wrapper {
    width: 100% !important;
}

.ib-search-input {
    width: 100% !important;
    padding: 20px 70px 20px 20px !important;
    border: 1px solid #d9d9e3 !important;
    border-radius: 28px !important;
    font-size: 16px !important;
    background: #ffffff !important;
    color: #111827 !important;
    transition: all 0.2s ease !important;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.03) !important;
    height: 60px !important;
    line-height: 1.5 !important;
}

.ib-search-input:hover {
    border-color: #b4b4b4 !important;
}

.ib-search-input:focus {
    outline: none !important;
    border: 1px solid #6b7280 !important;
    background: #ffffff !important;
    color: #111827 !important;
    box-shadow: 0 0 0 3px rgba(107, 114, 128, 0.1) !important;
}

.ib-search-input::placeholder {
    color: #8e8ea0 !important;
}

.ib-search-submit {
    position: absolute !important;
    right: 10px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 40px !important;
    height: 40px !important;
    background: #000000 !important;
    border: none !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s ease !important;
    padding: 3px !important;
}

.ib-search-submit:hover {
    background: #2d2d2d !important;
    transform: translateY(-50%) scale(1.05) !important;
}

.ib-search-submit:disabled {
    background: #d1d5db !important;
    cursor: not-allowed !important;
}

.ib-search-submit__icon {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
}

/* Limit Modal */
.ib-limit-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
}

.ib-limit-modal.show {
    display: flex;
    animation: fadeIn 0.3s ease-out;
}

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

.ib-limit-modal__content {
    background: #ffffff;
    border-radius: 16px;
    padding: 32px;
    max-width: 500px;
    width: 100%;
    text-align: center;
    animation: modalSlideUp 0.3s ease-out;
}

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

.ib-limit-modal__icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    background: #FEF3C7;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ib-limit-modal__icon svg {
    width: 32px;
    height: 32px;
    color: #D97706;
}

.ib-limit-modal h3 {
    font-size: 24px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 12px 0;
}

.ib-limit-modal p {
    font-size: 15px;
    color: #6b7280;
    line-height: 1.6;
    margin: 0 0 24px 0;
}

.ib-limit-modal__btn {
    display: inline-block;
    padding: 12px 32px;
    background: #0047FF;
    color: #ffffff;
    text-decoration: none;
    border-radius: 50px;
    font-weight: 600;
    transition: all 0.2s;
}

.ib-limit-modal__btn:hover {
    background: #0039cc;
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 71, 255, 0.2);
}

/* Responsive */
@media (max-width: 768px) {
    .ib-chat-page .ib-content-inner {
        padding: 40px 16px 0 16px !important;
    }
    
    .ib-chat-wrapper {
        height: calc(100vh - 100px);
    }
    
    .ib-message__content {
        max-width: 85%;
        font-size: 14px;
    }
    
    .ib-search-input {
        font-size: 14px !important;
        padding: 16px 60px 16px 16px !important;
        height: 52px !important;
    }
    
    .ib-search-submit {
        width: 36px !important;
        height: 36px !important;
    }
    
    .ib-limit-modal__content {
        padding: 24px;
    }
}


/* Conteneur du formulaire = repère pour l'icône */
#chatForm {
    position: relative;
}

/* Bouton pièce jointe façon ChatGPT */
.ib-chat-attach-btn {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    border-radius: 999px;
    border: none;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
    opacity: 0.8;
    transition: background 0.15s ease, opacity 0.15s ease, transform 0.1s ease;
}

/* Masqué par défaut, JS ne l'activera que pour plan=expert */
.ib-chat-attach-btn {
    display: none;
}

/* Quand Expert → on ajoute une classe au form pour activer */
#chatForm.ib-has-attach .ib-chat-attach-btn {
    display: flex;
}

.ib-chat-attach-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    opacity: 1;
}

/* Légère correction du padding de l'input quand icône présente */
#chatForm.ib-has-attach #chatInput {
    padding-left: 44px !important;
}



/* caché par défaut */
.ib-chat-upload-menu {
    display: none;
}

.ib-chat-upload-menu.show {
    display: block;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.ib-chat-upload-item {
    width: 100%;
    padding: 8px 14px;
    background: transparent;
    border: none;
    text-align: left;
    font-size: 13px;
    color: #111827;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

#chatUploadMenu:hover {
    background: #f3f4f6;
}

#chatUploadMenu {
    position: absolute;
    bottom: 56px;
    left: 10px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 18px;
    width: 180px;
    padding: 8px 0;
    box-shadow: 0 4px 14px rgba(0,0,0,0.15);
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
    transition: all 0.22s ease;
    z-index: 9000;
}

#chatUploadMenu.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
#chatFileTag {
    position:absolute;
    left:50px;
    top:50%;
    transform:translateY(-50%);
    background:#f3f4f6;
    border:1px solid #d1d5db;
    padding:4px 10px;
    border-radius:14px;
    font-size:12px;
    display:flex;
    align-items:center;
    gap:6px;
    color:#374151;
}
#chatFileRemove {
    cursor:pointer;
    font-weight:bold;
}

#chatForm.ib-has-file #chatInput {
    padding-top: 46px !important; 
    height: 80px !important;       
}


/* Conteneur du PDF tag */
.ib-chat-file-badge {
    position: absolute;
    top: 8px;
    left: 50px;
    display: flex;
    align-items: center;
    gap: 6px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 13px;
    color: #374151;
    z-index: 20;
}

/* bouton X */
.ib-chat-file-remove {
    cursor: pointer;
    font-weight: bold;
    color: #555;
}

.ib-chat-file-remove:hover {
    color: #111;
}

