/* /assets/css/style-edge-fixes.css */
/* 
 * Correctifs spécifiques pour Microsoft Edge (EdgeHTML et Chromium Legacy)
 * À inclure APRÈS style.css dans header.php
 * 
 * IMPORTANT: Ce fichier ajoute uniquement des préfixes -ms- (ignorés par Chrome/Firefox)
 * et des fallbacks conditionnels via @supports pour éviter toute régression.
 */

/* =================================================================
   PRÉFIXES FLEXBOX POUR EDGE LEGACY (sans effet sur navigateurs modernes)
   ================================================================= */

.chat-shell-inner {
    display: -ms-flexbox;
    display: flex;
    -ms-flex-direction: column;
    flex-direction: column;
}

@media (min-width: 1024px) {
    .chat-shell-inner {
        -ms-flex-direction: row;
        flex-direction: row;
    }
}

.chat-sidebar.collapsed .sidebar-primary-button {
    display: -ms-flexbox;
    display: flex;
    -ms-flex-direction: column;
    flex-direction: column;
}

.sidebar-icon-button {
    display: -ms-inline-flexbox;
    display: inline-flex;
    -ms-flex-align: center;
    align-items: center;
    -ms-flex-pack: center;
    justify-content: center;
}

.sidebar-primary-button {
    display: -ms-inline-flexbox;
    display: inline-flex;
    -ms-flex-align: center;
    align-items: center;
    -ms-flex-pack: center;
    justify-content: center;
}

.conversation-item {
    display: -ms-flexbox;
    display: flex;
    -ms-flex-align: center;
    align-items: center;
    -ms-flex-pack: justify;
    justify-content: space-between;
}

.conversation-link {
    -ms-flex: 1 1 auto;
    flex: 1 1 auto;
}

.conversation-actions {
    display: -ms-flexbox;
    display: flex;
    -ms-flex-align: center;
    align-items: center;
}

.model-chip {
    display: -ms-inline-flexbox;
    display: inline-flex;
    -ms-flex-align: center;
    align-items: center;
}

.header-icon-button {
    display: -ms-inline-flexbox;
    display: inline-flex;
    -ms-flex-align: center;
    align-items: center;
    -ms-flex-pack: center;
    justify-content: center;
}

.chat-controls {
    display: -ms-flexbox;
    display: flex;
    -ms-flex-direction: column;
    flex-direction: column;
}

.controls-pill {
    display: -ms-inline-flexbox;
    display: inline-flex;
    -ms-flex-align: center;
    align-items: center;
}

.form-field {
    display: -ms-flexbox;
    display: flex;
    -ms-flex-direction: column;
    flex-direction: column;
}

.resume-banner {
    display: -ms-flexbox;
    display: flex;
    -ms-flex-align: center;
    align-items: center;
    -ms-flex-pack: justify;
    justify-content: space-between;
}

.chat-thread {
    -ms-flex: 1 1 auto;
    flex: 1 1 auto;
    display: -ms-flexbox;
    display: flex;
    -ms-flex-direction: column;
    flex-direction: column;
}

.chat-message {
    display: -ms-flexbox;
    display: flex;
    -ms-flex-align: start;
    align-items: flex-start;
}

.chat-message-actions {
    display: -ms-flexbox;
    display: flex;
}

.chat-message-actions button {
    display: -ms-inline-flexbox;
    display: inline-flex;
    -ms-flex-align: center;
    align-items: center;
    -ms-flex-pack: center;
    justify-content: center;
}

.composer-row {
    display: -ms-flexbox;
    display: flex;
    -ms-flex-direction: column;
    flex-direction: column;
    -ms-flex-align: stretch;
    align-items: stretch;
}

.composer-textarea {
    -ms-flex: 0 1 auto;
    flex: 0 1 auto;
}

.composer-actions {
    display: -ms-flexbox;
    display: flex;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
    -ms-flex-align: center;
    align-items: center;
    -ms-flex-pack: justify;
    justify-content: space-between;
}

.composer-actions-left,
.composer-actions-right {
    display: -ms-flexbox;
    display: flex;
    -ms-flex-align: center;
    align-items: center;
}

.composer-icon-button,
.composer-new-chat-button,
.composer-send-button {
    display: -ms-inline-flexbox;
    display: inline-flex;
    -ms-flex-align: center;
    align-items: center;
    -ms-flex-pack: center;
    justify-content: center;
}

.composer-chip {
    display: -ms-inline-flexbox;
    display: inline-flex;
    -ms-flex-align: center;
    align-items: center;
}

.attachment-preview {
    display: -ms-flexbox;
    display: flex;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
}

.attachment-chip {
    display: -ms-inline-flexbox;
    display: inline-flex;
    -ms-flex-align: center;
    align-items: center;
}

.dashboard-layout {
    display: -ms-grid;
    display: grid;
}

@media (min-width: 1024px) {
    .dashboard-layout {
        -ms-grid-columns: 320px 1fr;
        grid-template-columns: 320px minmax(0, 1fr);
        -ms-flex-align: start;
        align-items: start;
    }
}

.dashboard-sidebar {
    display: -ms-flexbox;
    display: flex;
    -ms-flex-direction: column;
    flex-direction: column;
}

.dashboard-main {
    display: -ms-flexbox;
    display: flex;
    -ms-flex-direction: column;
    flex-direction: column;
}

.dashboard-quick-card {
    display: -ms-flexbox;
    display: flex;
    -ms-flex-direction: column;
    flex-direction: column;
}

.dashboard-quick-card-header {
    display: -ms-flexbox;
    display: flex;
    -ms-flex-align: center;
    align-items: center;
}

.dashboard-quick-card-text {
    display: -ms-flexbox;
    display: flex;
    -ms-flex-direction: column;
    flex-direction: column;
}

.dashboard-quick-card-icon {
    display: -ms-flexbox;
    display: flex;
    -ms-flex-align: center;
    align-items: center;
    -ms-flex-pack: center;
    justify-content: center;
}

.dashboard-title-row {
    display: -ms-flexbox;
    display: flex;
    -ms-flex-align: center;
    align-items: center;
}

.dashboard-info-wrapper {
    display: -ms-flexbox;
    display: flex;
    -ms-flex-align: center;
    align-items: center;
}

.dashboard-info-btn {
    display: -ms-inline-flexbox;
    display: inline-flex;
    -ms-flex-align: center;
    align-items: center;
    -ms-flex-pack: center;
    justify-content: center;
}

.memory-notification-header {
    display: -ms-flexbox;
    display: flex;
    -ms-flex-align: center;
    align-items: center;
}

.memory-notification-actions {
    display: -ms-flexbox;
    display: flex;
}

header.flex {
    display: -ms-flexbox;
    display: flex;
    -ms-flex-pack: justify;
    justify-content: space-between;
    -ms-flex-align: center;
    align-items: center;
}

header .flex {
    display: -ms-flexbox;
    display: flex;
    -ms-flex-align: center;
    align-items: center;
}

/* =================================================================
   PRÉFIXES BACKDROP-FILTER
   ================================================================= */

#chat-sidebar-backdrop {
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.chat-main {
    -webkit-backdrop-filter: saturate(140%);
    backdrop-filter: saturate(140%);
}

.chat-composer {
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

/* =================================================================
   FALLBACKS CONDITIONNELS - Uniquement appliqués si gap non supporté
   ================================================================= */

@supports not (gap: 1rem) {
    /* Remplacement de gap par des marges - uniquement pour Edge Legacy */
    
    .chat-shell-inner {
        margin: -0.5rem;
    }
    .chat-shell-inner > * {
        margin: 0.5rem;
    }
    
    .chat-sidebar.collapsed .sidebar-primary-button {
        margin: -0.125rem;
    }
    .chat-sidebar.collapsed .sidebar-primary-button > * {
        margin: 0.125rem;
    }
    
    .sidebar-primary-button > svg {
        margin-right: 10px;
    }
    .sidebar-primary-button > svg:last-child {
        margin-right: 0;
    }
    
    .conversation-item > * + * {
        margin-left: 12px;
    }
    
    .conversation-actions > * + * {
        margin-left: 8px;
    }
    
    .model-chip > * + * {
        margin-left: 6px;
    }
    
    .chat-controls > * + * {
        margin-top: 1.5rem;
    }
    
    .controls-pill > * + * {
        margin-left: 8px;
    }
    
    .form-field > * + * {
        margin-top: 6px;
    }
    
    .resume-banner > * + * {
        margin-left: 1rem;
    }
    
    .chat-thread > * + * {
        margin-top: 1.1rem;
    }
    
    .chat-message-actions > * + * {
        margin-left: 8px;
    }
    
    .chat-message-actions button > * + * {
        margin-left: 6px;
    }
    
    .composer-row > * + * {
        margin-top: 0.75rem;
    }
    
    .composer-actions {
        margin: -0.375rem;
    }
    .composer-actions > * {
        margin: 0.375rem;
    }
    
    .composer-actions-left,
    .composer-actions-right {
        margin: -0.25rem;
    }
    .composer-actions-left > *,
    .composer-actions-right > * {
        margin: 0.25rem;
    }
    
    .composer-chip > * + * {
        margin-left: 8px;
    }
    
    .attachment-preview {
        margin: -0.3rem;
    }
    .attachment-preview > * {
        margin: 0.3rem;
    }
    
    .attachment-chip > * + * {
        margin-left: 0.5rem;
    }
    
    .dashboard-sidebar > * + * {
        margin-top: 1rem;
    }
    
    .dashboard-main > * + * {
        margin-top: 1.5rem;
    }
    
    .dashboard-quick-card > * + * {
        margin-top: 1.25rem;
    }
    
    .dashboard-quick-card--condensed > * + * {
        margin-top: 0.85rem;
    }
    
    .dashboard-quick-card-header > * + * {
        margin-left: 1rem;
    }
    
    .dashboard-quick-card-text > * + * {
        margin-top: 0.5rem;
    }
    
    .dashboard-title-row > * + * {
        margin-left: 0.5rem;
    }
    
    .memory-notification-header > * + * {
        margin-left: 8px;
    }
    
    .memory-notification-actions > * + * {
        margin-left: 8px;
    }
    
    /* Fallback backdrop-filter */
    #chat-sidebar-backdrop {
        background: rgba(15, 23, 42, 0.5);
    }
    
    .chat-composer {
        background: rgba(248, 250, 252, 1) !important;
    }
}

/* =================================================================
   FALLBACK SAFE-AREA-INSET (avec valeur par défaut)
   ================================================================= */

.chat-composer {
    padding-bottom: 1.5rem;
    padding-bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
}
