/* ==========================================================================
   BOÎTE FLOTTANTE DE PROMPT MULTI-PAGES (.chat-floating-box)
   Composant Global PotameSpicy_OS
   ========================================================================== */

.chat-actions-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    flex-shrink: 0;
}

.detach-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--bg-card, #1c1c24);
    border: 1px solid var(--border-color, #2d2d3d);
    color: var(--text-muted, #94a3b8);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}

.detach-btn:hover {
    color: var(--accent-primary, #00e5ff);
    border-color: var(--accent-primary, #00e5ff);
    background: var(--bg-card-hover, #262633);
    transform: translateY(-1px);
}

.detach-btn.active {
    color: var(--accent-primary, #00e5ff);
    background: var(--accent-primary-bg, rgba(0, 229, 255, 0.12));
    border-color: var(--accent-primary, #00e5ff);
    box-shadow: 0 0 10px var(--accent-primary-bg, rgba(0, 229, 255, 0.12));
}

.detach-btn span {
    font-size: 20px;
}

.chat-floating-box {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 460px;
    max-width: calc(100vw - 32px);
    background: var(--bg-card, #1c1c24);
    border: 1px solid var(--border-color, #2d2d3d);
    border-radius: 16px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45), 0 0 0 1px var(--border-subtle, rgba(255, 255, 255, 0.05));
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease, box-shadow 0.25s ease, border-color 0.2s ease;
    transform-origin: bottom right;
}

.chat-floating-box.hidden {
    display: none !important;
}

.chat-floating-box.is-minimized {
    width: auto;
    min-width: 280px;
    max-width: 380px;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.chat-floating-box.is-minimized .floating-box-body {
    display: none !important;
}

.chat-floating-box.is-minimized #floating-minimize-btn span {
    transform: rotate(180deg);
}

/* Effet Drag & Drop survol */
.chat-floating-box.drag-over {
    border-color: var(--accent-primary, #00e5ff) !important;
    box-shadow: 0 0 24px var(--accent-primary-bg, rgba(0, 229, 255, 0.35)), 0 16px 40px rgba(0, 0, 0, 0.5) !important;
}

/* En-tête de la boîte flottante */
.floating-box-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--bg-main, #131318);
    border-bottom: 1px solid var(--border-color, #2d2d3d);
    user-select: none;
    cursor: default;
}

.chat-floating-box.is-minimized .floating-box-header {
    border-bottom: none;
    cursor: pointer;
}

.floating-box-title-area {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 6px;
    transition: background-color 0.15s ease;
}

.floating-box-title-area:hover {
    background: var(--bg-card-hover, rgba(255, 255, 255, 0.05));
}

.floating-box-icon {
    font-size: 18px;
    color: var(--accent-primary, #00e5ff);
    flex-shrink: 0;
}

.floating-thread-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-heading, #ffffff);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: var(--font-family-title, inherit);
}

.floating-box-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    margin-left: 8px;
}

.floating-control-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: transparent;
    border: none;
    color: var(--text-muted, #94a3b8);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
}

.floating-control-btn:hover {
    background: var(--bg-card-hover, rgba(255, 255, 255, 0.08));
    color: var(--text-main, #e2e8f0);
}

.floating-control-btn span {
    font-size: 18px;
    transition: transform 0.2s ease;
}

#floating-close-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

#floating-dock-btn:hover {
    color: var(--accent-primary, #00e5ff);
    background: var(--accent-primary-bg, rgba(0, 229, 255, 0.12));
}

/* Corps de la boîte flottante */
.floating-box-body {
    padding: 12px 14px;
    background: var(--bg-card, #1c1c24);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Statistiques de session / tokens dans la boîte flottante */
.floating-session-stats {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 11px;
    color: var(--text-muted, #94a3b8);
    user-select: none;
    padding-bottom: 2px;
}

.floating-session-stats.hidden {
    display: none !important;
}

.floating-session-stats .stat-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.floating-session-stats .stat-piechart {
    transform: rotate(-90deg);
    flex-shrink: 0;
}

.floating-session-stats .pie-bg {
    fill: none;
    stroke: var(--border-color, rgba(255, 255, 255, 0.1));
    stroke-width: 4;
}

.floating-session-stats .pie-fill {
    fill: none;
    stroke: var(--accent-primary, #00e5ff);
    stroke-width: 4;
    transition: stroke-dashoffset 0.3s ease, stroke 0.3s ease;
}

.floating-session-stats .stat-symbol {
    font-weight: 300;
    opacity: 0.9;
}

.floating-session-stats .stat-val {
    font-weight: 400;
}

/* Plateau des pièces jointes dans la boîte flottante (Tâche 2.3) */
.floating-attachments-tray {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-height: 105px;
    overflow-y: auto;
    padding: 6px 8px;
    background: var(--bg-main, #131318);
    border: 1px dashed var(--border-color, #2d2d3d);
    border-radius: 10px;
    transition: all 0.2s ease;
}

.floating-attachments-tray.hidden {
    display: none !important;
}

.floating-attachment-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-card, #1c1c24);
    border: 1px solid var(--border-color, #2d2d3d);
    border-radius: 8px;
    padding: 3px 8px;
    font-size: 11px;
    color: var(--text-main, #e2e8f0);
    max-width: 200px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    animation: fadeInChip 0.15s ease;
}

@keyframes fadeInChip {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.floating-attachment-thumb {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
}

.floating-attachment-icon {
    font-size: 16px;
    color: var(--accent-primary, #00e5ff);
    flex-shrink: 0;
}

.floating-attachment-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
    line-height: 1.15;
}

.floating-attachment-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.floating-attachment-size {
    font-size: 9px;
    color: var(--text-muted, #94a3b8);
}

.floating-attachment-remove {
    background: transparent;
    border: none;
    color: var(--text-muted, #94a3b8);
    cursor: pointer;
    padding: 0;
    margin-left: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.floating-attachment-remove:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.15);
}

.floating-attachment-remove span {
    font-size: 14px;
}

/* Formulaire de prompt dans la boîte flottante */
.floating-chat-form {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    position: relative;
    margin: 0;
}

.floating-attach-wrapper {
    position: relative;
    flex-shrink: 0;
}

.floating-attach-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--bg-input, #131318);
    border: 1px solid var(--border-color, #2d2d3d);
    color: var(--text-muted, #94a3b8);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.floating-attach-btn:hover {
    color: var(--accent-primary, #00e5ff);
    border-color: var(--accent-primary, #00e5ff);
    background: var(--bg-card-hover, rgba(255, 255, 255, 0.05));
}

.badge-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--accent-primary, #00e5ff);
    color: #000000;
    font-size: 10px;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    line-height: 18px;
    border-radius: 9px;
    text-align: center;
    padding: 0 4px;
    box-sizing: border-box;
}

.badge-count.hidden {
    display: none !important;
}

#floating-message-input {
    flex-grow: 1;
    min-width: 0;
    resize: none;
    background: var(--bg-input, #131318);
    color: var(--text-main, #e2e8f0);
    border: 1px solid var(--border-color, #2d2d3d);
    border-radius: 12px;
    padding: 10px 12px;
    outline: none;
    min-height: 40px;
    max-height: 140px;
    line-height: 1.4;
    font-size: 13px;
    font-family: inherit;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#floating-message-input:focus {
    border-color: var(--accent-primary, #00e5ff);
    box-shadow: 0 0 0 2px var(--accent-primary-bg, rgba(0, 229, 255, 0.12));
}

#floating-message-input::placeholder {
    color: var(--text-muted, #94a3b8);
}

.floating-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent-primary, #00e5ff);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

[data-theme="solaris"] .floating-send-btn,
[data-theme="dark"] .floating-send-btn {
    color: #001f24 !important;
}

.floating-send-btn:hover {
    filter: brightness(1.1);
    transform: scale(1.05);
}

.floating-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Responsive pour mobile */
@media (max-width: 640px) {
    .chat-floating-box {
        left: 12px;
        right: 12px;
        bottom: 12px;
        width: auto;
        max-width: none;
    }
}

/* Animation de confirmation de rattachement du prompt (Tâche 3.1) */
@keyframes dockPulse {
    0% { box-shadow: 0 0 0 0 rgba(0, 229, 255, 0.4); }
    50% { box-shadow: 0 0 18px 4px var(--accent-primary-bg, rgba(0, 229, 255, 0.35)); }
    100% { box-shadow: 0 0 0 0 rgba(0, 229, 255, 0); }
}

.dock-pulse {
    animation: dockPulse 1.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}
