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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    background-color: #2c3e50;
    color: white;
    padding: 30px 20px;
    text-align: center;
    border-radius: 8px;
    margin-bottom: 30px;
}

.header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

.header p {
    font-size: 1.1em;
    opacity: 0.9;
}

/* Navigation */
.nav {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.nav-btn {
    padding: 12px 20px;
    background-color: #34495e;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.3s;
}

.nav-btn:hover {
    background-color: #2c3e50;
}

.nav-btn.active {
    background-color: #3498db;
}

/* Sections */
.section {
    display: none;
    animation: fadeIn 0.3s ease-in;
}

.section.active {
    display: block;
}

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

.section h2 {
    font-size: 2em;
    margin-bottom: 20px;
    color: #2c3e50;
}

/* Cards Grid */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.card {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid #ecf0f1;
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.card h3 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 1.4em;
}

.card p {
    color: #7f8c8d;
    margin-bottom: 15px;
}

.card button {
    width: 100%;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.3s;
}

.btn:hover {
    background-color: #2980b9;
}

.btn-primary {
    background-color: #3498db;
}

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-success {
    background-color: #27ae60;
}

.btn-success:hover {
    background-color: #229954;
}

.btn-danger {
    background-color: #e74c3c;
}

.btn-danger:hover {
    background-color: #c0392b;
}

.btn-refresh {
    background-color: #95a5a6;
    margin-bottom: 20px;
}

.btn-refresh:hover {
    background-color: #7f8c8d;
}

/* Forms */
.form {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    max-width: 600px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #2c3e50;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #bdc3c7;
    border-radius: 5px;
    font-size: 1em;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.3);
}

.form-group button {
    width: 100%;
}

/* Search Box */
.search-box {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.search-box input {
    flex: 1;
    padding: 10px;
    border: 1px solid #bdc3c7;
    border-radius: 5px;
    font-size: 1em;
}

.search-box input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.3);
}

/* Members Container */
.members-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.member-card {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-left: 4px solid #3498db;
}

.member-card h3 {
    color: #2c3e50;
    margin-bottom: 10px;
}

.member-info {
    color: #7f8c8d;
    margin: 8px 0;
    font-size: 0.95em;
}

.member-info label {
    font-weight: 600;
    color: #34495e;
}

.member-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.member-actions button {
    flex: 1;
    padding: 8px;
    font-size: 0.9em;
}

/* Tree Container */
.tree-selector {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.tree-selector input {
    padding: 10px;
    border: 1px solid #bdc3c7;
    border-radius: 5px;
    font-size: 1em;
    width: 200px;
}

.tree-selector input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.3);
}

.tree-container {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-top: 20px;
}

.tree-person {
    background-color: #ecf0f1;
    padding: 15px;
    border-radius: 5px;
    margin: 10px 0;
    border-left: 4px solid #3498db;
}

.tree-person h4 {
    color: #2c3e50;
    margin-bottom: 8px;
}

.tree-relation {
    margin-left: 20px;
    padding: 10px;
    background-color: #fafafa;
    border-left: 2px solid #95a5a6;
    margin-top: 10px;
}

.tree-relation h5 {
    color: #34495e;
    margin-bottom: 5px;
    font-size: 0.95em;
}

.tree-relation p {
    color: #7f8c8d;
    margin: 5px 0;
    font-size: 0.9em;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal.show {
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.close {
    float: right;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    margin-bottom: 20px;
}

.close:hover {
    color: #000;
}

/* Messages */
/* Toast Notifications */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
}

.toast {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 16px 20px;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s ease-in-out;
    border-left: 4px solid;
}

.toast-show {
    opacity: 1;
    transform: translateX(0);
}

.toast-success {
    border-left-color: #28a745;
    background-color: #d4edda;
}

.toast-error {
    border-left-color: #dc3545;
    background-color: #f8d7da;
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.toast-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
    flex-shrink: 0;
}

.toast-success .toast-icon {
    background-color: #28a745;
    color: white;
}

.toast-error .toast-icon {
    background-color: #dc3545;
    color: white;
}

.toast-message {
    flex: 1;
    font-size: 14px;
    line-height: 1.4;
}

.toast-success .toast-message {
    color: #155724;
}

.toast-error .toast-message {
    color: #721c24;
}

/* Auth Required Message */
.auth-required {
    background-color: #fff3cd;
    color: #856404;
    border: 2px solid #ffc107;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    font-size: 1.1em;
    margin: 20px 0;
}

#authStatus {
    font-weight: bold;
    font-size: 1.1em;
    padding: 10px;
    background-color: #e9ecef;
    border-radius: 5px;
    margin: 10px 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header h1 {
        font-size: 1.8em;
    }

    .nav {
        flex-direction: column;
    }

    .nav-btn {
        width: 100%;
    }

    .cards-grid {
        grid-template-columns: 1fr;
    }

    .members-container {
        grid-template-columns: 1fr;
    }

    .member-actions {
        flex-direction: column;
    }

    .search-box {
        flex-direction: column;
    }

    .tree-selector {
        flex-direction: column;
    }

    .tree-selector input {
        width: 100%;
    }
}
