/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #2d1b3d 0%, #4a2c5e 50%, #2d1b3d 100%);
    color: #fff;
    overflow: hidden;
}

.container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: rgba(30, 30, 40, 0.95);
    transition: width 0.3s ease;
    overflow-y: auto;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar.collapsed {
    width: 60px;
}

.sidebar-header {
    padding: 20px;
    background: rgba(20, 20, 30, 0.8);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header .icon {
    font-size: 24px;
    margin-right: 10px;
}

.sidebar-header h2 {
    display: inline-block;
    font-size: 20px;
    font-weight: 600;
    color: #fff;
}

.header-actions {
    display: flex;
    gap: 8px;
    margin-top: 15px;
    justify-content: flex-start;
}

.icon-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.sidebar-collapsed-header {
    padding: 20px;
    text-align: center;
}

/* Family List */
.family-list {
    padding: 10px;
}

.family-section {
    margin-bottom: 5px;
}

.family-button {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 12px 15px;
    text-align: left;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.family-button:hover {
    background: rgba(255, 255, 255, 0.1);
}

.family-button.expanded {
    background: rgba(255, 255, 255, 0.15);
}

.family-button .chevron {
    transition: transform 0.2s ease;
}

.family-button.expanded .chevron {
    transform: rotate(180deg);
}

.person-list {
    padding-left: 15px;
    margin-top: 5px;
}

.person-item {
    padding: 10px 15px;
    margin: 3px 0;
    background: rgba(255, 255, 255, 0.03);
    border-left: 3px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 4px;
    font-size: 14px;
}

.person-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-left-color: rgba(255, 255, 255, 0.3);
}

.person-item.selected {
    background: rgba(139, 196, 127, 0.2);
    border-left-color: #8bc47f;
    font-weight: 600;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 40px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.tree-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 40px;
    flex-wrap: wrap;
}

.person-card {
    background: rgba(220, 215, 156, 0.95);
    color: #2d1b3d;
    padding: 40px 60px;
    border-radius: 8px;
    min-width: 180px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    position: relative;
}

.person-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
    background: rgba(220, 215, 156, 1);
}

.person-card::before {
    content: '';
    position: absolute;
    right: -40px;
    top: 50%;
    width: 80px;
    height: 2px;
    background: rgba(220, 100, 100, 0.6);
}

.person-label {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
}

.person-info {
    font-size: 14px;
    color: rgba(45, 27, 61, 0.8);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px;
    color: rgba(255, 255, 255, 0.6);
}

.empty-state p {
    font-size: 18px;
}

/* Action Buttons */
.action-buttons {
    margin-top: 40px;
    display: flex;
    gap: 15px;
    justify-content: center;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: rgba(139, 196, 127, 0.9);
    color: #2d1b3d;
}

.btn-primary:hover {
    background: rgba(139, 196, 127, 1);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 196, 127, 0.4);
}

.btn-secondary {
    background: rgba(165, 142, 142, 0.9);
    color: #fff;
}

.btn-secondary:hover {
    background: rgba(165, 142, 142, 1);
    transform: translateY(-2px);
}

.btn-danger {
    background: rgba(220, 100, 100, 0.9);
    color: #fff;
}

.btn-danger:hover {
    background: rgba(220, 100, 100, 1);
    transform: translateY(-2px);
}

/* Medical Data Panel */
.medical-data-panel {
    background: rgba(165, 142, 142, 0.3);
    border: 1px solid rgba(165, 142, 142, 0.5);
    border-radius: 8px;
    padding: 30px;
    margin-top: 30px;
    max-width: 600px;
    width: 100%;
    backdrop-filter: blur(10px);
}

.medical-data-panel h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #fff;
    font-size: 20px;
    font-weight: 600;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.medical-info {
    margin: 15px 0;
    padding: 15px;
    background: rgba(165, 142, 142, 0.4);
    border-radius: 6px;
    border-left: 4px solid rgba(165, 142, 142, 0.8);
}

.medical-info.important {
    background: rgba(165, 142, 142, 0.6);
    border-left: 4px solid rgba(139, 196, 127, 0.9);
    box-shadow: 0 2px 8px rgba(139, 196, 127, 0.2);
}

.medical-info strong {
    color: #fff;
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.medical-info ul {
    margin: 8px 0 0 0;
    padding-left: 20px;
    color: rgba(255, 255, 255, 0.9);
}

.medical-info li {
    margin: 5px 0;
    font-size: 14px;
}

/* Dialogs */
.dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.dialog {
    background: rgba(30, 30, 40, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.dialog h2 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #fff;
    font-size: 22px;
}

.dialog p {
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    font-weight: 600;
}

.form-input {
    width: 100%;
    padding: 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: #fff;
    font-size: 14px;
    transition: all 0.2s ease;
}

.form-input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(139, 196, 127, 0.5);
}

.form-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

textarea.form-input {
    resize: vertical;
    min-height: 100px;
    font-family: inherit;
}

select.form-input {
    cursor: pointer;
}

select.form-input option {
    background: #2d1b3d;
    color: #fff;
}

.dialog-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 25px;
}

/* Context Menu */
.context-menu {
    position: fixed;
    background: rgba(30, 30, 40, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    z-index: 1000;
    min-width: 220px;
    overflow: hidden;
}

.context-menu-item {
    display: block;
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    color: rgba(220, 100, 100, 0.9);
    font-size: 14px;
    transition: all 0.2s ease;
}

.context-menu-item:hover {
    background: rgba(220, 100, 100, 0.2);
    color: rgba(220, 100, 100, 1);
}

.context-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        max-height: 50vh;
    }
    
    .container {
        flex-direction: column;
    }
    
    .main-content {
        padding: 20px;
    }
    
    .tree-container {
        gap: 20px;
    }
    
    .person-card::before {
        display: none;
    }

}

/* [Vorheriger CSS-Code bleibt gleich bis .sidebar.collapsed] */

/* Rechte Sidebar */
.right-sidebar {
    width: 320px;
    background: rgba(30, 30, 40, 0.95);
    transition: width 0.3s ease;
    overflow-y: auto;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.right-sidebar.collapsed {
    width: 60px;
}

.right-sidebar-header {
    padding: 20px;
    background: rgba(20, 20, 30, 0.8);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.right-sidebar-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    margin: 0;
}

.right-sidebar-collapsed-header {
    padding: 20px;
    text-align: center;
}

.info-section {
    padding: 20px;
}

.info-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 15px;
    transition: all 0.2s ease;
}

.info-card:hover {
    background: rgba(255, 255, 255, 0.08);
}

.info-header {
    font-size: 12px;
    font-weight: 700;
    color: rgba(139, 196, 127, 0.9);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.info-content {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.6;
}

.health-card {
    background: rgba(165, 142, 142, 0.2);
    border-color: rgba(165, 142, 142, 0.4);
}

.health-item {
    margin-bottom: 12px;
}

.health-item:last-child {
    margin-bottom: 0;
}

.health-item strong {
    display: block;
    color: rgba(255, 255, 255, 0.95);
    font-size: 13px;
    margin-bottom: 5px;
}

.health-item ul {
    margin: 5px 0 0 0;
    padding-left: 20px;
}

.health-item li {
    margin: 3px 0;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.85);
}

.empty-info {
    padding: 40px 20px;
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
}

.action-buttons-sidebar {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

.btn-sidebar {
    width: 100%;
    padding: 12px 16px;
    background: rgba(139, 196, 127, 0.2);
    border: 1px solid rgba(139, 196, 127, 0.4);
    border-radius: 6px;
    color: rgba(139, 196, 127, 1);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-sidebar:hover {
    background: rgba(139, 196, 127, 0.3);
    transform: translateY(-1px);
}

.btn-danger-sidebar {
    background: rgba(220, 100, 100, 0.2);
    border-color: rgba(220, 100, 100, 0.4);
    color: rgba(220, 100, 100, 1);
}

.btn-danger-sidebar:hover {
    background: rgba(220, 100, 100, 0.3);
}

.logout-btn {
    background: rgba(220, 100, 100, 0.2) !important;
    border-color: rgba(220, 100, 100, 0.4) !important;
}

.logout-btn:hover {
    background: rgba(220, 100, 100, 0.3) !important;
}

/* Main Content Anpassung */
.main-content {
    flex: 1;
    padding: 40px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 0; /* Wichtig für Flex-Verhalten */
}

/* Responsive */
@media (max-width: 1200px) {
    .right-sidebar {
        position: fixed;
        right: 0;
        top: 0;
        height: 100vh;
        z-index: 100;
        box-shadow: -4px 0 12px rgba(0, 0, 0, 0.3);
    }
    
    .right-sidebar.collapsed {
        transform: translateX(100%);
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        max-height: 50vh;
    }
    
    .container {
        flex-direction: column;
    }
    
    .main-content {
        padding: 20px;
    }
    
    .right-sidebar {
        width: 100%;
        height: auto;
        position: relative;
        border-left: none;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }
}