/* ============================================================
   orgchart.css  —  Org-chart style family tree visualization
   ============================================================ */

/* Wrapper */
.orgchart-wrapper {
    position: relative;
    width: 100%;
    min-height: 600px;
    background: #fafafa;
    overflow: auto;
    max-height: 800px;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
}

/* SVG Layer */
.orgchart-connectors {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    background: transparent;
}

/* Content Container */
.orgchart-content {
    position: relative;
    z-index: 2;
    padding: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 60px;
}

.connector-line {
    stroke: #999;
    stroke-width: 2;
    stroke-dasharray: 2, 2;
    fill: none;
}

.connector-line.parent-line {
    stroke: #666;
    stroke-width: 2.5;
}

.connector-line.sibling-line {
    stroke: #777;
    stroke-width: 2;
}

.connector-line.child-line {
    stroke: #888;
    stroke-width: 1.8;
}

/* Tree Container */
.orgchart-tree {
    position: relative;
    width: fit-content;
    min-height: 600px;
    min-width: 100%;
}

/* Org Chart Node */
.orgchart-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
}

/* Org Chart Card */
.orgchart-card {
    --card-width: 220px;
    width: var(--card-width);
    padding: 16px;
    background: #fff;
    border: 2.5px solid #333;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.orgchart-card.male {
    border-color: #1976D2;
    background: linear-gradient(135deg, #ffffff 0%, #E3F2FD 100%);
}

.orgchart-card.female {
    border-color: #27E1A6;
    background: linear-gradient(135deg, #ffffff 0%, #E8F5E9 100%);
}

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

.orgchart-card.highlight {
    background: #fff9c4 !important;
    border-color: #FBC02D !important;
    box-shadow: 0 0 0 3px rgba(251, 192, 45, 0.4), 0 4px 12px rgba(251, 192, 45, 0.3) !important;
}

/* Card Content */
.card-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.card-name-np {
    font-size: 15px;
    font-weight: 700;
    color: #222;
    font-family: 'Noto Sans Devanagari', sans-serif;
    line-height: 1.3;
}

.card-name-en {
    font-size: 13px;
    color: #555;
    font-weight: 500;
}

.card-year {
    font-size: 11px;
    color: #B71C1C;
    font-weight: 600;
    margin-top: 2px;
}

/* Collapse Button */
.orgchart-collapse-btn {
    position: absolute;
    bottom: -28px;
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 32px;
    background: #fff;
    border: 2px solid #333;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    color: #333;
    font-size: 14px;
    z-index: 10;
}

.orgchart-collapse-btn:hover {
    background: #333;
    color: #fff;
    transform: translateX(-50%) scale(1.1);
}

/* Children Container */
.orgchart-children {
    display: flex;
    gap: 30px;
    justify-content: center;
    flex-wrap: wrap;
    width: 100%;
    margin-top: 20px;
}

/* Modal Styling */
.person-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

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

.person-modal-content {
    background: #fff;
    border-radius: 12px;
    max-width: 480px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    animation: slideUp 0.3s ease;
    border: 3px solid #333;
}

.person-modal-content.male {
    border-color: #1976D2;
}

.person-modal-content.female {
    border-color: #27E1A6;
}

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

.modal-header {
    background: linear-gradient(135deg, #1976D2 0%, #27E1A6 100%);
    color: #fff;
    padding: 24px;
    border-radius: 9px 9px 0 0;
    text-align: center;
}

.modal-header h2 {
    margin: 0 0 8px 0;
    font-size: 22px;
    font-family: 'Noto Sans Devanagari', sans-serif;
    font-weight: 700;
}

.modal-name-en {
    margin: 0;
    font-size: 15px;
    opacity: 0.95;
    font-weight: 500;
}

.modal-body {
    padding: 24px;
}

.modal-section {
    margin-bottom: 18px;
}

.modal-section label {
    display: block;
    font-weight: 700;
    color: #333;
    margin-bottom: 6px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #B71C1C;
}

.modal-section p {
    margin: 0;
    color: #666;
    font-size: 15px;
    line-height: 1.6;
}

.modal-close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255, 255, 255, 0.3);
    border: none;
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.2s;
}

.modal-close-btn:hover {
    background: rgba(255, 255, 255, 0.6);
    transform: scale(1.1);
}

/* Privacy Warning Modal */
.privacy-warning-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001;
    animation: fadeIn 0.2s ease;
}

.privacy-warning-modal {
    background: #fff;
    border-radius: 12px;
    max-width: 450px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    animation: slideUp 0.3s ease;
    border: 3px solid #B71C1C;
    overflow: hidden;
}

.privacy-warning-header {
    background: linear-gradient(135deg, #B71C1C 0%, #D32F2F 100%);
    color: #fff;
    padding: 24px;
    text-align: center;
}

.privacy-warning-header h2 {
    margin: 0 0 8px 0;
    font-size: 22px;
    font-weight: 700;
}

.privacy-warning-header p {
    margin: 0;
    font-size: 14px;
    opacity: 0.95;
}

.privacy-warning-body {
    padding: 24px;
}

.privacy-warning-body p {
    margin: 0 0 16px 0;
    color: #333;
    font-size: 15px;
    line-height: 1.6;
}

.privacy-warning-body strong {
    color: #B71C1C;
}

.privacy-warning-contact {
    background: #FFF3E0;
    border-left: 4px solid #F57C00;
    padding: 12px;
    margin: 16px 0;
    border-radius: 4px;
}

.privacy-warning-contact p {
    margin: 0;
    font-size: 14px;
    color: #555;
}

.privacy-warning-contact a {
    color: #1976D2;
    text-decoration: none;
    font-weight: 600;
}

.privacy-warning-contact a:hover {
    text-decoration: underline;
}

.privacy-warning-buttons {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.privacy-warning-btn {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #333;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
}

.privacy-warning-btn.cancel {
    background: #fff;
    color: #333;
}

.privacy-warning-btn.cancel:hover {
    background: #f0f0f0;
    border-color: #666;
}

.privacy-warning-btn.confirm {
    background: #B71C1C;
    color: #fff;
    border-color: #B71C1C;
}

.privacy-warning-btn.confirm:hover {
    background: #D32F2F;
    border-color: #D32F2F;
}

/* Controls */
.tree-controls-orgchart {
    display: flex;
    gap: 10px;
    flex-wrap: nowrap;
    margin-bottom: 20px;
    padding: 12px;
    background: #f0f0f0;
    border-radius: 8px;
    align-items: center;
    overflow-x: auto;
}

.tree-control-btn {
    padding: 10px 16px;
    background: #fff;
    border: 2px solid #333;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    color: #333;
    flex-shrink: 0;
    white-space: nowrap;
}

.tree-control-btn:hover {
    background: #B71C1C;
    color: #fff;
    border-color: #B71C1C;
}

.search-box-orgchart {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    min-width: 240px;
}

.search-input-orgchart {
    flex: 1;
    padding: 10px 14px;
    border: 2px solid #333;
    border-radius: 8px;
    font-size: 13px;
    outline: none;
    font-weight: 500;
    min-width: 150px;
}

.search-input-orgchart:focus {
    border-color: #B71C1C;
    box-shadow: 0 0 0 3px rgba(183, 28, 28, 0.2);
}

/* Zoom Controls */
.zoom-controls {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 0 8px;
    border-left: 1px solid #ddd;
    flex-shrink: 0;
}

.zoom-level {
    min-width: 45px;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: #333;
    flex-shrink: 0;
}

.zoom-btn {
    padding: 8px 12px;
    background: #fff;
    border: 2px solid #333;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: #333;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
    height: 32px;
    flex-shrink: 0;
    white-space: nowrap;
}

.zoom-btn:hover {
    background: #B71C1C;
    border-color: #B71C1C;
    color: #fff;
}

.zoom-btn:active {
    transform: scale(0.95);
}
}

/* Responsive */
@media (max-width: 768px) {
    .orgchart-wrapper {
        max-height: 600px;
    }

    .orgchart-content {
        padding: 20px;
        gap: 40px;
    }

    .zoom-controls {
        flex-wrap: wrap;
        gap: 4px;
        padding: 4px;
    }

    .zoom-level,
    .zoom-btn {
        font-size: 11px;
        padding: 6px 10px;
    }

    .orgchart-card {
        --card-width: 180px;
        padding: 12px;
        border-radius: 16px;
        font-size: 12px;
    }

    .card-name-np {
        font-size: 14px;
    }

    .card-name-en {
        font-size: 12px;
    }

    .orgchart-collapse-btn {
        width: 28px;
        height: 28px;
        font-size: 12px;
        bottom: -24px;
    }

    .orgchart-children {
        gap: 20px;
    }

    .tree-controls-orgchart {
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 8px;
        padding: 8px;
    }

    .search-box-orgchart {
        min-width: 180px;
    }

    .person-modal-content {
        width: 95%;
    }

    .modal-header {
        padding: 20px;
    }

    .modal-header h2 {
        font-size: 20px;
    }

    .modal-body {
        padding: 16px;
    }
}

@media print {
    .tree-controls-orgchart {
        display: none;
    }

    .orgchart-collapse-btn {
        display: none;
    }

    .person-modal-overlay {
        display: none;
    }

    .orgchart-wrapper {
        background: #fff;
    }
}
