/* simple-family-tree/assets/css/sft-public.css */

.sft-tree-wrapper {
    overflow-x: auto;
    padding-bottom: 20px;
    -webkit-text-size-adjust: 100%;
}

.sft-tree {
    display: block; /* use block for proper margin-auto fallback */
    width: max-content;
    min-width: max-content;
    margin: 0 auto; /* safe centering: left aligns when overflowing */
    -webkit-text-size-adjust: 100%;
}

.sft-zoom-btn:hover {
    background-color: #f0f0f0 !important;
}

.sft-tree ul {
    padding-top: 20px; 
    position: relative;
    transition: all 0.5s;
    -webkit-transition: all 0.5s;
    -moz-transition: all 0.5s;
    display: flex;
    justify-content: center;
    list-style: none;
    margin: 0;
    padding-left: 0;
    flex-shrink: 0;
}

.sft-tree li {
    text-align: center;
    list-style-type: none;
    position: relative;
    padding: 20px 5px 0 5px;
    transition: all 0.5s;
    -webkit-transition: all 0.5s;
    -moz-transition: all 0.5s;
    flex-shrink: 0;
}

.sft-tree li::before, .sft-tree li::after{
    content: '';
    position: absolute; top: 0; right: 50%;
    border-top: 2px solid #ccc;
    width: 50%; height: 20px;
}
.sft-tree li::after{
    right: auto; left: 50%;
    border-left: 2px solid #ccc;
}

.sft-tree li:only-child::after, .sft-tree li:only-child::before {
    display: none;
}

.sft-tree li:only-child{ padding-top: 0;}

.sft-tree li:first-child::before, .sft-tree li:last-child::after{ border: 0 none; }

.sft-tree li:last-child::before{
    border-right: 2px solid #ccc;
    border-radius: 0 5px 0 0;
}
.sft-tree li:first-child::after{
    border-radius: 5px 0 0 0;
}

.sft-tree ul ul::before{
    content: '';
    position: absolute; top: 0; left: 50%;
    border-left: 2px solid #ccc;
    width: 0; height: 20px;
}

.sft-node-group {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sft-node-card {
    border: 1px solid #ddd;
    padding: 15px;
    text-decoration: none;
    color: #333;
    font-size: 14px;
    display: inline-block;
    border-radius: 12px;
    transition: all 0.3s ease;
    background: #fff;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    width: 150px;
    min-width: 150px;
    box-sizing: border-box;
}

.sft-spouse-connector {
    width: 30px;
    border-top: 2px dashed #999;
    margin: 0 5px;
}

.sft-birth-order {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    font-size: 11px;
    font-weight: bold;
    color: #666;
    border: 1px solid #ccc;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    line-height: 18px;
    text-align: center;
    box-sizing: border-box;
    z-index: 5;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.sft-spouse {
    background: #fafafa;
}

.sft-node-card:hover {
    background: #f0f8ff;
    border-color: #b0d4ff;
    box-shadow: 0 6px 12px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.sft-avatar {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 8px;
    border: 2px solid #eee;
}
.sft-avatar-placeholder {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background-color: #e0e0e0;
    margin: 0 auto 8px auto;
}

.sft-name {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 4px;
}
.sft-year {
    font-size: 13px;
    color: #777;
}

/* Modal CSS */
.sft-modal {
    position: fixed; 
    z-index: 100000; 
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    overflow: auto; 
    background-color: rgba(0,0,0,0.7); 
    display: flex;
    align-items: center;
    justify-content: center;
}

.sft-modal-content {
    background-color: #fff;
    padding: 30px;
    border: none;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 16px;
    position: relative;
    box-shadow: 0 15px 40px rgba(0,0,0,0.25);
    animation: sftFadeIn 0.3s;
}

@keyframes sftFadeIn {
    from {opacity: 0; transform: translateY(-30px) scale(0.95);}
    to {opacity: 1; transform: translateY(0) scale(1);}
}

.sft-modal-close {
    color: #999;
    position: absolute;
    top: 15px;
    right: 25px;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s ease;
}

.sft-modal-close:hover,
.sft-modal-close:focus {
    color: #333;
    text-decoration: none;
}

@media (max-width: 768px) {
    .sft-tree li { padding: 20px 2px 0 2px; }
    .sft-node-card { width: 120px; min-width: 120px; padding: 10px; }
    .sft-avatar, .sft-avatar-placeholder { width: 50px; height: 50px; }
    .sft-name { font-size: 13px; }
    .sft-year { font-size: 11px; }
    .sft-spouse-connector { width: 15px; margin: 0 2px;}
.sft-modal-content { padding: 20px; width: 95%; }
}

.sft-modal-link, .sft-meta-link {
    color: #0073aa;
    text-decoration: none;
    transition: color 0.2s;
    cursor: pointer;
}
.sft-modal-link:hover, .sft-meta-link:hover {
    color: #005177;
    text-decoration: underline;
}

.sft-link-ward { color: #009688; font-weight: 500; }
.sft-link-ward:hover { color: #00796B; }

.sft-link-district { color: #FF9800; font-weight: 500; }
.sft-link-district:hover { color: #F57C00; }

.sft-link-province { color: #3F51B5; font-weight: 500; }
.sft-link-province:hover { color: #303F9F; }

.sft-link-month { color: #9C27B0; font-weight: 500; }
.sft-link-month:hover { color: #7B1FA2; }

.sft-link-year { color: #E91E63; font-weight: 500; }
.sft-link-year:hover { color: #C2185B; }
