/* ============================================================ */
/*  IFC VIEWER V2 - TOOLBAR & ADAPTIVE PANELS                   */
/* ============================================================ */

/* \u00c9tats du container */
:root {
    --ifcv2-cal-h: 210px;
    --ifcv2-bulk-h: 260px;
    --ifcv2-grp-h: 300px;
    --ifcv2-top-offset: 0px;
    --ifcv2-bottom-offset: 0px;
}

.ifcv2-cal-open  { --ifcv2-top-offset: var(--ifcv2-cal-h); }
.ifcv2-bulk-open { --ifcv2-bottom-offset: var(--ifcv2-bulk-h); }
.ifcv2-grp-open  { --ifcv2-bottom-offset: var(--ifcv2-grp-h); }

/* Toolbar lat\u00e9rale droite */
.ifcv2-toolbar {
    position: absolute;
    top: calc(50% + (var(--ifcv2-top-offset) / 2) - (var(--ifcv2-bottom-offset) / 2));
    right: 16px;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    z-index: 2100;
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    padding: 8px 6px;
    backdrop-filter: blur(12px) saturate(1.5);
    -webkit-backdrop-filter: blur(12px) saturate(1.5);
    border: 1px solid var(--card-border);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: calc(100% - var(--ifcv2-top-offset) - var(--ifcv2-bottom-offset) - 40px);
    overflow-y: auto;
    scrollbar-width: none;
}
.ifcv2-toolbar::-webkit-scrollbar { display: none; }

.ifcv2-tb-btn {
    border: none; background: none; cursor: pointer; padding: 0;
    border-radius: 10px; transition: all 0.2s; font-size: 1.25rem;
    display: flex; align-items: center; justify-content: center;
    width: 42px; height: 42px; color: var(--text-muted); flex-shrink: 0;
}
.ifcv2-tb-btn:hover { background: var(--badge-bg); color: var(--accent1); transform: scale(1.05); }
.ifcv2-tb-btn.active { background: var(--grad); box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3); }
.ifcv2-tb-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.ifcv2-tb-divider { width: 26px; height: 1px; background: var(--card-border); margin: 4px 0; flex-shrink: 0; }

/* Structure des Paneaux Lat\u00e9raux Adaptatifs */
.ifcv2-mm-panel, 
.ifcv2-side-panel {
    position: absolute;
    top: var(--ifcv2-top-offset);
    height: calc(100% - var(--ifcv2-top-offset) - var(--ifcv2-bottom-offset));
    z-index: 2150;
    display: flex; flex-direction: column;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    background: var(--card-bg);
    backdrop-filter: blur(16px) saturate(1.6);
    -webkit-backdrop-filter: blur(16px) saturate(1.6);
}

/* Panel Gauche (Mod\u00e8les / S\u00e9lection) */
.ifcv2-mm-panel {
    left: 0; width: 320px;
    border-right: 1px solid var(--card-border);
    border-radius: 0 20px 20px 0;
    box-shadow: 4px 0 24px rgba(0,0,0,0.06);
}

/* Panels Droits (Clipper, Search, Info, Coords, etc.) */
.ifcv2-side-panel {
    right: 74px; width: 300px;
    border-left: 1px solid var(--card-border);
    border-radius: 20px 0 0 20px;
    box-shadow: -4px 0 24px rgba(0,0,0,0.06);
}

.ifcv2-panel-header, .ifcv2-mm-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-bottom: 1px solid var(--card-border);
    font-weight: 800; font-size: 1rem; color: var(--accent1);
    text-transform: uppercase; letter-spacing: 0.05em;
    background: rgba(255,255,255,0.4); flex-shrink: 0;
}

.ifcv2-panel-header button, .ifcv2-mm-header button {
    background: none; border: none; font-size: 1.1rem; cursor: pointer;
    color: var(--text-muted); padding: 6px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s;
}
.ifcv2-panel-header button:hover, .ifcv2-mm-header button:hover { background: rgba(239, 68, 68, 0.1); color: #ef4444; }

.ifcv2-panel-body, .ifcv2-mm-list { flex: 1; overflow-y: auto; padding: 16px; scrollbar-width: thin; }

/* Panels Horizontaux (Bottom Sheets) */
.ifcv2-bulk-panel, 
.ifcv2-grp-panel {
    position: absolute; left: 0; right: 0; bottom: 0;
    background: var(--card-bg);
    backdrop-filter: blur(12px) saturate(1.5);
    box-shadow: 0 -8px 32px rgba(0,0,0,0.12);
    border-top: 1px solid var(--card-border);
    z-index: 2200;
    display: flex; flex-direction: column;
    animation: ifcv2PanelUp 0.35s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.ifcv2-bulk-panel { height: var(--ifcv2-bulk-h); }
.ifcv2-grp-panel { height: var(--ifcv2-grp-h); }

@keyframes ifcv2PanelUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

.ifcv2-bulk-header, .ifcv2-grp-header {
    display: flex; align-items: center; gap: 16px; padding: 12px 20px;
    border-bottom: 1px solid var(--card-border);
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.05), rgba(139, 92, 246, 0.05));
    flex-shrink: 0;
}

/* Tables dans les bottom panels */
.ifcv2-bulk-table, .ifcv2-grp-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.ifcv2-bulk-table thead th, .ifcv2-grp-table thead th {
    position: sticky; top: 0; background: rgba(241, 245, 249, 0.9);
    padding: 10px; text-align: left; font-weight: 700; color: var(--text-muted);
    text-transform: uppercase; font-size: 0.75rem; border-bottom: 2px solid var(--card-border);
}

/* Animations et loaders */
.ifcv2-api-loader {
    position: absolute; inset: 0; z-index: 9999;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: rgba(255, 255, 255, 0.6); backdrop-filter: blur(4px); border-radius: inherit;
}
