/* Google Fonts - Plus Jakarta Sans */
@import url('https://fonts.googleapis.com');

:root {
    --primary: #3b82f6;
    --primary-light: #eff6ff;
    --secondary: #64748b;
    --danger: #ef4444;
    --success: #10b981;
    --male: #3b82f6;
    --female: #f43f5e;
    --bg: #f8fafc;
    --card-bg: rgba(255, 255, 255, 0.9);
    --line: #cbd5e1;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg);
    font-family: 'Plus Jakarta Sans', sans-serif;
    margin: 0;
    padding: 20px;
    color: #1e293b;
}

/* Soyağacı Ana Konteynır */
.tree-container {
    width: 100%;
    overflow-x: auto;
    padding: 40px 0;
    cursor: grab;
}

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

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

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

/* Bağlantı Çizgileri - Daha Zarif */
.tree li::before, .tree li::after {
    content: '';
    position: absolute; top: 0; right: 50%;
    border-top: 2px solid var(--line);
    width: 50%; height: 20px;
}
.tree li::after {
    right: auto; left: 50%;
    border-left: 2px solid var(--line);
}

.tree li:only-child::after, .tree li:only-child::before { display: none; }
.tree li:only-child { padding-top: 0; }
.tree li:first-child::before, .tree li:last-child::after { border: 0 none; }
.tree li:last-child::before { border-right: 2px solid var(--line); border-radius: 0 10px 0 0; }
.tree li:first-child::after { border-radius: 10px 0 0 0; }

.tree ul ul::before {
    content: '';
    position: absolute; top: 0; left: 50%;
    border-left: 2px solid var(--line);
    width: 0; height: 20px;
}

/* Aile Ünitesi (Eşler) */
.family-unit {
    display: flex;
    gap: 12px;
    justify-content: center;
    align-items: center;
    margin-bottom: 5px;
}

/* Premium Üye Kartı */
.member-card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    padding: 12px;
    border-radius: 20px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.5);
    width: 150px;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

.member-card:hover {
    transform: scale(1.05) translateY(-5px);
    box-shadow: 0 20px 30px -10px rgba(0, 0, 0, 0.1);
    z-index: 50;
}

.male { border-bottom: 4px solid var(--male); }
.female { border-bottom: 4px solid var(--female); }

.profile-img {
    width: 60px;
    height: 60px;
    border-radius: 18px; /* Squircle */
    object-fit: cover;
    margin-bottom: 8px;
    border: 3px solid #fff;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.info strong {
    display: block;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.info small {
    display: block;
    font-size: 10px;
    color: var(--secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Yönetim Butonları - Her zaman görünür ve şık */
.admin-buttons {
    position: absolute;
    top: -10px;
    right: -10px;
    display: flex;
    gap: 5px;
    z-index: 100;
    opacity 1 !important; /* Her zaman görünür yap */
}

.admin-buttons a {
    background: #ffffff;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex; /* İçeriği ortalamak için */
    align-items: center; /* Dikeyde ortala */
    justify-content: center; /* Yatayda ortala */
    text-decoration: none;
    box-shadow: 0 4px 6px rgba(0,0,0,0.15);
    transition: all 0.2s ease;
    border: 1px solid #e2e8f0;
}

.admin-buttons a svg {
    display: block; /* SVG'nin taşmasını engelle */
}

.btn-edit { color: #ca8a04; }
.btn-delete { color: #dc2626; }

.btn-edit:hover { background: #fef9c3; transform: scale(1.1); }
.btn-delete:hover { background: #fee2e2; transform: scale(1.1); }
/* Mobil cihazlar için buton boyutunu biraz büyütelim */
@media (max-width: 600px) {
    .admin-buttons a {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }
}
/* --- PREMIUM POPUP (MODAL) --- */
.modal {
    display: none; /* Varsayılan olarak gizli */
    position: fixed;
    z-index: 9999; /* Her şeyin üstünde olması için */
    left: 0; top: 0;
    width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.7); /* Koyu transparan arka plan */
    backdrop-filter: blur(5px);
    align-items: center; /* Dikeyde ortala */
    justify-content: center; /* Yatayda ortala */
}

.modal-icerik {
    background: #fff;
    width: 90%;
    max-width: 450px;
    border-radius: 25px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

@keyframes slideUp {
    from { transform: translateY(50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Modal Header - Mavi Arka Plan */
.modal-header {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    height: 120px;
    position: relative;
    z-index: 1; /* Arka planda kalsın */
}

/* Modal Gövdesi */
.modal-body {
    padding: 0 30px 30px 30px;
    text-align: center;
    position: relative;
    z-index: 2; /* Resim ve metinler öne gelsin */
    margin-top: -60px; /* Resmi yukarıya, mavinin üstüne çeker */
}

/* Profil Resmi - Üstte Görünmesi İçin */
.modal-img {
    width: 110px;
    height: 110px;
    border-radius: 30px; /* Modern Squircle */
    border: 5px solid #ffffff; /* Beyaz çerçeve resmi ayırır */
    object-fit: cover;
    background-color: #ffffff;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2); /* Derinlik katar */
    position: relative;
    z-index: 10; /* En üst katmana çıkarır */
}

/* Kapatma Butonu (Mavinin üstünde kalsın) */
.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    z-index: 20;
    transition: color 0.2s;
}

.modal-close:hover { color: #fff; }

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-top: 20px;
    text-align: left;
}

.detail-item {
    background: #f1f5f9;
    padding: 10px 15px;
    border-radius: 12px;
}

.detail-item label {
    display: block;
    font-size: 10px;
    color: #64748b;
    text-transform: uppercase;
    font-weight: 700;
}

.detail-item span {
    font-size: 14px;
    font-weight: 600;
}

.biyografi-box {
    margin-top: 20px;
    text-align: left;
    background: #f8fafc;
    padding: 15px;
    border-radius: 15px;
    font-size: 14px;
    color: #475569;
    border: 1px dashed #cbd5e1;
}

/* Mobil Düzenlemeler */
@media (max-width: 600px) {
    .member-card { width: 120px; padding: 10px; }
    .profile-img { width: 45px; height: 45px; }
    .info strong { font-size: 11px; }
    .modal-icerik { width: 95%; margin: 0 10px; }
}
/* Soyağacı İzleme Alanı */
.tree-viewer {
    position: relative;
    width: 100%;
    height: 75vh;
    background: #f1f5f9;
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    cursor: grab;
    margin-top: 20px;
    touch-action: none;
    -webkit-overflow-scrolling: touch;
    user-select: none;
}

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


/* Form Section ayarını düzeltelim ki ağaçla çakışmasın */
.form-section {
    margin-bottom: 20px;
}

/* Sağ Alt Kontrol Paneli */
.tree-controls {
    position: absolute;
    bottom: 15px; /* Alt kenara yakınlık */
    right: 15px; /* Sağ kenara yakınlık */
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 99999;
}

/* Butonların Tasarımı */
.tree-controls button {
    width: 40px;
    height: 40px;
    border-radius: 50%; /* Daha modern yuvarlak görünüm */
    border: 1px solid #e2e8f0;
    background: #ffffff;
    color: #334155;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.tree-controls button:hover {
    background: #3b82f6;
    color: #ffffff;
    transform: scale(1.1);
}

/* İkonların görünmeme ihtimaline karşı yedek (eğer kütüphane yüklenmezse) */
.tree-controls button i {
    font-family: "Font Awesome 6 Free" !important;
    font-weight: 900 !important;
    display: inline-block !important;
    font-style: normal;
    font-variant: normal;
    text-rendering: auto;
    -webkit-font-smoothing: antialiased;
}
/* Sürükleme ve Zoom Alanı */
.tree-canvas {
    display: inline-block;
    padding: 150px;
    transform-origin: center center; /* Zoom merkezden olsun */
    transition: transform 0.2s cubic-bezier(0.2, 0, 0.2, 1);
}
/* Sayfanın en sağ alt köşesine çivileme */
.fixed-controls {
    position: fixed;
    bottom: 30px; /* Alttan boşluk */
    right: 30px;  /* Sağdan boşluk */
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 10000; /* Her şeyin (modal dahil) üstünde olması için */
}

.fixed-controls button {
    width: 50px;
    height: 50px;
    border-radius: 15px;
    border: 1px solid rgba(255,255,255,0.3);
    background: rgba(255, 255, 255, 0.8); /* Cam efekti */
    backdrop-filter: blur(10px);
    color: #1e293b;
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.fixed-controls button:hover {
    background: #3b82f6;
    color: #ffffff;
    transform: scale(1.1) translateY(-2px);
    box-shadow: 0 12px 20px rgba(59, 130, 246, 0.3);
}

.fixed-controls button svg {
    transition: transform 0.2s;
}

.fixed-controls button:active {
    transform: scale(0.9);
}
.timeline {
    position: relative;
    max-width: 800px;
    margin: 40px auto;
    padding: 20px;
}
.timeline::after {
    content: '';
    position: absolute;
    width: 4px;
    background-color: #3b82f6;
    top: 0; bottom: 0; left: 50%;
    margin-left: -2px;
}
.timeline-item {
    padding: 10px 40px;
    position: relative;
    width: 50%;
    box-sizing: border-box;
}
.timeline-item.left { left: 0; text-align: right; }
.timeline-item.right { left: 50%; text-align: left; }

.timeline-item::after {
    content: '';
    position: absolute;
    width: 20px; height: 20px;
    right: -10px; top: 15px;
    background-color: white; border: 4px solid #3b82f6;
    border-radius: 50%; z-index: 1;
}
.right::after { left: -10px; }

.timeline-content-box {
    padding: 15px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
}

/* Soyağacı Modern Kart Sistemi */
:root {
    --soy-accent: #6366f1; /* Canlı Indigo */
    --soy-bg-page: #f8fafc;
    --soy-text-title: #0f172a;
    --soy-text-desc: #64748b;
    --soy-card-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.04), 0 4px 6px -4px rgba(0, 0, 0, 0.02);
}

.soy-members-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); /* Daha kompakt kartlar */
    gap: 20px;
    padding: 20px;
}

.soy-member-card {
    background: #ffffff;
    border: 1px solid #f1f5f9;
    border-radius: 24px; /* Daha yuvarlak köşeler */
    padding: 20px 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: var(--soy-card-shadow);
    position: relative;
    overflow: hidden;
}

.soy-member-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.08);
    border-color: var(--soy-accent);
}

/* Profil Resmi Alanı */
.soy-avatar-wrapper {
    position: relative;
    margin-bottom: 15px;
}

.soy-avatar-img {
    width: 75px;
    height: 75px;
    border-radius: 22px; /* Karemsi-yuvarlak (Squircle) */
    object-fit: cover;
    border: 3px solid #ffffff;
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}

/* Cinsiyet İndikatörü (Resmin üzerinde küçük nokta) */
.soy-badge {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 3px solid #ffffff;
}
.soy-badge-male { background: #3b82f6; }
.soy-badge-female { background: #f43f5e; }

/* Bilgi Alanı */
.soy-member-info {
    text-align: center;
    width: 100%;
}

.soy-member-info h4 {
    color: var(--soy-text-title);
    font-size: 15px;
    font-weight: 800;
    margin: 0 0 4px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.soy-member-info p {
    color: var(--soy-text-desc);
    font-size: 12px;
    margin: 2px 0;
    font-weight: 500;
}

/* Alt Aksiyon Butonu */
.soy-card-footer {
    margin-top: 15px;
    width: 100%;
}

.soy-edit-link {
    display: block;
    background: #f1f5f9;
    color: var(--soy-text-title);
    text-decoration: none;
    font-size: 11px;
    font-weight: 700;
    text-align: center;
    padding: 8px;
    border-radius: 12px;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.soy-member-card:hover .soy-edit-link {
    background: var(--soy-accent);
    color: #ffffff;
}
/* Arama Bölümü Tasarımı */
.soy-search-section {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-bottom: 40px; /* Kartlarla arasına mesafe koyar */
    padding: 0 20px;
}

.soy-search-card {
    background: #ffffff;
    width: 100%;
    max-width: 500px;
    display: flex;
    align-items: center;
    padding: 12px 20px;
    border-radius: 50px; /* Tam yuvarlak modern görünüm */
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.soy-search-card:focus-within {
    border-color: #6366f1;
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.1);
    transform: translateY(-2px);
}

.soy-search-card i {
    color: #94a3b8;
    margin-right: 15px;
    font-size: 16px;
}

.soy-search-card input {
    border: none !important;
    outline: none !important;
    background: transparent !important;
    width: 100%;
    font-size: 15px;
    color: #1e293b;
    box-shadow: none !important;
}

.soy-search-card input::placeholder {
    color: #cbd5e1;
}