/* Family Roots Tree - Heritage Theme CSS */
/* Ported from React Tailwind implementation */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,500;0,600;0,700;1,400&family=Source+Sans+3:wght@300;400;500;600&display=swap');

/* CSS Custom Properties - Design System */
:root {
    --background: 40 30% 96%;
    --foreground: 25 30% 15%;

    --card: 40 40% 98%;
    --card-foreground: 25 30% 15%;

    --popover: 40 40% 98%;
    --popover-foreground: 25 30% 15%;

    --primary: 152 35% 28%;
    --primary-foreground: 40 40% 98%;

    --secondary: 32 45% 85%;
    --secondary-foreground: 25 30% 15%;

    --muted: 40 20% 90%;
    --muted-foreground: 25 15% 45%;

    --accent: 28 60% 45%;
    --accent-foreground: 40 40% 98%;

    --destructive: 0 65% 50%;
    --destructive-foreground: 40 40% 98%;

    --border: 32 25% 85%;
    --input: 32 25% 85%;
    --ring: 152 35% 28%;

    --radius: 0.75rem;

    /* Family tree tokens */
    --tree-line: 32 30% 70%;
    --tree-node-bg: 40 45% 97%;
    --tree-node-border: 32 35% 80%;
    --tree-node-selected: 152 35% 28%;
    --heritage-gold: 42 75% 55%;
    --heritage-brown: 25 40% 30%;
    --heritage-cream: 40 50% 94%;
    --female: 0 100% 45%; /* red */
    --male: 0 0% 0%;   /* black */
}

/* Dark mode */
.dark {
    --background: 25 25% 10%;
    --foreground: 40 30% 92%;

    --card: 25 20% 14%;
    --card-foreground: 40 30% 92%;

    --popover: 25 20% 14%;
    --popover-foreground: 40 30% 92%;

    --primary: 152 40% 45%;
    --primary-foreground: 25 25% 10%;

    --secondary: 32 25% 25%;
    --secondary-foreground: 40 30% 92%;

    --muted: 25 15% 20%;
    --muted-foreground: 40 15% 60%;

    --accent: 28 55% 50%;
    --accent-foreground: 25 25% 10%;

    --destructive: 0 60% 45%;
    --destructive-foreground: 40 30% 92%;

    --border: 25 20% 22%;
    --input: 25 20% 22%;
    --ring: 152 40% 45%;

    --tree-line: 32 20% 35%;
    --tree-node-bg: 25 20% 16%;
    --tree-node-border: 32 20% 30%;
    --tree-node-selected: 152 40% 45%;
    --heritage-gold: 42 70% 50%;
    --heritage-brown: 25 30% 50%;
    --heritage-cream: 40 20% 20%;
    --female: 0 100% 45%;
    --male: 0 0% 0%;
}

/* Material Symbols */
.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* Base styles */
*, *::before, *::after {
    box-sizing: border-box;
}

html, body, #app {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Source Sans 3', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: hsl(var(--background));
    color: hsl(var(--foreground));
    line-height: 1.5;
}

/* Typography */
@font-face {
    font-family: 'Decotype Thuluth II';
    src: url('/fonts/decotype-thuluth-ii.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Al Diwani Al Majd 2';
    src: url('/fonts/al-diwani-al-majd-2.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'farsi simple bold';
    src: url('/fonts/farsi-simple-bold.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

.font-serif {
    font-family: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
}

.font-sans {
    font-family: 'Source Sans 3', system-ui, sans-serif;
}

h1, h2, h3, h4 {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 600;
}

/* Colors */
.text-foreground { color: hsl(var(--foreground)); }
.text-muted-foreground { color: hsl(var(--muted-foreground)); }
.text-primary { color: hsl(var(--primary)); }
.text-primary-foreground { color: hsl(var(--primary-foreground)); }
.text-destructive { color: hsl(var(--destructive)); }
.text-male { color: hsl(var(--male)); }
.text-female { color: hsl(var(--female)); }
.text-heritage-gold { color: hsl(var(--heritage-gold)); }
.text-heritage-brown { color: hsl(var(--heritage-brown)); }

.bg-background { background-color: hsl(var(--background)); }
.bg-card { background-color: hsl(var(--card)); }
.bg-muted { background-color: hsl(var(--muted)); }
.bg-primary { background-color: hsl(var(--primary)); }
.bg-secondary { background-color: hsl(var(--secondary)); }
.bg-accent { background-color: hsl(var(--accent)); }
.bg-destructive { background-color: hsl(var(--destructive)); }
.bg-male { background-color: hsl(var(--male)); }
.bg-female { background-color: hsl(var(--female)); }
.bg-heritage-cream { background-color: hsl(var(--heritage-cream)); }
.bg-tree-node { background-color: hsl(var(--tree-node-bg)); }

.border-border { border-color: hsl(var(--border)); }
.border-input { border-color: hsl(var(--input)); }
.border-tree-node { border-color: hsl(var(--tree-node-border)); }

/* Layout utilities */
.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-row { flex-direction: row; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1 1 0%; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.gap-8 { gap: 2rem; }

/* Spacing */
.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.m-0 { margin: 0; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.ml-2 { margin-left: 0.5rem; }
.mr-2 { margin-right: 0.5rem; }

/* Sizing */
.w-full { width: 100%; }
.w-3 { width: 0.75rem; }
.w-4 { width: 1rem; }
.w-5 { width: 1.25rem; }
.w-6 { width: 1.5rem; }
.w-px { width: 1px; }
.h-full { height: 100%; }
.h-3 { height: 0.75rem; }
.h-4 { height: 1rem; }
.h-5 { height: 1.25rem; }
.h-6 { height: 1.5rem; }
.h-px { height: 1px; }
.min-h-screen { min-height: 100vh; }
.min-w-fit { min-width: fit-content; }

/* Border radius */
.rounded { border-radius: var(--radius); }
.rounded-lg { border-radius: calc(var(--radius) + 0.25rem); }
.rounded-xl { border-radius: calc(var(--radius) + 0.5rem); }
.rounded-full { border-radius: 9999px; }
.rounded-md { border-radius: calc(var(--radius) - 0.25rem); }

/* Borders */
.border { border: 1px solid hsl(var(--border)); }
.border-2 { border-width: 2px; }
.border-b { border-bottom: 1px solid hsl(var(--border)); }

/* Shadows */
.shadow { box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1); }
.shadow-md { box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1); }
.shadow-lg { box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1); }

/* Text utilities */
.text-xs { font-size: 0.75rem; line-height: 1rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-base { font-size: 1rem; line-height: 1.5rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.text-xl { font-size: 1.25rem; line-height: 1.75rem; }
.text-2xl { font-size: 1.5rem; line-height: 2rem; }
.text-3xl { font-size: 1.875rem; line-height: 2.25rem; }
.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.text-center { text-align: center; }
.whitespace-nowrap { white-space: nowrap; }
.underline { text-decoration: underline; }
.no-underline { text-decoration: none; }

/* Opacity */
.opacity-50 { opacity: 0.5; }
.opacity-70 { opacity: 0.7; }
.opacity-80 { opacity: 0.8; }

/* Overflow */
.overflow-auto { overflow: auto; }
.overflow-hidden { overflow: hidden; }

/* Position */
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.inset-0 { top: 0; right: 0; bottom: 0; left: 0; }
.top-0 { top: 0; }
.right-0 { right: 0; }
.bottom-0 { bottom: 0; }
.left-0 { left: 0; }
.z-10 { z-index: 10; }
.z-50 { z-index: 50; }

/* Transitions */
.transition-all { transition: all 200ms ease; }
.transition-colors { transition: color 200ms ease, background-color 200ms ease, border-color 200ms ease; }
.transition-transform { transition: transform 200ms ease; }
.duration-200 { transition-duration: 200ms; }
.duration-300 { transition-duration: 300ms; }

/* Cursor */
.cursor-pointer { cursor: pointer; }
.cursor-default { cursor: default; }

/* Select */
.select-none { user-select: none; }

/* Pointer events */
.pointer-events-none { pointer-events: none; }

/* Transform */
.origin-top { transform-origin: top; }

/* Animations */
@keyframes fade-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes scale-in {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes slide-in-right {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

@keyframes slide-in-left {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.animate-fade-in { animation: fade-in 0.4s ease-out; }
.animate-scale-in { animation: scale-in 0.3s ease-out; }
.animate-slide-in-right { animation: slide-in-right 0.3s ease-out; }

/* ===== COMPONENT STYLES ===== */

/* Header */
.header {
    background-color: hsl(var(--card));
    border-bottom: 1px solid hsl(var(--border));
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-title {
    font-family: 'Decotype Thuluth II','Cormorant Garamond', Georgia, serif;
    font-size: 1.5rem;
    font-weight: 600;
    color: hsl(var(--heritage-brown));
    margin: 0;
}

.header-subtitle {
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 200ms ease;
    border: none;
    outline: none;
}

.btn:focus-visible {
    outline: 2px solid hsl(var(--ring));
    outline-offset: 2px;
}

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

.btn-primary:hover { background-color: hsl(var(--primary) / 0.9); }

.btn-secondary {
    background-color: hsl(var(--secondary));
    color: hsl(var(--secondary-foreground));
}

.btn-secondary:hover { background-color: hsl(var(--secondary) / 0.8); }

.btn-outline {
    background-color: transparent;
    border: 1px solid hsl(var(--border));
    color: hsl(var(--foreground));
}

.btn-outline:hover {
    background-color: hsl(var(--accent));
    color: hsl(var(--accent-foreground));
}

.btn-ghost {
    background-color: transparent;
    color: hsl(var(--foreground));
}

.btn-ghost:hover { background-color: hsl(var(--accent) / 0.1); }

.btn-destructive {
    background-color: hsl(var(--destructive));
    color: hsl(var(--destructive-foreground));
}

.btn-destructive:hover { background-color: hsl(var(--destructive) / 0.9); }

.btn-sm { padding: 0.25rem 0.75rem; font-size: 0.75rem; }
.btn-icon { padding: 0.5rem; width: 2.5rem; height: 2.5rem; }

/* Form controls */
.form-group { margin-bottom: 1rem; }

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
    color: hsl(var(--foreground));
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid hsl(var(--input));
    border-radius: var(--radius);
    background-color: hsl(var(--background));
    color: hsl(var(--foreground));
    font-size: 0.875rem;
    transition: border-color 200ms ease, box-shadow 200ms ease;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: hsl(var(--ring));
    box-shadow: 0 0 0 2px hsl(var(--ring) / 0.2);
}

.form-input::placeholder { color: hsl(var(--muted-foreground)); }
.form-textarea { min-height: 100px; resize: vertical; }

.select-wrapper { position: relative; }
.select-wrapper::after {
    content: '▼';
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.625rem;
    color: hsl(var(--muted-foreground));
    pointer-events: none;
}
.form-select { appearance: none; padding-right: 2rem; }

/* Cards */
.card {
    background-color: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    padding: 1.5rem;
}

.card-header { margin-bottom: 1rem; }
.card-title {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}
.card-description {
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
    margin-top: 0.25rem;
}

/* Dialog / Modal */
.dialog-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fade-in 0.2s ease;
}

.dialog-content {
    font-size: 1rem;
    background-color: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    padding: 1.5rem;
    max-width: 28rem;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: scale-in 0.2s ease;
}

.dialog-header { margin-bottom: 1rem; }
.dialog-title {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}
.dialog-description {
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
    margin-top: 0.5rem;
}
.dialog-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

/* Manage Access Dialog */
.dialog-content.dialog-lg {
    max-width: 64rem;
    width: 95%;
}

.dialog-content.dialog-lg .admin-table {
    min-width: 48rem;
}


/* Tree View */
.tree-container { display: flex; height: calc(100vh - 80px); }

.tree-view {
    flex: 1;
    overflow: auto;
    padding: 2rem;
    position: relative;
}

.tree-content {
    min-width: fit-content;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    transform-origin: top center;
    transition: transform 200ms ease;
}

/* Tree Legend */
.tree-legend {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
}

.legend-item { display: flex; align-items: center; gap: 0.5rem; }
.legend-dot { width: 0.75rem; height: 0.75rem; border-radius: 50%; }

/* Tree Branch */
.tree-branch { display: flex; flex-direction: column; align-items: center; }
.tree-branch-children { display: flex; align-items: flex-start; }
.tree-branch-child { display: flex; flex-direction: column; align-items: center; min-width: 74px; }

/* Tree Connectors */
.tree-line-vertical { width: 1px; height: 1rem; background-color: hsl(var(--foreground) / 0.6); }
.tree-line-horizontal { height: 1px; background-color: hsl(var(--foreground) / 0.6); }

.tree-connector { position: relative; width: 100%; height: 1rem; }
.tree-connector-line { position: absolute; top: 0; height: 1px; background-color: hsl(var(--foreground) / 0.6); }
.tree-connector-vertical {
    position: absolute;
    width: 1px;
    height: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: hsl(var(--foreground) / 0.6);
}

/* Tree Node */
.tree-node { display: flex; flex-direction: column; align-items: center; }

.tree-node-button {
    padding: 0.25rem 0.5rem;
    text-align: center;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 200ms ease;
    font-family: 'Al Diwani Al Majd 2', Georgia, serif;
    font-size: 1.5rem;
    white-space: nowrap;
}

.tree-node-button.root-name {
    font-family: 'Al Diwani Al Majd 2', 'Cormorant Garamond', Georgia, serif;
    font-size: 1.8rem;
    font-weight: 400;
}


.tree-node-button:hover { opacity: 0.8; }
.tree-node-button.selected { font-weight: 700; text-decoration: underline; }
.tree-node-button.deceased { opacity: 0.7; }
.tree-node-button.male { color: hsl(var(--male)); }
.tree-node-button.female { color: hsl(var(--female)); }

/* Collapse button */
.collapse-btn {
    width: 1.25rem;
    height: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: hsl(var(--muted));
    border: none;
    cursor: pointer;
    margin-top: 0.25rem;
    transition: background-color 200ms ease;
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
}

.collapse-btn:hover { background-color: hsl(var(--muted) / 0.8); }

/* Zoom Controls */
.zoom-controls {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    display: flex;
    gap: 0.5rem;
    background-color: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    padding: 0.5rem;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    z-index: 10;
}

.zoom-btn {
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 200ms ease;
    font-size: 1rem;
}

.zoom-btn:hover { background-color: hsl(var(--muted)); }

.zoom-level {
    display: flex;
    align-items: center;
    padding: 0 0.5rem;
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
    min-width: 3rem;
    justify-content: center;
}

/* Detail Panel */
.detail-panel {
    width: 28rem;
    border-right: 1px solid hsl(var(--border));
    background-color: hsl(var(--card));
    overflow-y: auto;
    animation: slide-in-left 0.3s ease;
    display: flex;
    flex-direction: column;
    direction: rtl;
    text-align: right;
    order: -1;
}

/* Green banner header */
.detail-panel-banner {
    height: 8rem;
    background-color: hsl(var(--primary));
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 1rem;
    flex-shrink: 0;
}

.detail-panel-close-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    padding: 0.25rem;
    transition: color 200ms ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.detail-panel-close-btn:hover {
    color: white;
}

/* Avatar section overlapping the banner */
.detail-panel-avatar-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: -3rem;
    padding: 0 1.5rem;
}

.detail-panel-avatar {
    width: 6rem;
    height: 6rem;
    border-radius: 50%;
    border: 4px solid hsl(var(--card));
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 4px 12px rgb(0 0 0 / 0.15);
    background-color: hsl(var(--muted));
}

.detail-panel-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.detail-panel-avatar-initials {
    font-size: 1.5rem;
    font-weight: 700;
    color: hsl(var(--muted-foreground));
}

.detail-panel-member-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: hsl(var(--foreground));
    margin: 1rem 0 0 0;
    text-align: center;
}

.detail-panel-lifespan {
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
    margin: 0.25rem 0 0 0;
}

/* Detail Panel body */
.detail-panel-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    flex: 1;
}

/* Gender/Status grid row */
.detail-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.detail-info-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

/* Icon containers with colored backgrounds */
.detail-info-icon {
    padding: 0.5rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.detail-info-icon .material-icons-round,
.detail-info-icon .material-symbols-outlined {
    font-size: 1.25rem;
}

.icon-blue {
    background-color: hsl(217 91% 95%);
    color: hsl(217 91% 50%);
}

.icon-rose {
    background-color: hsl(350 80% 95%);
    color: hsl(350 80% 50%);
}

.icon-green {
    background-color: hsl(152 60% 93%);
    color: hsl(152 60% 35%);
}

.icon-amber {
    background-color: hsl(38 92% 94%);
    color: hsl(38 92% 40%);
}

.icon-purple {
    background-color: hsl(270 60% 95%);
    color: hsl(270 60% 50%);
}

.icon-pink {
    background-color: hsl(340 80% 95%);
    color: hsl(340 80% 55%);
}

.icon-teal {
    background-color: hsl(170 60% 93%);
    color: hsl(170 60% 35%);
}

.detail-info-text {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    flex: 1;
}

.detail-info-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: hsl(var(--muted-foreground));
}

.detail-info-value {
    font-size: 0.875rem;
    font-weight: 500;
    color: hsl(var(--foreground));
}

.detail-info-section {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.detail-info-bio {
    font-size: 0.875rem;
    line-height: 1.6;
    color: hsl(var(--foreground));
    margin: 0.25rem 0 0 0;
}

.detail-info-empty {
    color: hsl(var(--muted-foreground));
    font-style: italic;
}

/* Relationship chip links */
.detail-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.detail-chip-link {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    background-color: hsl(var(--muted));
    color: hsl(var(--primary));
    font-weight: 500;
    font-size: 0.875rem;
    border-radius: 9999px;
    cursor: pointer;
    transition: background-color 200ms ease;
    text-decoration: underline;
    text-decoration-color: hsl(var(--primary) / 0.3);
    text-underline-offset: 4px;
}

.detail-chip-link:hover {
    background-color: hsl(var(--muted) / 0.7);
}

/* Children grid */
.detail-children-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.detail-child-card {
    padding: 0.5rem 0.75rem;
    border: 1px solid hsl(var(--border));
    border-radius: 0.5rem;
    color: hsl(var(--primary));
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 200ms ease;
    text-decoration: none;
    text-align: center;
}

.detail-child-card:hover {
    background-color: hsl(var(--muted) / 0.5);
}

/* Footer */
.detail-panel-footer {
    padding: 1.5rem;
    background-color: hsl(var(--muted) / 0.5);
    border-top: 1px solid hsl(var(--border));
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-shrink: 0;
}

.detail-panel-edit-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    background-color: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    font-weight: 600;
    font-size: 0.875rem;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background-color 200ms ease;
    box-shadow: 0 4px 6px hsl(var(--primary) / 0.2);
}

.detail-panel-edit-btn:hover {
    background-color: hsl(var(--primary) / 0.85);
}

.detail-panel-edit-btn .material-icons-round {
    font-size: 1.125rem;
}

.detail-panel-close-text-btn {
    padding: 0.625rem 1rem;
    background: transparent;
    border: none;
    color: hsl(var(--muted-foreground));
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    border-radius: var(--radius);
    transition: background-color 200ms ease;
}

.detail-panel-close-text-btn:hover {
    background-color: hsl(var(--muted));
}

/* Relationship links (legacy compat) */
.relationship-link {
    display: inline-block;
    color: hsl(var(--primary));
    text-decoration: underline;
    cursor: pointer;
    transition: color 200ms ease;
}

.relationship-link:hover { color: hsl(var(--primary) / 0.8); }

/* Dark mode icon overrides */
.dark .icon-blue { background-color: hsl(217 91% 15%); color: hsl(217 80% 65%); }
.dark .icon-rose { background-color: hsl(350 80% 15%); color: hsl(350 70% 65%); }
.dark .icon-green { background-color: hsl(152 60% 12%); color: hsl(152 50% 55%); }
.dark .icon-amber { background-color: hsl(38 80% 15%); color: hsl(38 80% 55%); }
.dark .icon-purple { background-color: hsl(270 60% 15%); color: hsl(270 50% 65%); }
.dark .icon-pink { background-color: hsl(340 80% 15%); color: hsl(340 70% 65%); }
.dark .icon-teal { background-color: hsl(170 60% 12%); color: hsl(170 50% 55%); }

.dark .detail-chip-link {
    background-color: hsl(var(--muted));
}

.dark .detail-child-card {
    border-color: hsl(var(--border));
}

.dark .detail-panel-footer {
    background-color: hsl(var(--muted) / 0.3);
}

/* Context Menu */
.context-menu {
    position: fixed;
    background-color: hsl(var(--popover));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    padding: 0.25rem;
    min-width: 160px;
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    z-index: 100;
    animation: scale-in 0.1s ease;
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    cursor: pointer;
    border-radius: calc(var(--radius) - 0.25rem);
    transition: background-color 200ms ease;
    color: hsl(var(--foreground));
    width: 100%;
    background: transparent;
    border: none;
    text-align: left;
}

.context-menu-item:hover { background-color: hsl(var(--accent) / 0.1); }
.context-menu-item.destructive { color: hsl(var(--destructive)); }
.context-menu-separator { height: 1px; background-color: hsl(var(--border)); margin: 0.25rem 0; }

/* Loading state */
.loading { display: flex; align-items: center; justify-content: center; padding: 2rem; }

.loading-spinner {
    width: 2rem;
    height: 2rem;
    border: 2px solid hsl(var(--border));
    border-top-color: hsl(var(--primary));
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Error state */
.error-message {
    background-color: hsl(var(--destructive) / 0.1);
    border: 1px solid hsl(var(--destructive) / 0.3);
    border-radius: var(--radius);
    padding: 1rem;
    color: hsl(var(--destructive));
    text-align: center;
}

/* Empty state */
.empty-state { text-align: center; padding: 3rem; color: hsl(var(--muted-foreground)); }
.empty-state-icon { font-size: 3rem; margin-bottom: 1rem; }

/* Blazor-specific error UI */
#blazor-error-ui {
    background: hsl(var(--destructive));
    color: hsl(var(--destructive-foreground));
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.blazor-error-boundary {
    background: hsl(var(--destructive));
    padding: 1rem;
    color: white;
}

/* Photo Upload Styles */
.photo-upload-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.photo-preview,
.photo-placeholder {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
}

.photo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-preview .photo-remove-btn {
    position: absolute;
    top: 0;
    right: 0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: hsl(var(--destructive));
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.photo-placeholder {
    background-color: hsl(var(--muted));
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed hsl(var(--border));
}

.photo-initials {
    font-size: 1.5rem;
    font-weight: 600;
    color: hsl(var(--muted-foreground));
    font-family: 'Cormorant Garamond', Georgia, serif;
}

.photo-input {
    display: none;
}

.photo-upload-btn {
    cursor: pointer;
}

/* Member Avatar Styles */
.member-avatar,
.member-avatar-large {
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.member-avatar {
    width: 32px;
    height: 32px;
}

.member-avatar-large {
    width: 64px;
    height: 64px;
}

.member-avatar img,
.member-avatar-large img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.member-avatar .avatar-initials {
    font-size: 0.75rem;
    font-weight: 600;
    font-family: 'Cormorant Garamond', Georgia, serif;
}

.member-avatar-large .avatar-initials {
    font-size: 1.25rem;
    font-weight: 600;
    font-family: 'Cormorant Garamond', Georgia, serif;
}

.avatar-male {
    background-color: hsl(var(--male) / 0.15);
    color: hsl(var(--male));
}

.avatar-female {
    background-color: hsl(var(--female) / 0.15);
    color: hsl(var(--female));
}

/* Detail Panel Header with Avatar */
.detail-panel-header-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
    .tree-container { flex-direction: column; }
    .detail-panel {
        width: 100%;
        border-right: none;
        border-top: 1px solid hsl(var(--border));
        max-height: 70vh;
    }
    .detail-children-grid {
        grid-template-columns: 1fr;
    }
    .zoom-controls { bottom: 1rem; right: 1rem; }
}

/* Header User Section */
.header-user-section {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-left: 1rem;
    padding-left: 1rem;
    border-left: 1px solid hsl(var(--border));
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-name {
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
}

/* Admin Pages */
.admin-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid hsl(var(--border));
}

.admin-header h1 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 2rem;
    font-weight: 600;
    color: hsl(var(--foreground));
    margin: 0;
}

.admin-nav {
    display: flex;
    gap: 1rem;
}

.admin-nav a {
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    color: hsl(var(--muted-foreground));
    text-decoration: none;
    transition: all 0.2s;
}

.admin-nav a:hover {
    color: hsl(var(--foreground));
    background-color: hsl(var(--muted));
}

.admin-nav a.active {
    color: hsl(var(--primary-foreground));
    background-color: hsl(var(--primary));
}

.admin-toolbar {
    margin-bottom: 1.5rem;
}

.admin-table-container {
    background-color: hsl(var(--card));
    border-radius: var(--radius);
    border: 1px solid hsl(var(--border));
    overflow: hidden;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

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

.admin-table th {
    background-color: hsl(var(--muted));
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: hsl(var(--muted-foreground));
}

.admin-table tbody tr:hover {
    background-color: hsl(var(--muted) / 0.5);
}

.admin-table tbody tr:last-child td {
    border-bottom: none;
}

.action-buttons {
    display: flex;
    gap: 0.5rem;
}

.btn.destructive {
    color: hsl(var(--destructive));
    border-color: hsl(var(--destructive));
}

.btn.destructive:hover {
    background-color: hsl(var(--destructive));
    color: hsl(var(--destructive-foreground));
}

/* Roles Dialog */
.roles-list {
    padding: 1rem 0;
}

.role-item {
    padding: 0.5rem 0;
}

.role-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.role-checkbox input {
    width: 1rem;
    height: 1rem;
}

/* Success/Error Messages */
.success-message {
    padding: 1rem;
    margin-bottom: 1rem;
    background-color: hsl(152 35% 90%);
    color: hsl(152 35% 28%);
    border-radius: var(--radius);
    border: 1px solid hsl(152 35% 70%);
}

/* Flex utilities */
.flex { display: flex; }
.gap-2 { gap: 0.5rem; }
.text-gray-500 { color: hsl(var(--muted-foreground)); }

/* Width utility */
.w-full { width: 100%; }

/* Login Page */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: hsl(var(--background));
    padding: 1rem;
}

.login-card {
    background-color: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    padding: 2rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 10px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

.login-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.login-header h2 {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.75rem;
    font-weight: 600;
    color: hsl(var(--heritage-brown));
    margin: 0 0 0.5rem 0;
}

.login-header p {
    color: hsl(var(--muted-foreground));
    font-size: 0.875rem;
    margin: 0;
}

.login-btn {
    width: 100%;
    margin-top: 0.5rem;
}

.login-footer {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid hsl(var(--border));
}

.login-footer a {
    color: hsl(var(--primary));
    text-decoration: none;
    font-size: 0.875rem;
}

.login-footer a:hover {
    text-decoration: underline;
}

/* Text utilities */
.text-muted {
    color: hsl(var(--muted-foreground));
}

.text-center {
    text-align: center;
}

/* Form Row for side-by-side fields */
.form-row {
    display: flex;
    gap: 1rem;
}

.form-group-half {
    flex: 1;
}
