/* Styles pour le résumé contextuel */
.context-summary-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px;
    background-color: rgba(255, 255, 255, 0.65);
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    height: auto !important;
    margin-top: 10px;
    max-width: 1200px;
    
}

.context-summary-container:hover {
    background-color: rgba(255, 255, 255, 0.8);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

/* Classe pour l'état fermé du mini-contexte */
fieldset#main-fields.summary-close > div {
    width: fit-content;
}

fieldset#main-fields.summary-close > div > label {
    max-width: 15px;
    overflow: hidden;
}

fieldset#main-fields.summary-close .context-summary-container {
    max-width: 170px;
}


fieldset#main-fields.summary-close .context-summary-header h4 {
    font-size: 8px;
    color: rgba(255, 255, 255, 0.5);
}

fieldset#main-fields.summary-close .context-summary-header h4 i {
    color: var(--accent-color);
    font-size: 12px;
    padding: 0px 5px;
}

fieldset#main-fields.summary-close .summary-section .section-header .section-title {
    overflow: hidden;
    flex: inherit;
    max-width: 0px;
}

fieldset#main-fields.summary-close .summary-section.streams-section .section-header .section-title {
    max-width: 15px;
    margin-right: auto;
}

fieldset#main-fields.summary-close .context-target-buttons {
    max-height: 0;
    overflow: hidden;
}

fieldset#main-fields.summary-close .summary-section.layers-section .section-content .stat-item.secondary .stat-label{
    max-width: 25px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

fieldset#main-fields.summary-close .context-summary-header button.context-refresh-btn,
fieldset#main-fields.summary-close .context-summary-header button.context-refresh-btn i {
    max-width: 0;
    overflow: hidden;
    margin: 0;
    padding: 0;
    user-select: none;
    pointer-events: none;
}

fieldset#main-fields.summary-close .context-target-buttons button.btn.btn-sm.btn-shadow {
    width: 50px;
    color: transparent;
}

fieldset#main-fields.summary-close .context-target-buttons button.btn.btn-sm.btn-shadow i {
    width: 30px;
    color: white;
}

/* Cacher le fieldset main-fields quand on est sur certaines sections */
fieldset#main-fields {
    /*height: 25px;*/
    color: #fff;
    background-color: transparent;
    border: none;
    display: flex;
    /*width: 100vw;*/
    justify-content: center;
    line-height: 25px;
    flex-wrap: nowrap;
    flex-direction: column;
    margin: 10px 0;
    padding: 0 1vw;
    z-index: -1;
    transition: opacity 0.3s ease;
    margin-right: auto;
    gap: 7px;
    pointer-events: none;
    user-select: none;
}

fieldset#main-fields>div {
    display: flex;
    font-size: 0.8rem;
    background-color: rgba(8, 22, 35, 0.5);
    border-radius: 20px;
    justify-content: space-between;
    align-items: center;
    padding: 2px 10px;
    box-shadow: -4px 4px 0 rgba(255, 255, 255, 0.3);
    outline: 1px solid var(--accent-color);
    transition: all .2s ease;
    text-wrap: nowrap;
    margin-bottom: 10px;
}

fieldset#main-fields>div:hover {
    outline-color: white;
    box-shadow: -6px 6px 0 rgba(255, 255, 255, 0.5);
    background-color: rgba(8, 22, 35, 0.7);
}

fieldset#main-fields>div.context-summary-container {
    padding-left: 0;
    padding-right: 0;
    padding-top: 0;
    box-shadow: -6px 6px 0 rgba(0, 0, 0, 0.3);
    background-color: rgba(8, 22, 35, 0.5);
    outline-color: var(--primary-color);
}

fieldset#main-fields>div.context-summary-container:hover {
    outline-color: var(--accent-color);
    box-shadow: -8px 8px 0 rgba(0, 0, 0, 0.57);
    background-color: rgba(8, 22, 35, 0.7);
}

fieldset#main-fields>div>label>i {
    color: var(--accent-color);
}

.section-data fieldset#main-fields>div>label>i {
    color: white;
}

fieldset#main-fields input#Date_t:focus-visible,
fieldset#main-fields input#Date:focus-visible,
select#site:focus-visible {
    border-color: var(--tertiary-color);
    outline: 2px solid var(--accent-color-focus);
    /* Couleur bleue douce */
    outline-offset: -2px;
    /* Décale un peu l'outline pour l'effet visuel */
    transition: outline 0.2s ease;
}

/* Styles pour les éléments select et input */
fieldset#main-fields>div select,
fieldset#main-fields input {
    border-radius: 10px;
    font-family: var(--font-title);
    background-color: rgba(255, 255, 255, 0.5);
    border: 1px solid transparent;
    padding: 0 10px;
    transition: all 0.2s ease;
    display: flex;
    padding-right: 20px;
    padding-left: 4px;
    font-size: 11px;
    line-height: 24px;
    height: 25px;
    font-weight: 600;
    color: #2c3e50;
    margin: 0;
    transition: all .2s ease;
    transform: scale(1);
}

/* Police différente pour les options du select */
fieldset#main-fields>div select option {
    font-family: var(--font-main);
    font-size: 11px;
}

fieldset#main-fields .select2 {
    border-radius: 10px;
    font-size: calc(var(--main-bar-height)/5);
    line-height: var(--main-bar-height);
    font-family: var(--font-title);
    background-color: rgba(255, 255, 255, 0.5);
    border: 1px solid transparent;
    padding: 0 10px;
    transition: all 0.2s ease;
    height: 25px;
}

fieldset#main-fields>div:hover .select2,
fieldset#main-fields .select2:hover,
fieldset#main-fields input:hover,
fieldset#main-fields>div select:hover,
fieldset#main-fields>div:hover select {
    transform: scale(1.01);
    background-color: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--primary-color);
}

fieldset#main-fields label {
    margin-left: 0;
    margin-right: .5rem;
    white-space: nowrap;
}

fieldset#main-fields .select2-selection--single {
    border: none !important;
}

fieldset#main-fields .select2-container--default .select2-selection--single {
    background-color: transparent !important;
}

.context-summary-header {
    display: flex;
    margin: 0;
    width: 100%;
    text-align: center;
    justify-content: center;
    align-items: center;
    background: #0000003d;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    margin-top: -2px;
    position: relative;
}

.context-summary-header h4 {
    margin: 0;
    font-size: 13px;
    font-weight: initial;
    color: var(--accent-color);
}

.context-summary-header h4 i {
    color: white;
}

.context-summary-content {
    font-size: 11px;
    width: 100%;
    border-radius: 20px;
    padding: 2px;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3px;
}

.summary-item .label {
    font-weight: 500;
    color: white;
    margin-right: 10px;
}

.summary-item .value {
    font-weight: 400;
    color: white;
}

.streams-summary {
    margin-top: 5px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
}

.streams-summary .streams-header {
    margin-bottom: 2px;
    font-size: 14px;
    text-align: center;
}

/* Styles pour la liste des dates condensée */
.dates-summary {
    margin-top: 5px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    padding-top: 5px;
    display: flex;
    flex-direction: column;
}

.dates-header {
    font-weight: 500;
    margin-bottom: 5px;
}

.dates-list-compact {
    display: flex;
    flex-wrap: wrap;
    max-width: 400px;
    gap: 5px;
    font-size: 10px;
}

.date-item-compact {
    padding: 2px 5px;
    border-radius: 3px;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 3px;
    background-color: rgba(0, 0, 0, 0.05);
}

.date-item-compact .date-text {
    margin-right: 2px;
}

.date-item-compact .calculation-icons {
    display: flex;
    gap: 2px;
    height: 20px;
    background-color: rgba(233, 233, 233, 0.911);
}

.date-item-compact.current {
    background-color: rgba(0, 123, 255, 0.2);
}

.date-item-compact.altered {
    background-color: rgba(255, 193, 7, 0.2);
}

.more-dates {
    padding: 2px 4px;
    border-radius: 3px;
    background-color: rgba(0, 0, 0, 0.05);
    color: #666;
}

/* Styles pour les icônes de calcul */
.calculation-icon {
    font-size: 9px;
    margin: 0 1px;
}

.calculation-icon-container {
    display: inline-block;
    position: relative;
}

/* Styles pour les erreurs et chargement */
.loading-spinner {
    text-align: center;
    padding: 5px;
    color: #666;
}

.error-message {
    color: #d9534f;
    text-align: center;
    padding: 5px;
}

/* ==============================================
   NOUVEAUX STYLES POUR LE DESIGN AMÉLIORÉ
   ============================================== */

/* Carte principale du résumé contextuel */
.context-summary-card {
    display: flex;
    flex-direction: column;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 2px;
}

.context-summary-card:hover {
    /* transform: translateY(-2px); */
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

/* Section générique */
.summary-section {
    border-radius: 6px;
    padding: 2px;
    transition: all 0.2s ease;
    color: white;
    position: relative;
}

.summary-section.open {
    /* Section ouverte - styles appliqués via les sous-sélecteurs */
}

.summary-section:hover {
    border-color: rgba(0, 0, 0, 0.1);
}

/* En-tête de section */
.section-header {
    display: flex;
    align-items: center;
    gap: 6px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    padding: 0 5px;
    margin: 0 -5px;
    justify-content: space-between;
    position: relative;
}

/* Effet hover par défaut pour toutes les sections streams */
.summary-section.streams-section .section-header:hover {
    backdrop-filter: blur(4px);
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    cursor: pointer;
}

/* Désactiver l'effet hover seulement quand l'accordéon n'est pas fonctionnel (1 seul stream) */
.summary-section.streams-section.no-accordion .section-header:hover,
.context-summary-container:hover .summary-section.streams-section.no-accordion .section-header {
    backdrop-filter: none;
    background-color: transparent;
    cursor: default;
}

/* En mode no-accordion, la section reste toujours ouverte */
.summary-section.streams-section.no-accordion .section-content-streams {
    max-height: none !important;
    overflow: visible !important;
}

/* En mode no-accordion, ne pas permettre la fermeture */
.summary-section.streams-section.no-accordion {
    pointer-events: none;
}

.summary-section.streams-section.no-accordion .section-header {
    pointer-events: auto;
    cursor: default;
}

/* Appliquer overflow:hidden à section-content-streams seulement quand la section n'est pas ouverte */
.summary-section.streams-section:not(.open) .section-content-streams {
    overflow: hidden;
    max-height: 0;
}

/* Section ouverte par défaut quand elle a la classe 'open' */
.summary-section.streams-section.open .section-content-streams {
    max-height: none;
    overflow: visible;
}

.summary-section.layers-section {
    display: flex;
    flex-wrap: wrap;
    backdrop-filter: blur(2px);
    border-radius: 10px;
    justify-content: space-between;
}

.layers-section .section-content {
    flex: 1;
}

.section-icon {
    color: var(--accent-color);
    font-size: 14px;
    width: 16px;
    text-align: center;
}

.section-title {
    font-weight: 600;
    color: #fff;
    font-size: 12px;
    flex: 1;
}

.section-badge {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 2px 6px;
    border-radius: 8px;
    border: 1px solid rgba(33, 150, 243, 0.2);
    backdrop-filter: blur(2px);
}

.badge-number {
    font-weight: 1000;
    color: #fff;
    font-size: 12px;
}

.badge-label {
    font-size: 10px;
    color: #fff;
    font-weight: 500;
}

/* Contenu de section */
.section-content {
    display: flex;
    flex-direction: row;
    gap: 4px;
    gap: 4px;
    justify-content: flex-end;
}

/* Statistiques */
.stat-item {
    display: flex;
    align-items: baseline;
    gap: 4px;
    padding: 3px 5px;
}

.stat-item.secondary {
    padding-left: 8px;
    border-left: 2px solid rgba(0, 123, 255, 0.2);
}

.stat-number {
    font-weight: 700;
    color: var(--accent-color);
    font-size: 14px;
}

.stat-separator {
    color: #fff;
    font-weight: 500;
}

.stat-total {
    font-weight: 600;
    color: #fff;
    font-size: 12px;
}

.stat-label {
    font-size: 11px;
    color: #fff;
    font-weight: 500;
}

/* Liste des streams en ligne */
.streams-grid {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-top: 4px;
}

/* Cartes de stream en ligne */
.stream-card {
    border-radius: 10px;
    padding: 4px 8px;
    /*border: 1px solid transparent;*/
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 32px;
    border-left: 2px solid var(--tertiary-color);
    background: rgba(0, 0, 0, 0.01);
    backdrop-filter: blur(5px);
    cursor: pointer;
}

fieldset#main-fields.summary-close .stream-card {
    height: 0;
    width: 0;
    opacity: 0;
    pointer-events: none;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

/* En mode summary-close, cacher complètement la section content-streams */
fieldset#main-fields.summary-close .section-content-streams {
    max-height: 0 !important;
    overflow: hidden !important;
    opacity: 0;
}

/* En mode summary-close, forcer la fermeture de la section streams */
fieldset#main-fields.summary-close .summary-section.streams-section {
    pointer-events: none;
}

fieldset#main-fields.summary-close .summary-section.streams-section .section-header {
    pointer-events: auto;
}

/* Exception pour le mode mono-stream : permettre le mini-contexte */
fieldset#main-fields.summary-close .summary-section.streams-section.no-accordion {
    pointer-events: auto;
}

fieldset#main-fields.summary-close .summary-section.streams-section.no-accordion .section-header {
    pointer-events: auto;
    cursor: pointer;
}


.stream-card.current {
    border-left: 2px solid var(--accent-color);
    background: rgba(255, 255, 255, 0.01);
}

/* Effet de flou blanc très discret pour les streams */
.stream-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.06);
    /* léger voile blanc */
    pointer-events: none;
    border-radius: 10px;
}

/* Effet de flou accentué au contexte courant */
.stream-card.current::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.06);
    /* léger voile blanc */
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    pointer-events: none;
}

/* Assure que le contenu reste au-dessus de l'overlay flouté */
.stream-card.current>* {
    position: relative;
    z-index: 1;
}

.stream-card:hover {
    transform: translateX(-2px);
    /* border-left-width: 4px; */
    border-color: rgba(0, 123, 255, 0.2);
    border-radius: 10px;
}

.stream-card::before {
    content: "\f061"; /* Font Awesome Unicode for 'arrow-right' (fas) */
    font-family: "Font Awesome 6 Free", "FontAwesome", sans-serif;
    font-weight: 900; /* For solid style icon */
    margin-left: 0;
    padding: 0;
    top: 25%;
    left: -20px;
    height: 16px;
    width: 0px;
    line-height: 10px;
    display: flex;
    position: absolute;
    background-color: var(--accent-color);
    border-radius: 2px;
    border-top-right-radius: 7px;
    border-bottom-right-radius: 7px;
    text-align: left;
    vertical-align: middle;
    justify-content: center;
    align-items: center;
    color: white;
    border-left: 1px solid var(--primary-color);
    transition: all .3s ease;
    opacity: 0;
    z-index: 10;
}

.stream-card:hover::before {
    opacity: 1;
    width: 20px;
    left: -14px;
}

.stream-card.current:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
    border-color: var(--accent-color);
}

.stream-card:not(.current) .stream-date,
.stream-card:not(.current) .stream-date i {
    color: var(--tertiary-color);
}

.stream-card:not(.current):hover .stream-date,
.stream-card:not(.current):hover .stream-date i {
    color: var(--accent-color);
}



/* Contenu de stream en ligne */
.stream-header {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.stream-icon {
    width: 20px;
    height: 20px;
    background: rgba(227, 242, 253, 0.8);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--rc-color-blue);
    font-size: 10px;
    flex-shrink: 0;
}

.stream-title {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    justify-content: space-between;
    padding-right: 10px;
}

.stream-name {
    font-weight: 600;
    color: #fff;
    font-size: 12px;
    line-height: 1;
}

.stream-date {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 10px;
    color: var(--accent-color);
    font-weight: 500;
}

.stream-date i {
    color: var(--accent-color);
    font-size: 9px;
}

.current-indicator {
    color: #28a745;
    font-size: 14px;
    animation: pulse 2s infinite;
    margin-left: auto;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

/* Informations de droite */
.stream-footer {
    display: flex;
    align-items: center;
    gap: 8px;
}

.alteration-count {
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.3s ease;
    opacity: 0.7;
}

.stream-card:hover .alteration-count {
    opacity: 1;
    transform: translateX(2px);
}

/* Styles pour les icônes de calcul dans le contexte */
.alteration-count .calculation-icon-container {
    margin-left: 0px;
    border-radius: 50%;
    width: 15px;
    height: 15px;
    display: flex !important;
    justify-content: center;
    align-items: center;
    padding: 10px;
}

.alteration-count .calculation-icon {
    font-size: 11px !important;
    opacity: 0.9;
}

.count-number {
    font-weight: 700;
    color: #fff;
    font-size: 12px;
}

.count-label {
    font-size: 10px;
    color: #fff;
    font-weight: 500;
}

.stream-status {
    display: flex;
    align-items: center;
    gap: 4px;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #e9ecef;
    transition: all 0.3s ease;
}

.stream-status.high .status-dot {
    background: var(--error-color);
    box-shadow: 0 0 0 1px rgba(220, 53, 69, 0.2);
}

.stream-status.medium .status-dot {
    background: #ffc107;
    box-shadow: 0 0 0 1px rgba(255, 193, 7, 0.2);
}

.stream-status.low .status-dot {
    background: #28a745;
    box-shadow: 0 0 0 1px rgba(40, 167, 69, 0.2);
}

/* Indicateur de plus de streams */
.more-streams-indicator {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px;
    background: rgba(108, 117, 125, 0.1);
    border-radius: 6px;
    border: 1px dashed rgba(108, 117, 125, 0.3);
    color: #fff;
    font-size: 11px;
    font-weight: 500;
    margin-top: 2px;
}

.more-streams-indicator i {
    font-size: 12px;
}

/* Responsive */
@media (max-width: 768px) {
    .streams-grid {
        grid-template-columns: 1fr;
    }

    .summary-section {
        padding: 6px;
    }
}

@media (max-width: 1350px) {
    header#hd.section-data fieldset#main-fields label {
        overflow: hidden;
        max-width: 17px;
        margin: 0;
    }
}

@media (max-width: 950px) {
    header#hd.section-data fieldset#main-fields label {
        display: none;
    }
}
 
/*@media (max-width: 700px) {
    header#hd.section-data fieldset#main-fields {
        display: none;
    }
} */



/* Icône de retour vers tous les streams - style inspiré de reset-order-btn */
.return-to-all-streams-icon {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    width: 2em;
    height: 2em;
    background: rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--secondary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
    z-index: 10;
}

.return-to-all-streams-icon:hover {
    background: var(--secondary-color);
    color: white;
    box-shadow: 2px 2px 0 0px #202f40;
    border-radius: 10px;
}

.return-to-all-streams-icon:active {
    box-shadow: 0 0 0 1px var(--primary-color);
    color: var(--primary-color);
    background: rgba(255, 255, 255, 0.8);
}

.return-to-all-streams-icon i {
    font-size: 12px;
}

/* Bouton refresh du contexte */
.context-refresh-btn {
    position: absolute;
    top: 1px;
    right: -1px;
    width: 20px;
    height: 20px;
    background-color: rgba(0, 0, 0, 0.3);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--accent-color);
    display: flex;
    align-items: center;
    justify-content: center;
    border-top-right-radius: 18px;
    z-index: 10;
    margin: 1px;
    padding: 11px;
    padding-right: 17px;
}

.context-refresh-btn:hover {
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
}

.context-refresh-btn:active {
    box-shadow: 0 0 0 1px var(--primary-color);
    color: var(--primary-color);
    background: rgba(255, 255, 255, 0.8);
}

.context-refresh-btn i {
    font-size: 12px;
}

/* Message de chargement */
.loading-message {
    text-align: center;
    padding: 20px;
    color: var(--accent-color);
    font-size: 14px;
}

.loading-message i {
    margin-right: 8px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}


