@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --female-color: #ec4899;
    --male-color: #3b82f6;
}

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

body {
    background: var(--bg-color);
    background-image: 
        radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(236, 72, 153, 0.15) 0px, transparent 50%);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Navbar */
nav {
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 1rem 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(to right, #3b82f6, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
}

.nav-links a {
    color: var(--text-main);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.nav-links a:hover, .nav-links a.active {
    color: var(--primary);
}

/* Container */
.container {
    padding: 2rem 5%;
    max-width: 1400px;
    margin: 0 auto;
}

/* Glass Card */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--glass-shadow);
}

/* Forms & Inputs */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-main);
    transition: all 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    gap: 0.5rem;
}

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

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

/* Table */
.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    color: var(--text-muted);
    font-weight: 500;
}

tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* Badges */
.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.875rem;
    font-weight: 500;
}

.badge-male {
    background: rgba(59, 130, 246, 0.2);
    color: var(--male-color);
}

.badge-female {
    background: rgba(236, 72, 153, 0.2);
    color: var(--female-color);
}

/* Tree Visualization */
.tree {
    display: flex;
    justify-content: center;
    margin-top: 2rem;
    overflow-x: auto;
    padding-bottom: 2rem;
}

.tree ul {
    padding-top: 20px; 
    position: relative;
    transition: all 0.5s;
    display: flex;
}

.tree li {
    float: left; text-align: center;
    list-style-type: none;
    position: relative;
    padding: 20px 5px 0 5px;
    transition: all 0.5s;
}

/* Lines connecting nodes */
.tree li::before, .tree li::after{
    content: '';
    position: absolute; top: 0; right: 50%;
    border-top: 2px solid var(--primary);
    width: 50%; height: 20px;
}
.tree li::after{
    right: auto; left: 50%;
    border-left: 2px solid var(--primary);
}

/* Remove left-right connectors from single children */
.tree li:only-child::after, .tree li:only-child::before {
    display: none;
}

/* Remove space for single children */
.tree li:only-child{ padding-top: 0;}

/* Remove left connector from first child and right connector from last child */
.tree li:first-child::before, .tree li:last-child::after{
    border: 0 none;
}

/* Add back vertical connector to last nodes */
.tree li:last-child::before{
    border-right: 2px solid var(--primary);
    border-radius: 0 5px 0 0;
}
.tree li:first-child::after{
    border-radius: 5px 0 0 0;
}

/* Downward connectors from parents */
.tree ul::before{
    content: '';
    position: absolute; top: 0; left: 50%;
    border-left: 2px solid var(--primary);
    width: 0; height: 20px;
    transform: translateX(-50%);
}

.tree li a {
    border: 1px solid var(--border);
    padding: 10px 15px;
    text-decoration: none;
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    display: inline-block;
    border-radius: 12px;
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    transition: all 0.3s;
    min-width: 120px;
}

.tree li a:hover, .tree li a:hover+ul li a {
    background: var(--primary); color: #fff; border-color: var(--primary);
}
.tree li a:hover+ul li::after, 
.tree li a:hover+ul li::before, 
.tree li a:hover+ul::before, 
.tree li a:hover+ul ul::before{
    border-color: #fff;
}

.node-male {
    border-top: 3px solid var(--male-color) !important;
}

.node-female {
    border-top: 3px solid var(--female-color) !important;
}

.node-name {
    font-weight: 600;
    margin-bottom: 5px;
}

.node-spouse {
    font-size: 12px;
    color: var(--text-muted);
    border-top: 1px dashed var(--border);
    margin-top: 5px;
    padding-top: 5px;
}

/* Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.page-title {
    font-size: 2rem;
    font-weight: 600;
}

.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid var(--primary);
    color: var(--text-main);
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border-color: #10b981;
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
}
