:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --bg-dark: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.7);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-glass: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --sidebar-width: 280px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background: var(--bg-dark);
    color: var(--text-main);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

#app {
    display: flex;
    height: 100%;
}

/* Glassmorphism Effect */
.glass {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-glass);
    box-shadow: var(--glass-shadow);
}

/* Sidebar Styling */
.sidebar {
    width: var(--sidebar-width);
    height: 100%;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: var(--transition);
}

.sidebar-header {
    padding: 2rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.sidebar-content {
    flex: 1;
    padding: 0 1rem;
}

.search-box {
    position: relative;
    margin-bottom: 2rem;
}

.search-box i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    width: 18px;
}

.search-box input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.75rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    color: var(--text-main);
    outline: none;
}

.nav-links {
    list-style: none;
}

.nav-links li {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.nav-links li:hover, .nav-links li.active {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
}

.sidebar-footer {
    padding: 1.5rem;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.top-bar {
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    border-bottom: 1px solid var(--border-glass);
}

.header-title h1 {
    font-size: 1.25rem;
    font-weight: 600;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: var(--transition);
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

.avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

/* Content Area */
.content-area {
    flex: 1;
    position: relative;
    overflow: auto;
}

.view-container {
    display: none;
    height: 100%;
    width: 100%;
}

.view-container.active {
    display: block;
}

/* Tree Canvas */
.tree-canvas {
    width: 100%;
    height: 100%;
    position: relative;
    cursor: grab;
    background-image: radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px);
    background-size: 30px 30px;
}

.tree-canvas:active {
    cursor: grabbing;
}

.canvas-controls {
    position: absolute;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.canvas-controls button {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid var(--border-glass);
    background: var(--bg-card);
    color: var(--text-main);
    cursor: pointer;
    backdrop-filter: blur(8px);
}

/* Member Nodes (for Tree) */
.member-node {
    position: absolute;
    width: 160px;
    padding: 0.75rem;
    border-radius: 16px;
    text-align: center;
    transform: translate(-50%, -50%);
    z-index: 10;
    transition: transform 0.2s ease;
    box-shadow: 0 0 15px rgba(0,0,0,0.2);
}

.member-node:hover {
    transform: translate(-50%, -50%) scale(1.05) !important;
    z-index: 20;
}

.member-node.male { 
    border: 1px solid rgba(59, 130, 246, 0.5); 
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.2);
}
.member-node.female { 
    border: 1px solid rgba(236, 72, 153, 0.5); 
    box-shadow: 0 0 10px rgba(236, 72, 153, 0.2);
}

.node-name { font-weight: 600; font-size: 0.85rem; color: #fff; }
.node-date { font-size: 0.7rem; color: var(--text-muted); margin-top: 0.2rem; }

.edit-node-btn {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--primary);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    opacity: 0;
    transition: var(--transition);
}

.member-node:hover .edit-node-btn { opacity: 1; }

/* Member List Grid */
.member-grid {
    padding: 2rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.member-card {
    padding: 1.5rem;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: var(--transition);
}

.member-card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.1);
}

.card-actions {
    margin-left: auto;
    display: flex;
    gap: 0.5rem;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
    justify-content: center;
}

.btn-primary {
    background: var(--primary);
    color: white;
    width: 100%;
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    padding: 1rem;
}

.modal-overlay.active { display: flex; }

.modal {
    width: 100%;
    max-width: 500px;
    border-radius: 24px;
    overflow: hidden;
    animation: modalIn 0.3s ease-out;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-glass);
}

.modal-body {
    padding: 1.5rem;
}

.form-group { margin-bottom: 1.25rem; }
.form-row { display: flex; gap: 1rem; }
.form-row .form-group { flex: 1; }

label { display: block; margin-bottom: 0.5rem; font-size: 0.85rem; color: var(--text-muted); }
input, select, textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    border-radius: 10px;
    color: var(--text-main);
    outline: none;
}

.modal-footer {
    padding: 1.5rem;
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* Responsive Mobile */
.mobile-only { display: none; }

@media (max-width: 768px) {
    .mobile-only { display: flex; }
    
    .sidebar {
        position: absolute;
        left: -100%;
        width: 100%;
        background: var(--bg-dark);
    }
    
    .sidebar.active {
        left: 0;
    }
    
    .top-bar { padding: 0 1rem; }
    
    .member-grid { padding: 1rem; grid-template-columns: 1fr; }
}

/* Connection Lines for Tree */
.tree-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
    transition: transform 0.1s ease-out;
}

.tree-line {
    fill: none;
    stroke: var(--primary);
    stroke-width: 2;
    stroke-dasharray: 4;
    opacity: 0.5;
}

.spouse-line {
    stroke: #f59e0b;
    stroke-dasharray: 0;
    stroke-width: 3;
}
