:root {
    --bg-gradient-start: #040d21;
    --bg-gradient-end: #010510;
    --ring-color: rgba(255, 255, 255, 0.05);
    --ring-text: rgba(255, 255, 255, 0.3);
    --line-color: rgba(255, 255, 255, 0.1);
    --line-active: #8b5cf6;
    --glow-color: #e0e7ff;
    --ancestor-node-color: #fcd34d;
    --star-node-color: #c7d2fe;
    --active-star-color: #a78bfa;

    /* Event Colors */
    --event-dob: #22C55E;
    --event-dod: #EF4444;
    --event-dow: #EC4899;
}

body {
    margin: 0;
    padding: 0;
    background: radial-gradient(circle at center, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    color: white;
    font-family: 'Hind', sans-serif;
    overflow: hidden;
    height: 100vh;
}

.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    background: rgba(10, 15, 30, 0.4);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 1000;
    box-sizing: border-box;
}

.nav-left, .nav-right {
    flex: 1;
    display: flex;
    align-items: center;
}

.nav-right {
    justify-content: flex-end;
}

.nav-center {
    flex: 2;
    text-align: center;
}

.nav-title {
    font-family: 'Playfair Display', serif;
    margin: 0;
    font-size: 1.8rem;
    background: linear-gradient(135deg, #ffffff 0%, #fcd34d 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0px 2px 4px rgba(252, 211, 77, 0.2));
}

.back-btn, .nav-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    color: white;
    text-decoration: none;
    font-size: 0.95rem;
    opacity: 0.8;
    transition: all 0.3s ease;
    background: none;
    border: none;
    cursor: pointer;
    font-family: 'Hind', sans-serif;
    padding: 8px 12px;
    border-radius: 12px;
}

.back-btn:hover, .nav-btn:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

#universe {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 5;
    pointer-events: none;
}

#universe * {
    pointer-events: auto;
}

#rotating-world {
    will-change: transform;
}

.pointer-triangle {
    fill: var(--ancestor-node-color);
    filter: drop-shadow(0 0 8px var(--ancestor-node-color));
}

.pointer-date-text {
    fill: var(--ancestor-node-color);
    font-size: 16px;
    font-weight: 700;
    filter: drop-shadow(0 0 5px rgba(252, 211, 77, 0.5));
}

.date-tick-text {
    font-size: 7px;
    fill: rgba(255, 255, 255, 0.4);
    text-anchor: end;
}

.date-tick-line {
    stroke: rgba(255, 255, 255, 0.15);
    stroke-width: 1;
}

#celestial-map {
    width: 100%;
    height: 100%;
    display: block;
}

.ring-text {
    font-size: 12px;
    fill: var(--ring-text);
    text-anchor: middle;
    letter-spacing: 2px;
}

.constellation-line {
    stroke: var(--line-color);
    stroke-width: 1;
    fill: none;
    transition: stroke 0.5s ease, stroke-width 0.5s ease;
}

.constellation-line.active {
    stroke: var(--line-active);
    stroke-width: 1.5;
    filter: url(#glow);
}

.node {
    cursor: pointer;
    transition: all 0.3s ease;
}

.node circle {
    fill: var(--star-node-color);
    transition: r 0.3s ease, fill 0.3s ease;
}

.node text {
    fill: rgba(255,255,255,0.7);
    font-size: 11px;
    text-anchor: middle;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.node:hover text, .node.active text {
    opacity: 1;
}

.node.ancestor circle {
    fill: var(--ancestor-node-color);
    r: 5;
    filter: url(#strong-glow);
}

.node.ancestor text {
    opacity: 0.9;
    font-size: 13px;
    fill: var(--ancestor-node-color);
}

.node.star circle {
    fill: var(--star-node-color);
    r: 3;
    filter: url(#glow);
}

.node.star.active circle {
    fill: white;
    r: 9;
    filter: url(#strong-glow);
    animation: pulsar 1.5s infinite alternate;
}

.node.star.active text {
    fill: white;
    font-size: 14px;
    font-weight: 700;
}

@keyframes pulsar {
    from { opacity: 0.6; }
    to { opacity: 1; filter: url(#strong-glow) brightness(1.5); }
}

#center-info {
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    width: 90%;
    max-width: 500px;
    z-index: 10;
}

#event-details, #no-event-actions {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    transition: opacity 0.4s ease, transform 0.4s ease;
    opacity: 0;
    pointer-events: none;
}

#event-details.visible, #no-event-actions.visible {
    opacity: 1;
    pointer-events: auto;
}

.glass-card {
    background: rgba(10, 15, 30, 0.4);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 24px;
    padding: 30px 20px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4), inset 0 0 20px rgba(255,255,255,0.03);
}

.no-event-card {
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px; /* Reduced gap for three buttons */
}

.persistent-actions {
    margin-top: 15px;
    padding: 20px;
    display: flex;
    justify-content: center;
}

.action-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap; /* Good for mobile */
}

#event-details h2 {
    margin: 0 0 5px 0;
    font-size: 2.2rem;
    background: linear-gradient(135deg, #ffffff 0%, #fcd34d 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-family: 'Playfair Display', serif;
    filter: drop-shadow(0px 2px 4px rgba(252, 211, 77, 0.2));
}

.parent-info {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.4);
    display: block;
    margin-top: -5px;
    margin-bottom: 15px;
    font-weight: 500;
}

.countdown-exact {
    margin-top: 15px;
    font-family: 'Hind', sans-serif;
    font-size: 1.1rem;
    letter-spacing: 1px;
    color: #fcd34d;
    background: rgba(252, 211, 77, 0.05);
    padding: 10px 25px;
    border-radius: 15px;
    border: 1px solid rgba(252, 211, 77, 0.2);
    display: inline-block;
    box-shadow: 0 0 20px rgba(252, 211, 77, 0.1);
}

.upcoming-banner {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 12px 25px;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
    width: 100%;
}

.upcoming-label {
    text-transform: uppercase;
    font-size: 0.65rem;
    letter-spacing: 2px;
    color: var(--ancestor-node-color);
    font-weight: 700;
}

.upcoming-content {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
    font-weight: 600;
}

.upcoming-content .material-symbols-rounded {
    font-size: 20px;
}

#event-tabs-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 15px;
}

.event-tab {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.7);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    font-family: 'Hind', sans-serif;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.event-tab:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

.event-tab.active {
    background: rgba(139, 92, 246, 0.3);
    border-color: rgba(139, 92, 246, 0.6);
    color: white;
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.2);
}

.event-tab svg {
    width: 14px;
    height: 14px;
}


.event-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.modal-profile-img {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 15px auto;
    border: 3px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
    display: none;
}

#modal-date-container {
    margin: 0;
    font-size: 1.15rem;
    opacity: 0.95;
    text-shadow: 0px 2px 5px rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.numerology-badge {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #fcd34d;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
}

.moolank-desc {
    font-size: 0.95rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.85);
    margin: 10px 0 15px 0;
    padding: 12px 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border-left: 3px solid #fcd34d;
    text-align: left;
    display: none;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.2);
}

.event-icon svg {
    width: 20px;
    height: 20px;
}

.countdown-badge {
    display: inline-block;
    padding: 6px 16px;
    backdrop-filter: blur(5px);
}

.action-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    padding: 10px 24px;
    border-radius: 25px;
    font-size: 1.05rem;
    font-family: 'Hind', sans-serif;
    cursor: pointer;
    margin: 10px 10px;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: white;
    transform: translateY(-2px);
}

.action-btn.next-btn {
    background: rgba(139, 92, 246, 0.25);
    border-color: rgba(139, 92, 246, 0.6);
}

.action-btn.prev-btn {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
}

.action-btn.prev-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.4);
}

.material-symbols-rounded {
    vertical-align: middle;
    font-size: 24px;
}

.td-event .material-symbols-rounded {
    font-size: 20px;
    color: var(--ancestor-node-color);
}

.event-tab .material-symbols-rounded {
    font-size: 18px;
}

/* Event Color Classes */
.event-dob, .icon-dob { color: var(--event-dob) !important; filter: drop-shadow(0 0 5px rgba(34, 197, 94, 0.4)); }
.event-dod, .icon-dod { color: var(--event-dod) !important; filter: drop-shadow(0 0 5px rgba(239, 68, 68, 0.4)); }
.event-dow, .icon-dow { color: var(--event-dow) !important; filter: drop-shadow(0 0 5px rgba(236, 72, 153, 0.4)); }

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85); /* Darken overlay */
    backdrop-filter: blur(10px);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    overflow: hidden; /* Prevent modal itself from scrolling */
}

.modal.visible {
    display: flex;
}

.modal-content {
    width: 90%;
    max-width: 1000px;
    height: 85vh; /* Fixed height for modal */
    background: rgba(10, 15, 30, 0.8) !important;
    backdrop-filter: blur(30px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 30px;
    display: flex;
    flex-direction: column; /* Vital for footer/header/body layout */
    overflow: hidden; /* Body will handle scroll */
    padding: 0;
    animation: modalScaleUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalScaleUp {
    from { opacity: 0; transform: scale(0.9) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    flex-shrink: 0; /* Header stays same size */
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 35px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(15, 23, 42, 0.4);
}

.table-controls {
    display: flex;
    gap: 15px;
    align-items: center;
    flex: 1;
    justify-content: center;
    margin: 0 40px;
}

.search-box {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 5px 12px;
    width: 250px;
}

.search-box input {
    background: none;
    border: none;
    color: white;
    padding: 5px;
    outline: none;
    width: 100%;
}

.table-controls select {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 8px 12px;
    border-radius: 12px;
    outline: none;
    cursor: pointer;
}

.modal-header h2 {
    margin: 0;
    font-family: 'Playfair Display', serif;
    background: linear-gradient(135deg, #ffffff 0%, #fcd34d 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.3s;
}

.close-btn:hover {
    opacity: 1;
}

.modal-body {
    flex: 1;
    overflow-y: auto !important; /* Force scroll visibility */
    padding: 0 40px 40px;
    -webkit-overflow-scrolling: touch;
    max-height: calc(85vh - 120px); /* Explicit height constraint for scrolling */
}

/* Custom Scrollbar for Modal Body */
.modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 10px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.table-container {
    width: 100%;
}

table {
    width: 100%;
    border-collapse: collapse;
    color: rgba(255, 255, 255, 0.9);
}

th, td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

th {
    position: sticky;
    top: -20px;
    background: rgba(15, 23, 42, 0.95);
    font-weight: 600;
    color: var(--ancestor-node-color);
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 1px;
    z-index: 10;
}

tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.td-event {
    display: flex;
    align-items: center;
    gap: 8px;
}

.td-lineage {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.5);
}

/* Custom Scrollbar */
.modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.modal-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

@media (max-width: 768px) {
    .nav-title { font-size: 1.4rem; }
    .back-btn span, .nav-btn span { display: none; }
    .modal-content { width: 95%; height: 90vh; }
    th, td { padding: 12px 8px; font-size: 0.9rem; }
    .td-lineage { display: none; }
}
