* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 5%;
    background: rgba(255,255,255,0.1);
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
}

.nav-links a {
    color: white;
    text-decoration: none;
    margin-left: 1rem;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    transition: all 0.3s;
}

.btn-login {
    border: 1px solid white;
}

.btn-register {
    background: white;
    color: #667eea !important;
}

.hero-content {
    text-align: center;
    padding: 4rem 2rem;
    color: white;
}

.hero-content h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.features {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin: 3rem 0;
    flex-wrap: wrap;
}

.feature {
    background: rgba(255,255,255,0.1);
    padding: 2rem;
    border-radius: 10px;
    width: 250px;
    backdrop-filter: blur(10px);
}

.btn-start {
    display: inline-block;
    background: white;
    color: #667eea;
    padding: 1rem 2rem;
    text-decoration: none;
    border-radius: 50px;
    font-weight: bold;
    margin-top: 1rem;
    transition: transform 0.3s;
}

.btn-start:hover {
    transform: translateY(-2px);
}

/* Auth Forms */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 1rem;
}

.auth-card {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
}

.auth-card h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: #333;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #666;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
}

.btn-submit {
    width: 100%;
    padding: 0.75rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    cursor: pointer;
    margin-top: 1rem;
}

.auth-link {
    text-align: center;
    margin-top: 1rem;
    color: #666;
}

.auth-link a {
    color: #667eea;
    text-decoration: none;
}

/* Dashboard */
.dashboard {
    min-height: 100vh;
    background: #f5f5f5;
}

.dashboard-nav {
    background: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.family-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn-logout {
    background: #f44336;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    cursor: pointer;
}

.dashboard-content {
    display: flex;
    height: calc(100vh - 70px);
}

.sidebar {
    width: 250px;
    background: white;
    padding: 1rem;
    box-shadow: 2px 0 5px rgba(0,0,0,0.05);
}

.btn-add, .btn-connect {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 1rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
}

.btn-add {
    background: #4CAF50;
    color: white;
}

.btn-connect {
    background: #2196F3;
    color: white;
}

.stats {
    margin-top: 2rem;
    padding: 1rem;
    background: #f9f9f9;
    border-radius: 5px;
}

.tree-container {
    flex: 1;
    padding: 1rem;
    overflow: auto;
}

/* Tree Visualization */
.tree-node {
    display: inline-block;
    margin: 10px;
    padding: 10px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    min-width: 150px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s;
}

.tree-node:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.tree-node.male {
    border-left: 4px solid #2196F3;
}

.tree-node.female {
    border-left: 4px solid #E91E63;
}

.tree-node h4 {
    margin: 0 0 5px 0;
    color: #333;
}

.tree-node p {
    margin: 0;
    font-size: 0.85rem;
    color: #666;
}

.tree-level {
    margin: 20px 0;
    text-align: center;
}

.tree-children {
    margin-left: 40px;
    padding-left: 20px;
    border-left: 2px solid #ddd;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
}

.modal-content {
    background: white;
    margin: 5% auto;
    padding: 2rem;
    width: 90%;
    max-width: 500px;
    border-radius: 10px;
    position: relative;
}

.close {
    position: absolute;
    right: 1rem;
    top: 0.5rem;
    font-size: 2rem;
    cursor: pointer;
    color: #999;
}

.modal-content form input,
.modal-content form select {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 1rem;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.modal-content form button {
    width: 100%;
    padding: 0.75rem;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

/* Responsive */
@media (max-width: 768px) {
    .hero-content h1 {
        font-size: 2rem;
    }
    
    .features {
        flex-direction: column;
        align-items: center;
    }
    
    .dashboard-content {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
    }
    
    .tree-container {
        height: auto;
    }
    
    .modal-content {
        margin: 20% auto;
        width: 95%;
    }
}

/* PWA Styles */
@media (display-mode: standalone) {
    .dashboard-nav {
        padding-top: env(safe-area-inset-top);
    }
    
    .dashboard-content {
        height: calc(100vh - 70px - env(safe-area-inset-top));
    }
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}