/* public/css/dashboard.css - Light Theme — Visual Hierarchy v2 */

/* --- PANEL HEADER (dash-header) --- */
/* Adds brand presence to the top bar without going dark */
.dash-header {
    background: #fff;
    border-bottom: none;
    /* Soft elevation instead of hard line */
    box-shadow: 0 4px 15px rgba(42, 75, 89, 0.04);
}

/* --- TAB ROW --- */
/* Differentiated warm tint so it reads as a distinct zone */
.dash-tabs {
    background: #faf8f2 !important;
    /* Warm cream — matches sidebar brand */
    border-bottom: none !important;
    padding-bottom: 4px;
}

/* Active tab: amber underline (was teal — amber is the brand accent) */
.dash-tab.active {
    color: var(--km-teal);
    font-weight: 600;
}

.dash-tab.active::after {
    background: var(--km-amber) !important;
    /* Amber underline on active tab */
}

/* Inactive tab hover: warm tint on hover */
.dash-tab:hover:not(.active) {
    color: var(--km-teal);
    background: rgba(207, 144, 3, 0.06);
    border-radius: 4px 4px 0 0;
}

/* --- CHART STYLE TOGGLE (S/N) --- */
/* Promote to a proper styled pill with amber-active state */
.chart-style-text-toggle {
    background: rgba(42, 75, 89, 0.05) !important;
    /* Subtle teal tint background */
    border: 1px solid rgba(42, 75, 89, 0.15) !important;
    border-radius: 20px !important;
    padding: 3px 4px !important;
    gap: 0 !important;
}

.style-opt {
    position: relative;
    /* Anchor for ::before tooltip */
    padding: 3px 9px;
    border-radius: 16px;
    font-size: 0.72rem;
    font-weight: 500;
    transition: all 0.2s;
    color: var(--km-text-light);
}

/* Pure CSS label tooltip — appears above on hover */
.style-opt[data-label]::before {
    content: attr(data-label);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(42, 75, 89, 0.92);
    /* Teal pill */
    color: #fff;
    font-size: 0.68rem;
    font-weight: 500;
    padding: 3px 9px;
    border-radius: 5px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 99999;
    letter-spacing: 0.3px;
}

.style-opt:hover[data-label]::before {
    opacity: 1;
}

/* Disable tooltips on touch devices / mobile views */
@media (max-width: 1024px) {
    .style-opt[data-label]::before {
        content: none !important;
        display: none !important;
    }
}

.style-opt.active {
    background: var(--km-amber) !important;
    /* Amber active — brand consistent */
    color: #fff !important;
    font-weight: 700;
    box-shadow: 0 1px 4px rgba(207, 144, 3, 0.35);
}

.style-opt:hover:not(.active) {
    color: var(--km-teal);
    background: rgba(42, 75, 89, 0.07);
}

/* --- CHART CONTAINER --- */
/* Adds a warmer ambient background to frame the chart */
.chart-viz-container {
    width: 100%;
    aspect-ratio: 1/1;
    background: #fdfbf5;
    /* Very warm cream — frames the chart */
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    padding: 20px; /* Breathing room for SVG */
    border: none;
    box-shadow: 0 4px 20px rgba(42, 75, 89, 0.06), inset 0 2px 10px rgba(0, 0, 0, 0.02);
    /* Soft 3D elevation */
}

.chart-viz-container svg {
    max-width: 100%;
    max-height: 100%;
}

/* Legend: in-flow caption below chart */
.chart-legend {
    width: 100%;
    display: block;
    text-align: center;
    font-size: 0.75rem;
    color: #8b8fa3;
    padding: 8px 10px 20px 10px; /* added bottom padding to ensure it's never cut off */
    margin-top: 4px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    flex-shrink: 0;
    line-height: 1.4;
}

/* --- CONTEXT BAR (chart sub-tabs) --- */
/* Warmer background for the D1/D9/... chip row */
.context-bar {
    background: #faf8f2 !important;
    border-bottom: none !important;
    box-shadow: inset 0 -4px 10px rgba(0, 0, 0, 0.01);
}

/* --- PLANET TABLE --- */
.planet-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    margin-top: 10px;
}

.planet-table th {
    text-align: left;
    color: var(--km-teal);
    /* Teal column headers — stronger hierarchy */
    font-weight: 700;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    padding: 8px 6px;
    border-bottom: 2px solid rgba(207, 144, 3, 0.2);
    /* Amber separator under header */
    background: rgba(207, 144, 3, 0.04);
    /* Very faint amber tint on header row */
}

.planet-table td {
    padding: 8px 6px;
    border-bottom: 1px solid var(--km-border);
    color: var(--km-text);
}

.planet-row:hover {
    background: rgba(42, 75, 89, 0.04);
}

.planet-name {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    color: var(--km-teal);
}

/* --- DIGNITY TAGS --- */
.dignity-tag {
    font-size: 0.7rem;
    padding: 2px 5px;
    border-radius: 4px;
    font-weight: 600;
}

.dignity-R {
    color: #d35400;
    background: rgba(211, 84, 0, 0.1);
    border: 1px solid rgba(211, 84, 0, 0.2);
}

.dignity-C {
    color: #c0392b;
    background: rgba(192, 57, 43, 0.1);
}

.dignity-Ex {
    color: #27ae60;
    background: rgba(39, 174, 96, 0.1);
}

/* --- TOGGLES & CONTROLS --- */
.control-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.toggle-switch {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--km-text-light);
    font-weight: 500;
}

.toggle-input {
    display: none;
}

.toggle-track {
    width: 36px;
    height: 20px;
    background: #bdc3c7;
    border-radius: 10px;
    position: relative;
    transition: 0.3s;
}

.toggle-input:checked+.toggle-track {
    background: var(--km-teal);
}

.toggle-track::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    transition: 0.3s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.toggle-input:checked+.toggle-track::after {
    transform: translateX(16px);
}

/* --- EMPTY STATE (The Celestial Watcher) --- */
.empty-chart-hint {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--km-text-light);
    text-align: center;
    padding: 10px;
    opacity: 1;
    gap: 15px;
    overflow: visible; /* FIX: was 'hidden', which clipped orbital animations */
}

.mandala-container {
    position: relative;
    width: 160px;
    height: 160px;
    aspect-ratio: 1 / 1;
    flex: 0 0 auto;
    margin: 0 auto;
}

/* Full-size Layered Architecture (Stable Centering) */
.mandala-container > div {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 1. ATMAN (Radiant Sun) */
.layer-atman-sun {
    z-index: 10;
}

.sun-core {
    width: 18px;
    height: 18px;
    background: var(--km-amber);
    border-radius: 50%;
    box-shadow: 0 0 12px rgba(207, 144, 3, 0.4);
    z-index: 2;
}

.sun-rays-container {
    position: absolute;
    width: 48px;
    height: 48px;
    color: var(--km-amber);
    animation: simple-rotate 60s linear infinite; /* Majestic rotation */
    z-index: 1;
}

/* 2. JEEVA (Jupiter) - 1 Year Cycle (Reference) */
.layer-jeeva-orbit-container {
    animation: simple-rotate 40s linear infinite;
}

.jeeva-orbit-ring {
    width: 90px;
    height: 90px;
    aspect-ratio: 1 / 1;
    box-sizing: border-box;
    border: 1.8px dashed #C5A028; /* Darker Gold for visibility */
    border-radius: 50%;
    opacity: 0.6;
}

.shape-jupiter {
    position: absolute;
    top: calc(50% - 45px - 11px); /* Match 90px orbit (radius 45px) */
    left: 50%;
    transform: translateX(-50%);
    width: 22px;
    height: 22px;
    color: #C5A028; /* Darker Gold / Deep Saffron */
    animation: simple-rotate-ccw 40s linear infinite; /* Counter-rotate to stay upright */
}

.jupiter-bands {
    filter: drop-shadow(0 0 4px rgba(197, 160, 40, 0.3));
}

/* 3. KARMA (Saturn) - 2.5 Year Cycle (Slower) */
.layer-karma-orbit-container {
    animation: simple-rotate 100s linear infinite; /* 2.5x slower than Jupiter */
}

.karma-orbit-ring {
    width: 130px;
    height: 130px;
    aspect-ratio: 1 / 1;
    box-sizing: border-box;
    border: 1px solid var(--km-teal);
    border-radius: 50%;
    opacity: 0.25;
}

.shape-saturn-group {
    position: absolute;
    bottom: calc(50% - 65px - 13px);
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 26px;
    color: var(--km-teal);
    animation: simple-rotate-ccw 100s linear infinite; /* Counter-rotate to stay upright */
}

/* 4. MANAS (Mind Spark) */
.layer-manas-mind {
    z-index: 20;
    animation: manas-wander-new 20s ease-in-out infinite;
}

.mind-spark-icon {
    width: 24px;
    height: 24px;
    color: var(--km-gold);
    filter: drop-shadow(0 0 10px var(--km-amber));
}

/* 5. DEHA (Frame) */
.layer-deha-frame {
    width: 100%;
    height: 100%;
}

.deha-frame-shape {
    width: 155px;
    height: 155px;
    aspect-ratio: 1 / 1;
    box-sizing: border-box;
    border: 1.5px solid var(--km-gold);
    opacity: 0.15;
    transform: rotate(45deg);
}

/* Robust Simple Animations */
@keyframes simple-rotate {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

@keyframes simple-rotate-ccw {
    from { transform: rotate(0deg); }
    to   { transform: rotate(-360deg); }
}

/* FIX: Constrained translateX to 55px max so mind spark stays within 80px radius */
@keyframes manas-wander-new {
    0%   { transform: rotate(0deg)   translateX(50px) rotate(0deg);   opacity: 0.6; }
    10%  { transform: rotate(36deg)  translateX(55px) rotate(-36deg); opacity: 0.8; }
    20%  { transform: rotate(72deg)  translateX(50px) rotate(-72deg); opacity: 1; }
    30%  { transform: rotate(108deg) translateX(55px) rotate(-108deg); opacity: 0.8; }
    40%  { transform: rotate(144deg) translateX(50px) rotate(-144deg); opacity: 1; }
    50%  { transform: rotate(180deg) translateX(55px) rotate(-180deg); opacity: 0.6; }
    60%  { transform: rotate(216deg) translateX(50px) rotate(-216deg); opacity: 0.8; }
    70%  { transform: rotate(252deg) translateX(55px) rotate(-252deg); opacity: 1; }
    80%  { transform: rotate(288deg) translateX(50px) rotate(-288deg); opacity: 0.8; }
    90%  { transform: rotate(324deg) translateX(55px) rotate(-324deg); opacity: 1; }
    100% { transform: rotate(360deg) translateX(50px) rotate(-360deg); opacity: 0.6; }
}
