/* Styles spécifiques au chat principal. Les styles de base sont dans chat-common.css */

@import url('chat-common.css');

/* Styles spécifiques : section, background, notifications, suggestions, modales, etc. */

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

.chat-page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    height: 100vh;
    background: #f6f7fb;
}

.container {
    max-width: 700px;
    margin: 0 auto;
    padding: 0 1.2rem;
    width: 100%;
    box-sizing: border-box;
}

.chat-top-bar {
    display: none !important;
}

.chat-top-bar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0;
}

.chat-top-bar .logo-text {
    font-size: 1.3rem;
    font-weight: 700;
    color: #2C5545;
}

.chat-top-bar .highlight {
    color: #d4a373;
}

.chat-top-bar .chat-logout-btn {
    background: #e3f2fd;
    color: #2C5545;
    border-radius: 1.2rem;
    padding: 0.4rem 1.1rem;
    font-size: 0.95rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    letter-spacing: 0.01em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chat-main {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    background: transparent;
}

.chat-main > .container {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    padding: 0 0 0 0;
}

.chat-messages {
    flex: 1 1 auto;
    overflow-y: auto;
    min-height: 0;
    padding: 24px 0 16px 0;
    display: flex;
    flex-direction: column;
    gap: 18px;
    background: transparent;
    padding-top: 2rem !important;
}

.chat-input-container {
    flex-shrink: 0;
    position: sticky;
    bottom: 0;
    background: #f6f7fb;
    z-index: 2;
    display: flex;
    gap: 10px;
    padding: 18px 0 10px 0;
    border-top: 1px solid #e0e0e0;
}

.chat-input {
    flex: 1;
    padding: 14px 18px;
    border: 1px solid #ddd;
    border-radius: 18px;
    font-size: 1.05rem;
    resize: none;
    min-height: 44px;
    max-height: 120px;
    overflow-y: auto;
    background: #fff;
    color: #222;
    box-shadow: 0 2px 4px rgba(44,85,69,0.03);
}

.chat-input:focus {
    outline: none;
    border-color: #2C5545;
    box-shadow: 0 0 0 2px rgba(44, 85, 69, 0.08);
}

.send-button {
    background: #2C5545;
    color: #fff;
    border: none;
    padding: 14px 22px;
    border-radius: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    align-self: flex-end;
    box-shadow: 0 2px 4px rgba(44,85,69,0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}
.send-button:hover {
    background: #3e7a5a;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(44,85,69,0.10);
}

.suggestions-bar {
    display: flex;
    gap: 0.5rem;
    margin: 0.5rem 0 0.5rem 0;
    flex-wrap: wrap;
}

/* Styles pour les tableaux avec scroll horizontal */
.table-scroll {
    overflow-x: auto;
    background: #fff;
    border-radius: 8px;
    padding: 8px 4px 8px 4px;
    margin: 12px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border: 1px solid #e8e8e8;
    max-width: 100%;
}

.chat-message table {
    display: table;
    width: 100%;
    min-width: 400px;
    border-collapse: collapse;
    margin: 0;
    background: #fff;
    font-size: 0.95em;
    line-height: 1.4;
}

.chat-message th, .chat-message td {
    border: 1px solid #e0e0e0;
    padding: 8px 12px;
    text-align: left;
    white-space: nowrap;
}

.chat-message th {
    background: #f8f9fa;
    font-weight: 600;
    color: #2C5545;
    position: sticky;
    top: 0;
    z-index: 1;
}

.chat-message tr:nth-child(even) td {
    background: #fafbfc;
}

.chat-message tr:hover td {
    background: #f0f4f8;
}

/* Bouton copier pour les tableaux */
.copy-table-btn {
    display: inline-block;
    background: #2C5545;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 0.9em;
    margin-bottom: 8px;
    cursor: pointer;
    float: right;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(44,85,69,0.1);
}

.copy-table-btn:hover {
    background: #3e7a5a;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(44,85,69,0.15);
}

/* Bouton "Voir le détail" pour la synthèse */
.show-summary-btn {
    background: #2C5545;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 7px 16px;
    font-size: 1em;
    margin: 10px 0 8px 0;
    cursor: pointer;
    transition: background 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
    display: inline-block;
}

.show-summary-btn:hover {
    background: #3e7a5a;
}

/* Style pour le texte en gras dans les messages */
.chat-message .message-content strong {
    font-weight: 600;
    color: #2C5545;
}

/* Responsive pour les tableaux */
@media (max-width: 700px) {
    .chat-message table {
        font-size: 0.9em;
        min-width: 300px;
    }
    
    .chat-message th, .chat-message td {
        padding: 6px 8px;
    }
    
    .table-scroll {
        padding: 4px 2px 4px 2px;
        margin: 8px 0;
    }
    
    .copy-table-btn {
        font-size: 0.85em;
        padding: 5px 10px;
    }
}

@media (max-width: 480px) {
    .chat-message table {
        font-size: 0.85em;
        min-width: 250px;
    }
    
    .chat-message th, .chat-message td {
        padding: 4px 6px;
    }
}

/* Notifications */
.notification {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    padding: 1rem;
    background-color: #4caf50;
    color: white;
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

/* Suggestions */
.suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.suggestion-chip {
    background-color: #e3f2fd;
    padding: 0.5rem 1rem;
    border-radius: 1rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.suggestion-chip:hover {
    background-color: #bbdefb;
}

/* Modales */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

.modal-content {
    position: relative;
    background-color: white;
    margin: 10% auto;
    padding: 2rem;
    width: 90%;
    max-width: 500px;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.close-button {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
}

/* Scrollbar personnalisée */
.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(74, 144, 226, 0.5);
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(74, 144, 226, 0.7);
}

/* Responsive Design */
@media (max-width: 700px) {
    .container {
        padding: 0 0.5rem;
    }
    .chat-main {
        padding: 0;
    }
    .chat-top-bar {
        padding: 0.5rem 0.7rem;
        min-height: 44px;
    }
    .chat-top-bar .logo-text {
        font-size: 1.05rem;
    }
    .chat-messages {
        padding-bottom: 0.5rem !important;
        padding-top: 0.7rem !important;
        gap: 12px;
    }
    .chat-input {
        font-size: 1rem;
        padding: 10px 8px;
    }
    .send-button {
        font-size: 1rem;
        padding: 10px 12px;
    }
    .chat-input-container {
        padding-bottom: env(safe-area-inset-bottom, 8px);
    }
}

/* Styles des messages */
.message {
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    max-width: 80%;
}

.message-time {
    font-size: 0.8rem;
    color: #cccccc;
    margin-top: 0.5rem;
}

/* Styles des boutons d'action */
.action-button {
    display: flex;
    align-items: center;
    padding: 1rem;
    background-color: white;
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.action-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.action-button .icon {
    font-size: 1.5rem;
    margin-right: 0.75rem;
}

/* Animation de chargement */
.typing-indicator {
    display: flex;
    align-items: center;
    padding: 0.5rem;
}

.typing-indicator span {
    height: 8px;
    width: 8px;
    background-color: #90caf9;
    border-radius: 50%;
    display: inline-block;
    margin: 0 2px;
    animation: typing 1s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
    100% { transform: translateY(0); }
}

.loading-indicator {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 10px 20px;
    border-radius: 20px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    display: none;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Modale agents (mobile) */
.modal-agents {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(44,85,69,0.12);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-agents-content {
    background: #fff;
    border-radius: 18px;
    padding: 2rem 1.2rem 1.2rem 1.2rem;
    box-shadow: 0 8px 32px rgba(44,85,69,0.12);
    min-width: 240px;
    max-width: 90vw;
    text-align: center;
    position: relative;
}
.close-modal-agents {
    position: absolute;
    top: 0.7rem;
    right: 1.1rem;
    background: none;
    border: none;
    font-size: 2rem;
    color: #2C5545;
    cursor: pointer;
}
.modal-agents-content ul {
    list-style: disc inside;
    padding: 0;
    margin: 1.2rem 0 0.5rem 0;
}
.modal-agents-content li {
    margin-bottom: 0.7rem;
}
.modal-agents-info {
    font-size: 0.95rem;
    color: #666;
    margin-top: 0.7rem;
}

/* Mobile : masquer la barre d'agents, afficher le bouton Agents */
@media (max-width: 700px) {
    .chat-agents > .agent-badge:not(.agent-badge-mobile) {
        display: none !important;
    }
    .chat-agents > .agent-badge-mobile {
        display: inline-block !important;
    }
    .chat-agents {
        justify-content: flex-end;
        margin-bottom: 0.5rem;
    }
    .chat-header {
        margin-top: 0.2rem;
    }
    .chat-messages {
        padding-bottom: 0.5rem !important;
    }
    .chat-input-container {
        padding-bottom: env(safe-area-inset-bottom, 8px);
    }
}

/* On retire le footer, le header sticky, etc. (déjà supprimés du HTML) */
.footer, .header {
    display: none !important;
}

/* Actions à droite dans la barre du haut */
.chat-top-actions {
    display: flex;
    align-items: center;
    gap: 0.7rem;
}

.chat-top-bar .chat-agents {
    display: flex;
    gap: 0.3rem;
    margin: 0;
}

.agent-badge {
    background: #e3f2fd;
    color: #2C5545;
    border-radius: 1.2rem;
    padding: 0.25rem 0.7rem;
    font-size: 0.90rem;
    font-weight: 500;
    border: none;
    cursor: not-allowed;
    letter-spacing: 0.01em;
    opacity: 0.6;
    margin: 0;
}

/* On retire la chat-header (Assistant IA) donc pas besoin de style */
.chat-header {
    display: none !important;
}

/* Réduction de l'espace en haut du fil de discussion */
.chat-messages {
    padding-top: 8px !important;
}

/* Suggestions compactes */
.suggestions-bar.compact {
    display: flex;
    gap: 0.3rem;
    margin: 0.3rem 0 0.2rem 0;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 0.1rem;
}

@media (max-width: 700px) {
    .chat-top-bar .chat-agents {
        display: none !important;
    }
    .suggestions-bar.compact {
        gap: 0.2rem;
        padding-bottom: 0.1rem;
    }
}

/* Logo sticky en haut à gauche */
.logo-sticky {
    position: absolute;
    top: 0.7rem;
    left: 1.2rem;
    z-index: 10;
}
.logo-sticky .logo-text {
    font-size: 1.15rem;
    font-weight: 700;
    color: #2C5545;
}
.logo-sticky .highlight {
    color: #d4a373;
}

/* Déconnexion sticky en haut à droite, discret */
.account-sticky {
    position: absolute;
    top: 0.7rem;
    right: 1.2rem;
    z-index: 10;
    background-color: rgba(44, 85, 69, 0.1);
    color: #2C5545;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 600;
    font-size: 0.95rem;
}
.account-sticky:hover {
    background-color: #2C5545;
    color: #FFFFFF;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
.account-sticky .account-text {
    font-size: 0.97rem;
    font-weight: 400;
    margin-left: 0.3rem;
}

/* Mobile : header fin + textes plus petits */
@media (max-width: 700px) {
    /* Header fin sur mobile */
    .chat-page {
        padding-top: 3rem;
    }
    .logo-sticky {
        left: 0.5rem;
        top: 0.4rem;
        font-size: 1rem;
    }
    .account-sticky {
        right: 0.5rem;
        top: 0.4rem;
        font-size: 0.9rem;
        padding: 6px 12px;
    }
    .account-sticky .account-text {
        display: none;
    }
    
    /* Textes plus petits sur mobile */
    .chat-messages {
        padding-top: 0.5rem !important;
        gap: 12px;
    }
    .chat-message {
        font-size: 0.9rem;
        padding: 10px 12px;
        line-height: 1.5;
    }
    .suggestion-btn {
        font-size: 0.85rem;
        padding: 0.2rem 0.5rem;
    }
    .chat-input {
        font-size: 0.95rem;
        padding: 8px 10px;
    }
    .send-button {
        font-size: 0.95rem;
        padding: 8px 10px;
    }
    .container {
        padding: 0 0.5rem;
    }
    .suggestions-bar.no-scroll {
        gap: 0.2rem;
        padding-bottom: 0.1rem;
    }
}

/* Suppression de la barre supérieure */
.chat-top-bar, .chat-top-actions, .chat-header {
    display: none !important;
}

/* Le fil de discussion commence tout en haut avec une petite marge */
.chat-messages {
    padding-top: 2rem !important;
}

/* Suggestions sans scroll horizontal, retour à la ligne */
.suggestions-bar.no-scroll {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin: 0.3rem 0 0.2rem 0;
    padding-bottom: 0.1rem;
}
.suggestion-btn {
    background: #f0f4f8;
    color: #2C5545;
    border: none;
    border-radius: 1.2rem;
    padding: 0.3rem 0.7rem;
    font-size: 0.93rem;
    margin-bottom: 0;
    cursor: pointer;
    transition: background 0.2s;
    white-space: normal;
    min-width: 0;
}
.suggestion-btn:hover {
    background: #e3f2fd;
}

/* Plus de scroll horizontal global */
html, body {
    overflow-x: hidden;
}

@media (max-width: 700px) {
    .container {
        padding: 0 0.5rem;
    }
    .suggestions-bar.no-scroll {
        gap: 0.2rem;
        padding-bottom: 0.1rem;
    }
    .suggestion-btn {
        font-size: 0.78rem;
        padding: 0.18rem 0.4rem;
    }
}

#load-history-btn, .load-history-btn-discret {
    background: transparent;
    color: #888;
    border: none;
    font-size: 0.97em;
    padding: 2px 10px;
    margin: 0 0 8px 0;
    border-radius: 8px;
    cursor: pointer;
    opacity: 1;
    transition: opacity 0.3s;
    box-shadow: none;
    outline: none;
    position: relative;
    left: 0;
    z-index: 2;
    font-family: inherit;
}
#load-history-btn:hover, .load-history-btn-discret:hover {
    color: #2C5545;
    background: #f6f7fb;
    text-decoration: underline;
    opacity: 1;
}
#load-history-btn:active, .load-history-btn-discret:active {
    color: #2C5545;
    background: #e3f2fd;
}

.notion-connect-btn-green {
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 7px 16px;
    font-size: 1em;
    margin: 10px 0 8px 0;
    cursor: pointer;
    transition: background 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
    display: inline-block;
    font-weight: 600;
}
.notion-connect-btn-green:hover {
    background: var(--color-primary-light);
} 

.notion-cache-btns {
    display: flex;
    gap: 12px;
    margin: 12px 0 8px 0;
    justify-content: flex-start;
}
.notion-cache-btn {
    background: #2980b9;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 7px 18px;
    font-size: 1em;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    transition: background 0.2s, box-shadow 0.2s;
    outline: none;
    vertical-align: middle;
    display: inline-block;
}
.notion-cache-btn:hover, .notion-cache-btn:focus {
    background: #1c5d8c;
    box-shadow: 0 4px 12px rgba(41,128,185,0.15);
}
.notion-cache-btn:disabled {
    background: #b2bec3;
    color: #fff;
    cursor: not-allowed;
} 

.notion-stop-svg-btn {
    background: none;
    border: none;
    padding: 0 4px;
    margin-left: 6px;
    cursor: pointer;
    vertical-align: middle;
    outline: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    width: 40px;
    transition: background 0.2s;
}
.notion-stop-svg-btn:hover, .notion-stop-svg-btn:focus {
    background: #fbeeea;
}
.notion-stop-svg-btn svg {
    display: block;
} 