/* =============================================
   GALAXY VIEW 6.0 - DIVINE EDITION
   Architecture Premium Figma/Miro-like
   ============================================= */

/* === LAYOUT PRINCIPAL === */
#view-galaxy.active {
    display: flex !important;
    flex-direction: column;
    padding: 0;
    max-width: none;
    height: 100vh;
    background: #f8f9fa;
    overflow: hidden;
}

/* === TOOLBAR HORIZONTALE (TOP) === */
#galaxy-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: linear-gradient(180deg,
        rgba(255,255,255,0.98),
        rgba(250,250,252,0.98));
    border-bottom: 1px solid rgba(100,100,120,0.15);
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    flex-shrink: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
}

#galaxy-toolbar .galaxy-toolbar-title {
    font-size: 16px;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-right: 12px;
    letter-spacing: -0.3px;
}

#galaxy-toolbar .galaxy-toolbar-sep {
    width: 1px;
    height: 24px;
    background: rgba(100,100,120,0.15);
    margin: 0 8px;
}

#galaxy-toolbar .galaxy-ctrl-btn {
    background: rgba(255,255,255,0.9);
    border: 1px solid rgba(100,100,120,0.12);
    color: #374151;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), background 0.2s ease-out, border-color 0.2s ease-out, opacity 0.2s ease-out;
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

#galaxy-toolbar .galaxy-ctrl-btn:hover {
    background: #ffffff;
    border-color: rgba(100,100,120,0.25);
    color: #111827;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    transform: translateY(-1px);
}

#galaxy-toolbar .galaxy-ctrl-btn.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-color: transparent;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(102,126,234,0.3);
}

#galaxy-toolbar .galaxy-ctrl-btn.galaxy-ctrl-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-color: transparent;
    color: #ffffff;
    font-weight: 600;
}

#galaxy-toolbar .galaxy-ctrl-btn.galaxy-ctrl-ai {
    background: linear-gradient(135deg, #f093fb, #f5576c);
    border-color: transparent;
    color: #ffffff;
    font-weight: 600;
}

#galaxy-toolbar .galaxy-ctrl-btn.galaxy-ctrl-ai:hover {
    box-shadow: 0 4px 16px rgba(245,87,108,0.4);
}

/* === MAIN CONTAINER (3 ZONES) === */
#galaxy-main-container {
    display: flex;
    flex: 1;
    min-height: 0;
    position: relative;
    overflow: hidden;
}

/* === TOOLBAR LATÉRALE GAUCHE (OUTILS) === */
.galaxy-sidebar-left {
    width: 64px;
    background: linear-gradient(180deg,
        rgba(255,255,255,0.98),
        rgba(250,250,252,0.98));
    border-right: 1px solid rgba(100,100,120,0.12);
    box-shadow: 2px 0 8px rgba(0,0,0,0.04);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 8px;
    gap: 12px;
    z-index: 50;
    backdrop-filter: blur(12px);
}

.galaxy-tool-btn {
    width: 48px;
    height: 48px;
    background: transparent;
    border: 2px solid transparent;
    border-radius: 12px;
    color: #6b7280;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), background 0.2s ease-out, border-color 0.2s ease-out, opacity 0.2s ease-out;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
}

.galaxy-tool-btn svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    fill: none;
    transition: transform 0.2s ease-out, background 0.2s ease-out, border-color 0.2s ease-out, color 0.2s ease-out, opacity 0.2s ease-out;
}

.galaxy-tool-btn:hover {
    background: rgba(102,126,234,0.08);
    border-color: rgba(102,126,234,0.2);
    color: #667eea;
    transform: scale(1.05);
}

.galaxy-tool-btn.active {
    background: linear-gradient(135deg,
        rgba(102,126,234,0.15),
        rgba(118,75,162,0.15));
    border-color: #667eea;
    color: #667eea;
    box-shadow: 0 0 0 4px rgba(102,126,234,0.1);
}

.galaxy-tool-btn.active::before {
    content: '';
    position: absolute;
    left: -9px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: linear-gradient(180deg, #667eea, #764ba2);
    border-radius: 2px;
}

.galaxy-sidebar-sep {
    width: 32px;
    height: 1px;
    background: rgba(100,100,120,0.15);
    margin: 4px 0;
    flex-shrink: 0;
}

/* === ZONE CANVAS CENTRALE === */
#galaxy-canvas-zone {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: #ffffff;
}

#galaxy-3d-container,
#galaxy-canvas-container {
    width: 100%;
    height: 100%;
    position: relative;
}

#galaxy-canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
    cursor: grab;
}

#galaxy-canvas:active {
    cursor: grabbing;
}

#galaxy-3d-canvas {
    display: block;
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
}

/* === PANNEAU PROPRIÉTÉS DROIT (CONTEXTUEL) === */
.galaxy-sidebar-right {
    width: 320px;
    background: linear-gradient(180deg,
        rgba(255,255,255,0.98),
        rgba(250,250,252,0.98));
    border-left: 1px solid rgba(100,100,120,0.12);
    box-shadow: -2px 0 8px rgba(0,0,0,0.04);
    display: flex;
    flex-direction: column;
    z-index: 50;
    backdrop-filter: blur(12px);
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.galaxy-sidebar-right.visible {
    transform: translateX(0);
}

.galaxy-panel-header {
    padding: 20px;
    border-bottom: 1px solid rgba(100,100,120,0.12);
    flex-shrink: 0;
}

.galaxy-panel-title {
    font-size: 15px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 4px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.galaxy-panel-subtitle {
    font-size: 12px;
    color: #6b7280;
    margin: 0;
}

.galaxy-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.galaxy-panel-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    color: #6b7280;
    cursor: pointer;
    border-radius: 6px;
    transition: transform 0.2s ease-out, background 0.2s ease-out, border-color 0.2s ease-out, color 0.2s ease-out, opacity 0.2s ease-out;
    display: flex;
    align-items: center;
    justify-content: center;
}

.galaxy-panel-close:hover {
    background: rgba(239,68,68,0.1);
    color: #ef4444;
}

/* === SECTIONS PANNEAU PROPRIÉTÉS === */
.galaxy-prop-section {
    margin-bottom: 24px;
}

.galaxy-prop-label {
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    display: block;
}

.galaxy-prop-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.galaxy-prop-field {
    flex: 1;
}

.galaxy-prop-input {
    width: 100%;
    padding: 8px 12px;
    background: rgba(255,255,255,0.95);
    border: 1px solid rgba(100,100,120,0.2);
    border-radius: 8px;
    font-size: 13px;
    color: #111827;
    transition: transform 0.2s ease-out, background 0.2s ease-out, border-color 0.2s ease-out, color 0.2s ease-out, opacity 0.2s ease-out;
}

.galaxy-prop-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.1);
}

.galaxy-prop-slider {
    width: 100%;
    height: 6px;
    background: rgba(100,100,120,0.15);
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.galaxy-prop-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(102,126,234,0.3);
}

.galaxy-prop-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(102,126,234,0.3);
}

/* === COLOR PICKER AVANCÉ === */
.galaxy-color-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

.galaxy-color-swatch {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 8px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.2s ease-out, background 0.2s ease-out, border-color 0.2s ease-out, color 0.2s ease-out, opacity 0.2s ease-out;
    position: relative;
}

.galaxy-color-swatch:hover {
    transform: scale(1.15);
    border-color: rgba(0,0,0,0.2);
}

.galaxy-color-swatch.active {
    border-color: #111827;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.2);
}

.galaxy-color-swatch.active::after {
    content: '✓';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

/* === BOUTONS D'ACTION PANNEAU === */
.galaxy-prop-btn {
    width: 100%;
    padding: 10px 16px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: none;
    border-radius: 8px;
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease-out, background 0.2s ease-out, border-color 0.2s ease-out, color 0.2s ease-out, opacity 0.2s ease-out;
    box-shadow: 0 2px 6px rgba(102,126,234,0.3);
}

.galaxy-prop-btn:hover {
    box-shadow: 0 4px 12px rgba(102,126,234,0.4);
    transform: translateY(-1px);
}

.galaxy-prop-btn:active {
    transform: translateY(0);
}

.galaxy-prop-btn.secondary {
    background: rgba(255,255,255,0.95);
    color: #374151;
    border: 1px solid rgba(100,100,120,0.2);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.galaxy-prop-btn.secondary:hover {
    background: #ffffff;
    border-color: rgba(100,100,120,0.3);
}

/* === LAYERS PANEL === */
.galaxy-layer-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.galaxy-layer-item {
    padding: 10px 12px;
    background: rgba(255,255,255,0.95);
    border: 1px solid rgba(100,100,120,0.12);
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s ease-out, background 0.2s ease-out, border-color 0.2s ease-out, color 0.2s ease-out, opacity 0.2s ease-out;
    display: flex;
    align-items: center;
    gap: 10px;
}

.galaxy-layer-item:hover {
    background: #ffffff;
    border-color: rgba(100,100,120,0.25);
}

.galaxy-layer-item.active {
    background: linear-gradient(135deg,
        rgba(102,126,234,0.1),
        rgba(118,75,162,0.1));
    border-color: #667eea;
}

.galaxy-layer-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.galaxy-layer-name {
    flex: 1;
    font-size: 13px;
    color: #111827;
    font-weight: 500;
}

.galaxy-layer-visibility {
    width: 20px;
    height: 20px;
    background: transparent;
    border: none;
    color: #6b7280;
    cursor: pointer;
    transition: color 0.2s ease;
}

.galaxy-layer-visibility:hover {
    color: #111827;
}

/* === TOOLTIP HOVER === */
.galaxy-tooltip {
    display: none;
    position: absolute;
    z-index: 1000;
    padding: 8px 12px;
    background: rgba(17,24,39,0.95);
    backdrop-filter: blur(8px);
    border-radius: 6px;
    color: #ffffff;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.galaxy-tooltip.visible {
    display: block;
    animation: tooltipFadeIn 0.15s ease;
}

@keyframes tooltipFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* === HISTORY PANEL === */
.galaxy-history-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.galaxy-history-item {
    padding: 10px 12px;
    background: rgba(255,255,255,0.95);
    border: 1px solid rgba(100,100,120,0.12);
    border-radius: 8px;
    font-size: 12px;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: transform 0.2s ease-out, background 0.2s ease-out, border-color 0.2s ease-out, color 0.2s ease-out, opacity 0.2s ease-out;
}

.galaxy-history-item:hover {
    background: #ffffff;
    border-color: rgba(100,100,120,0.25);
}

.galaxy-history-item.current {
    background: linear-gradient(135deg,
        rgba(102,126,234,0.1),
        rgba(118,75,162,0.1));
    border-color: #667eea;
    font-weight: 600;
}

.galaxy-history-icon {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.galaxy-history-text {
    flex: 1;
}

.galaxy-history-time {
    font-size: 10px;
    color: #9ca3af;
}

/* === EXPORT PANEL === */
.galaxy-export-format {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.galaxy-export-option {
    padding: 16px;
    background: rgba(255,255,255,0.95);
    border: 2px solid rgba(100,100,120,0.12);
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s ease-out, background 0.2s ease-out, border-color 0.2s ease-out, color 0.2s ease-out, opacity 0.2s ease-out;
    text-align: center;
}

.galaxy-export-option:hover {
    background: #ffffff;
    border-color: rgba(102,126,234,0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.galaxy-export-option.selected {
    background: linear-gradient(135deg,
        rgba(102,126,234,0.15),
        rgba(118,75,162,0.15));
    border-color: #667eea;
}

.galaxy-export-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.galaxy-export-label {
    font-size: 13px;
    font-weight: 600;
    color: #111827;
}

/* === RESPONSIVE === */
@media (max-width: 1200px) {
    .galaxy-sidebar-right {
        width: 280px;
    }
}

@media (max-width: 768px) {
    .galaxy-sidebar-left {
        width: 56px;
        padding: 12px 6px;
    }

    .galaxy-tool-btn {
        width: 44px;
        height: 44px;
    }

    .galaxy-sidebar-right {
        width: 100%;
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        z-index: 200;
    }
}

/* === ANIMATIONS === */
@keyframes galaxyFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes galaxySlideIn {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

#view-galaxy.active {
    animation: galaxyFadeIn 0.3s ease;
}

.galaxy-sidebar-right.visible {
    animation: galaxySlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* === LOADING STATE === */
.galaxy-loading {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 16px;
    z-index: 1000;
}

.galaxy-loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(102,126,234,0.2);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.galaxy-loading-text {
    font-size: 14px;
    color: #6b7280;
    font-weight: 500;
}
