/* Tree Explorer Styles for Info Page */

/* Maintenance Notice */
.maintenance-notice {
    background: linear-gradient(135deg, #ff9800 0%, #ff5722 100%);
    padding: 0.8rem 1.2rem;
    margin: 1rem auto;
    max-width: 700px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(255, 87, 34, 0.3);
    text-align: center;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.maintenance-notice h2 {
    color: white;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.maintenance-notice .notice-text {
    color: white;
    font-size: 0.85rem;
    line-height: 1.5;
    margin-bottom: 0.4rem;
    direction: rtl;
    text-align: center;
    font-weight: 500;
}

.maintenance-notice .notice-text-en {
    color: rgba(255, 255, 255, 0.95);
    font-size: 0.8rem;
    line-height: 1.4;
    margin-bottom: 0;
    direction: ltr;
    text-align: center;
    font-style: italic;
    font-weight: 400;
}

body[data-theme="dark"] .maintenance-notice {
    background: linear-gradient(135deg, #d84315 0%, #bf360c 100%);
    box-shadow: 0 8px 25px rgba(191, 54, 12, 0.4);
}

@media (max-width: 768px) {
    .maintenance-notice {
        margin: 0.8rem 1rem;
        padding: 0.7rem 1rem;
    }
    
    .maintenance-notice h2 {
        font-size: 1rem;
    }
    
    .maintenance-notice .notice-text {
        font-size: 0.8rem;
    }
    
    .maintenance-notice .notice-text-en {
        font-size: 0.75rem;
    }
}

@media (max-width: 576px) {
    .maintenance-notice {
        margin: 0.6rem 0.5rem;
        padding: 0.6rem 0.8rem;
        border-radius: 8px;
    }
    
    .maintenance-notice h2 {
        font-size: 0.9rem;
        margin-bottom: 0.4rem;
    }
    
    .maintenance-notice .notice-text {
        font-size: 0.75rem;
        line-height: 1.4;
    }
    
    .maintenance-notice .notice-text-en {
        font-size: 0.7rem;
    }
}

.tree-explorer {
    min-height: 85vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: visible; /* Changed from hidden to allow full node visibility */
    padding: 3rem 2rem; /* Increased top/bottom padding */
    width: 100%;
}

.tree-explorer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('Ezidies.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    filter: blur(2px) brightness(0.8);
    z-index: 0;
    opacity: 0.3;
}

.tree-explorer > * {
    position: relative;
    z-index: 1;
}

.tree-container {
    position: relative;
    width: 100%;
    max-width: 1200px;
    min-height: 680px; /* Stable minimum height */
    height: 680px; /* Set initial fixed height */
    transition: height 0.6s ease; /* Smooth height transitions only */
    margin-inline: auto;
    flex: 0 0 100%;
    min-width: 100%;
    overflow: visible; /* Allow nodes to be fully visible */
}

.tree-node {
    position: absolute;
    background: var(--card-bg-light);
    border: 2px solid var(--primary-color);
    border-radius: 25px;
    padding: 0.9rem 1.6rem;
    cursor: pointer;
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text-dark);
    user-select: none;
    z-index: 10;
    white-space: nowrap;
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    max-width: 200px;
    text-align: center;
    line-height: 1.3;
    -webkit-tap-highlight-color: transparent; /* Remove tap highlight on mobile */
    touch-action: manipulation; /* Improve touch responsiveness */
}

.tree-node.entering {
    animation: smoothEnter 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes smoothEnter {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }
    60% {
        opacity: 0.8;
        transform: translate(-50%, -50%) scale(1.05);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.tree-node.exiting {
    animation: smoothExit 0.5s cubic-bezier(0.64, 0, 0.78, 0) forwards;
    pointer-events: none;
}

@keyframes smoothExit {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.3);
    }
}

body[data-theme="dark"] .tree-node {
    background: var(--card-bg-dark);
    color: var(--text-light);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.tree-node:hover {
    transform: translate(-50%, calc(-50% - 3px)) scale(1.08);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    border-width: 3px;
    filter: brightness(1.1);
    z-index: 15; /* Bring to front on hover */
}

.tree-node.active {
    background: linear-gradient(135deg, var(--node-color, var(--primary-color)), var(--secondary-color));
    color: white;
    border-color: white;
    transform: translate(-50%, -50%) scale(1.15);
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.5);
    z-index: 20;
    font-size: 1.15rem; /* Slightly larger when active */
}

.tree-node.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(0.2);
}

.tree-line {
    position: absolute;
    background: var(--primary-color);
    transform-origin: top left;
    z-index: 1;
    opacity: 0;
}

.tree-line.entering {
    opacity: 0;
}

.tree-line.exiting {
    opacity: 0.6;
}

body[data-theme="dark"] .tree-line {
    opacity: 0.8;
    box-shadow: 0 0 10px rgba(var(--primary-color-rgb), 0.3);
}

.tree-line.hidden {
    opacity: 0;
    transform: scale(0);
}

/* Root node - Ezidi */
.node-ezidi {
    left: 50%;
    top: 50%;
    font-size: 1.5rem;
    padding: 1.5rem 2.5rem;
}

/* Level 1 - Ezidi branches - radial distribution */
.node-history-top { 
    left: 72%;
    top: 12%;
}
.node-caltor { 
    left: 85%;
    top: 32%;
}
.node-du3a { 
    left: 83%;
    top: 60%;
}
.node-nav { 
    left: 70%;
    top: 82%;
}

/* Level 2 - Lalish and Owner */
.node-lalish { 
    left: 26%;
    top: 72%;
}
.node-owner { 
    left: 48%;
    top: 90%;
}

/* Level 3 - Lalish branches */
.node-history-bottom { 
    left: 10%;
    top: 54%;
}
.node-else { 
    left: 4%;
    top: 76%;
}
.node-xas { 
    left: 16%;
    top: 94%;
}

.info-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--card-bg-light);
    border-radius: 20px;
    padding: 3rem;
    max-width: 600px;
    width: 90%;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.3);
    opacity: 0;
    pointer-events: none;
    transition: all 0.5s ease;
    z-index: 100;
    max-height: 80vh;
    overflow-y: auto;
}

body[data-theme="dark"] .info-panel {
    background: var(--card-bg-dark);
    color: var(--text-light);
}

.info-panel.active {
    opacity: 1;
    pointer-events: all;
}

.info-panel h2 {
    color: var(--primary-color);
    font-size: 2rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.info-panel p {
    line-height: 1.8;
    font-size: 1.05rem;
    margin-bottom: 1rem;
    text-align: justify;
}

.close-info {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.close-info:hover {
    transform: rotate(90deg) scale(1.1);
    background: var(--secondary-color);
}

.back-button {
    position: absolute;
    top: 2rem;
    right: 2rem;
    background: rgba(var(--primary-color-rgb), 0.9);
    color: white;
    border: 2px solid white;
    border-radius: 12px;
    padding: 0.8rem 1.5rem;
    cursor: pointer;
    font-weight: 700;
    font-size: 1rem;
    transition: all 0.3s ease;
    opacity: 0;
    pointer-events: none;
    z-index: 50;
}

.back-button.active {
    opacity: 1;
    pointer-events: all;
}

.back-button:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(var(--primary-color-rgb), 0.4);
}

/* Tablet devices (768px - 992px) */
@media (min-width: 769px) and (max-width: 992px) {
    .tree-explorer {
        min-height: 75vh;
        padding: 2rem 1rem;
    }
    
    .tree-container {
        height: 630px;
        min-height: 630px;
    }
    
    .tree-node {
        font-size: 0.95rem;
        padding: 0.8rem 1.3rem;
        max-width: 170px;
    }
    
    .tree-node.active {
        font-size: 1.05rem;
    }
    
    .back-button {
        padding: 0.7rem 1.3rem;
    }
}

/* Mobile devices (577px - 768px) */
@media (max-width: 768px) {
    .tree-explorer {
        min-height: 80vh;
        padding: 2rem 0.5rem;
    }
    
    .tree-container {
        height: 650px;
        min-height: 650px;
        max-width: 100%;
    }
    
    .tree-node {
        font-size: 0.8rem;
        padding: 0.6rem 1rem;
        max-width: 130px;
        line-height: 1.2;
        border-width: 2px;
        white-space: normal;
        word-wrap: break-word;
    }
    
    .tree-node:hover {
        transform: translate(-50%, calc(-50% - 2px)) scale(1.03);
        border-width: 2.5px;
    }
    
    .tree-node.active {
        font-size: 0.9rem;
        transform: translate(-50%, -50%) scale(1.1);
        padding: 0.7rem 1.1rem;
    }
    
    .node-ezidi {
        font-size: 1rem;
        padding: 0.9rem 1.5rem;
    }
    
    .back-button {
        top: 1rem;
        right: 1rem;
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
    }
    
    .info-panel {
        padding: 2rem 1.5rem;
        width: 95%;
        max-height: 75vh;
    }
    
    .info-panel h2 {
        font-size: 1.5rem;
        margin-bottom: 1.2rem;
    }
    
    .info-panel p {
        font-size: 1rem;
        line-height: 1.7;
    }
}

/* Extra small devices - phones in portrait */
@media (max-width: 576px) {
    .tree-explorer {
        padding: 1.5rem 0.5rem;
        min-height: 75vh;
    }
    
    .tree-container {
        height: 550px;
        min-height: 550px;
        max-width: 100%;
    }
    
    .tree-node {
        font-size: 0.7rem;
        padding: 0.45rem 0.75rem;
        border-radius: 15px;
        max-width: 105px;
        border-width: 1.5px;
        line-height: 1.15;
        white-space: normal;
        word-wrap: break-word;
    }
    
    .tree-node.active {
        font-size: 0.8rem;
        padding: 0.6rem 0.9rem;
        transform: translate(-50%, -50%) scale(1.08);
    }
    
    .tree-node:hover {
        transform: translate(-50%, calc(-50% - 1px)) scale(1.02);
        border-width: 2px;
    }
    
    .node-ezidi {
        font-size: 0.85rem;
        padding: 0.7rem 1.1rem;
    }
    
    .back-button {
        top: 0.5rem;
        right: 0.5rem;
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
        border-radius: 10px;
    }
    
    .info-panel {
        padding: 1.5rem;
        width: 98%;
        max-height: 70vh;
        border-radius: 15px;
    }
    
    .info-panel h2 {
        font-size: 1.3rem;
        margin-bottom: 1rem;
    }
    
    .info-panel p {
        font-size: 0.95rem;
        line-height: 1.6;
    }
    
    .close-info {
        width: 35px;
        height: 35px;
        font-size: 1.3rem;
        top: 0.5rem;
        left: 0.5rem;
    }
}

/* Info Display Section */
.info-display-section {
    width: 100%;
    max-width: 1200px;
    margin: 2rem auto;
    padding: 5%;
    background: var(--card-bg-light);
    border-radius: 20px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    min-height: 300px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease;
}

body[data-theme="dark"] .info-display-section {
    background: var(--card-bg-dark);
    color: var(--text-light);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.info-display-section.active {
    opacity: 1;
    transform: translateY(0);
}

.info-display-section h2 {
    color: var(--primary-color);
    font-size: 2.5rem;
    margin-bottom: 2rem;
    text-align: center;
    font-weight: 800;
}

.info-display-section .content {
    font-size: 1.15rem;
    line-height: 2;
    text-align: right; /* Better for RTL Arabic text */
    direction: rtl; /* Ensure proper RTL rendering */
}

.info-display-section .content p {
    margin-bottom: 1.5rem;
    color: inherit;
    text-indent: 0; /* Remove text indent for cleaner look */
}

.info-display-section .placeholder {
    text-align: center;
    color: #999;
    font-size: 1.2rem;
    padding: 4rem 2rem;
}

body[data-theme="dark"] .info-display-section .placeholder {
    color: #666;
}

/* Mobile responsiveness for info display section */
@media (max-width: 768px) {
    .info-display-section {
        padding: 6%;
        margin: 1.5rem 1rem;
        border-radius: 15px;
    }
    
    .info-display-section h2 {
        font-size: 1.8rem;
        margin-bottom: 1.5rem;
    }
    
    .info-display-section .content {
        font-size: 1.05rem;
        line-height: 1.8;
        text-align: right;
    }
    
    .info-display-section .placeholder {
        font-size: 1rem;
        padding: 3rem 1.5rem;
    }
}

@media (max-width: 576px) {
    .info-display-section {
        padding: 5%;
        margin: 1rem 0.5rem;
        border-radius: 12px;
        min-height: 250px;
    }
    
    .info-display-section h2 {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }
    
    .info-display-section .content {
        font-size: 0.95rem;
        line-height: 1.7;
        text-align: right;
    }
    
    .info-display-section .content p {
        margin-bottom: 1.2rem;
    }
    
    .info-display-section .placeholder {
        font-size: 0.9rem;
        padding: 2.5rem 1rem;
    }
}
