/**
 * tree-viewer-enhanced.css
 * Erweiterte Styles für TreeViewer v2.2.2
 * Fixes: Modal-Display, Spacing, Rechtsbündige Metadaten
 * 
 * @author EXPECTATE Consulting GmbH
 * @version 2.2.2
 */

/* ============================================================================
   TREE NODE - VERBESSERTES SPACING
   ============================================================================ */

.tree-node {
    margin-bottom: 8px !important; /* Mehr Abstand zwischen Zeilen */
    position: relative;
}

.tree-node-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px; /* Mehr vertikales Padding */
    min-height: 44px; /* Mehr Mindesthöhe */
    border-radius: 6px;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.tree-node-header:hover {
    background-color: #f5f5f5;
    border-color: #e0e0e0;
}

/* ============================================================================
   TREE NODE HEADER - LINKS/RECHTS AUFTEILUNG
   ============================================================================ */

.tree-node-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0; /* Wichtig für text-overflow */
}

.tree-node-header-right {
    display: flex;
    align-items: center;
    gap: 12px; /* Größerer Abstand zwischen rechtsseitigen Elementen */
    margin-left: auto;
    flex-shrink: 0;
}

/* ============================================================================
   TREE LABEL - VERBESSERTES STYLING
   ============================================================================ */

.tree-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
    font-size: 14px;
}

/* ============================================================================
   BADGES - VERBESSERT
   ============================================================================ */

.tree-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    transition: all 0.2s ease;
}

/* FIM-ID Badge - Blau */
.badge-fim-id {
    background-color: #e3f2fd;
    color: #1565c0;
    border: 1px solid #90caf9;
}

/* Kardinalitäts-Badge - Grau */
.badge-kardinalitaet {
    background-color: #f5f5f5;
    color: #616161;
    border: 1px solid #e0e0e0;
    font-family: monospace;
}

/* Datentyp-Badge - Grün */
.badge-datentyp {
    background-color: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}

/* Rechtsnorm-Badge - Lila */
.badge-rechtsnorm {
    background-color: #f3e5f5;
    color: #6a1b9a;
    border: 1px solid #ce93d8;
    text-decoration: none;
    cursor: pointer;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.badge-rechtsnorm:hover {
    background-color: #e1bee7;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(106, 27, 154, 0.2);
}

/* ============================================================================
   INFO-BUTTON - VERBESSERT
   ============================================================================ */

.tree-info-btn {
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    background-color: #4caf50;
    color: white;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.tree-info-btn:hover {
    background-color: #45a049;
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.4);
}

/* ============================================================================
   MODAL - FIXES FÜR KORREKTE DARSTELLUNG
   ============================================================================ */

.tree-details-modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 999999 !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background-color: rgba(0, 0, 0, 0.6) !important;
    backdrop-filter: blur(3px);
    animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.tree-details-overlay {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 0 !important;
}

.tree-details-content {
    position: relative !important;
    z-index: 1 !important;
    background: white !important;
    border-radius: 12px;
    max-width: 800px;
    width: 100%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3) !important;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.tree-details-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 28px;
    border-bottom: 2px solid #e0e0e0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px 12px 0 0;
}

.tree-details-header h3 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 600;
}

.tree-details-close {
    width: 36px !important;
    height: 36px !important;
    padding: 0 !important;
    background: rgba(255, 255, 255, 0.2) !important;
    border: none !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    font-size: 22px !important;
    color: white !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s ease !important;
}

.tree-details-close:hover {
    background: rgba(255, 255, 255, 0.3) !important;
    transform: scale(1.1) !important;
}

.tree-details-body {
    padding: 28px !important;
    overflow-y: auto !important;
    flex-grow: 1 !important;
}

/* ============================================================================
   MODAL CONTENT SECTIONS
   ============================================================================ */

.detail-section {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid #f0f0f0;
}

.detail-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.detail-section h4 {
    color: #667eea;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.detail-content {
    color: #424242;
    line-height: 1.8;
    font-size: 14px;
}

.detail-content strong {
    color: #212121;
    font-weight: 600;
}

.detail-content code {
    background-color: #f5f5f5;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: #d32f2f;
}

.detail-rechtsnorm {
    background-color: #f3e5f5;
    border-left: 4px solid #9c27b0;
    padding: 16px !important;
    border-radius: 4px;
}

.rechtsnorm-content code {
    background-color: white;
    padding: 8px 12px;
    display: block;
    margin-top: 8px;
    border-radius: 4px;
    color: #6a1b9a;
}

/* ============================================================================
   RESPONSIVE
   ============================================================================ */

@media (max-width: 768px) {
    .tree-node-header {
        flex-wrap: wrap;
    }
    
    .tree-node-header-right {
        margin-left: 0;
        margin-top: 8px;
        width: 100%;
        justify-content: flex-start;
    }
    
    .tree-details-content {
        max-width: 95%;
        max-height: 90vh;
    }
    
    .tree-details-body {
        padding: 20px !important;
    }
}

/* ============================================================================
   SCROLLBAR STYLING
   ============================================================================ */

.tree-details-body::-webkit-scrollbar {
    width: 8px;
}

.tree-details-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.tree-details-body::-webkit-scrollbar-thumb {
    background: #bbb;
    border-radius: 4px;
}

.tree-details-body::-webkit-scrollbar-thumb:hover {
    background: #999;
}
