/* Info Panel */
.info-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    padding: 20px; /* Reduced from 40px to reduce empty space */
    background: #fff;
}

h3 {
    color: var(--primary-dark);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 10px;
    margin-top: 0;
    font-weight: 400;
    text-transform: uppercase;
    font-size: 1.1rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

th {
    background-color: #f5f5f5;
    color: var(--text-light);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover {
    background-color: #fafafa;
}

/* Tooltip Styles */
.tooltip {
    position: relative;
    display: inline-block;
    cursor: help;
    border-bottom: 1px dotted #999; /* Subtle indicator */
}

.tooltip .tooltip-text {
    visibility: hidden;
    width: 220px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 8px 10px;
    position: absolute;
    z-index: 10;
    bottom: 125%; /* Position above */
    left: 50%;
    transform: translateX(-50%); /* Center horizontally */
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 12px;
    font-weight: normal;
    line-height: 1.4;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    pointer-events: none;
    text-transform: none; /* Reset any header transforms */
}

.tooltip .tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%; /* At the bottom of the tooltip */
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #333 transparent transparent transparent;
}

/* Fix for tooltips in the first column (prevent cutting off left) */
td:first-child .tooltip .tooltip-text {
    left: 0;
    transform: translateX(0);
    text-align: left;
}

td:first-child .tooltip .tooltip-text::after {
    left: 15px; /* Align arrow to the left */
    margin-left: 0;
}

/* Fix for tooltips in the last column (prevent cutting off right) */
td:last-child .tooltip .tooltip-text {
    left: auto;
    right: 0;
    transform: translateX(0);
    text-align: right;
}

td:last-child .tooltip .tooltip-text::after {
    left: auto;
    right: 15px; /* Align arrow to the right */
    margin-left: 0;
}

.tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Insights Panel */
#insights-panel {
    margin-top: 20px;
    border-top: 1px solid #eee;
    padding-top: 20px;
}

.insight-box {
    background: #f9f9f9;
    border-left: 4px solid var(--primary-color);
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 0 4px 4px 0;
}

.insight-box h4 {
    margin-top: 0;
    color: var(--primary-dark);
    margin-bottom: 10px;
    font-size: 1rem;
}

.insight-box ul {
    padding-left: 20px;
    margin: 0;
}

.insight-box li {
    margin-bottom: 5px;
    color: #424242;
}

/* Life Analysis Sub-sections */
.life-area-section {
    margin-bottom: 15px;
}

.life-area-section:last-child {
    margin-bottom: 0;
}

.life-area-section h5 {
    margin-top: 10px;
    margin-bottom: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary-dark);
    border-bottom: 1px solid #eee;
    padding-bottom: 4px;
}

.life-area-section ul {
    margin-top: 5px;
    padding-left: 0; /* Remove default padding if we want it flush or custom */
    list-style-type: none; /* Remove bullets if desired, or keep them */
}

.life-area-section li {
    margin-bottom: 8px;
    line-height: 1.5;
    font-size: 0.9rem;
    padding: 4px 0; /* Reduced from 10px */
    border-bottom: 1px dashed #eee; /* Lighter border */
}

.life-area-section li:last-child {
    border-bottom: none;
}

/* Specific override for h4 inside insight-box to prevent conflict with generic .info-panel h4 */
.info-panel .insight-box h4 {
    margin-top: 0;
    border-left: none;
    padding-left: 0;
    text-transform: none;
    letter-spacing: normal;
}

/* Advanced Analysis Section */
.info-panel h4 {
    color: var(--primary-dark);
    margin-top: 25px;
    margin-bottom: 15px;
    font-size: 0.95rem;
    font-weight: 700;
    border-left: 4px solid var(--accent-color);
    padding-left: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-panel ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

.info-panel li {
    padding: 10px 0;
    border-bottom: 1px dashed #e0e0e0;
    font-size: 14px;
    color: #424242;
    line-height: 1.5;
}

.info-panel li:last-child {
    border-bottom: none;
}

.info-panel p {
    font-size: 14px;
    color: #444;
    line-height: 1.6;
}

.insight-text {
    font-size: 14px;
    color: #333;
    margin: 5px 0;
}

.insight-text.expect {
    margin-top: 10px;
}

.dasha-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-dark);
}

.dasha-date {
    font-size: 0.85rem;
    color: #777;
}


/* Timeline Styles */
.timeline-container {
    margin: 20px 0;
    padding: 15px;
    background: var(--bg-color);
    border-radius: var(--radius);
}

.timeline-container h5 {
    margin: 0 0 10px 0;
    font-size: 0.9rem;
    color: #777;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.timeline {
    display: flex;
    overflow-x: auto;
    gap: 10px;
    padding-bottom: 5px;
    scrollbar-width: thin;
}

.timeline-item {
    flex: 0 0 auto;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    text-align: center;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
    color: var(--text-color);
    min-width: 80px;
}

.timeline-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.timeline-item.past {
    background: #e0e0e0;
    color: #757575;
    border-color: #d0d0d0;
}

.timeline-item.current {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(63, 81, 181, 0.3);
}

.timeline-item.selected {
    border-color: var(--accent-color);
    border-width: 2px;
}

/* Insights Navigation */
.insights-nav {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
    overflow-x: auto;
    white-space: nowrap;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 10;
    padding-top: 10px;
    /* Center the items if they fit, otherwise allow scroll */
    justify-content: flex-start; 
}

/* Media query for larger screens to center nav */
@media (min-width: 768px) {
    .insights-nav {
        justify-content: center;
    }
}

.insights-nav .nav-link {
    background: #f8f9fa; /* Light background for inactive state */
    border: 1px solid transparent;
    color: #555;
    padding: 8px 16px;
    font-size: 13px;
    cursor: pointer;
    border-radius: 20px;
    transition: all 0.2s;
    box-shadow: none;
    height: auto;
    text-transform: none;
    font-weight: 500;
}

.insights-nav .nav-link:hover {
    background-color: #e9ecef;
    color: var(--primary-color);
    transform: translateY(-1px);
}

.insights-nav .nav-link.active {
    background-color: var(--primary-color);
    color: white;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Scrollbar for nav */
.insights-nav::-webkit-scrollbar {
    height: 4px;
}

.insights-nav::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.insight-box {
    scroll-margin-top: 70px; /* Offset for sticky header */
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .info-panel {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 15px;
        min-width: 0;
    }
    
    .info-panel > div {
        overflow-x: auto;
        width: 100%;
        min-width: 0;
        margin-bottom: 15px;
        -webkit-overflow-scrolling: touch;
    }

    table {
        font-size: 12px;
        width: 100%;
    }

    th, td {
        padding: 8px 5px;
        white-space: nowrap;
    }
}
