/* ========================================
   Celestial Analytics
   Minimal CSS - Tailwind handles most styles
   ======================================== */

/* CSS Custom Properties (used by JS and complex selectors) */
:root {
    --purple-950: #0a0a0f;
    --purple-900: #1a0a2e;
    --purple-800: #2d1b4e;
    --purple-700: #4a2c7a;
    --purple-600: #6b3fa0;
    --purple-500: #a855f7;
    --purple-400: #c084fc;
    --purple-300: #d8b4fe;
    
    --pink-500: #ec4899;
    --blue-500: #3b82f6;
    --green-500: #22c55e;
    --amber-500: #f59e0b;
    --red-500: #ef4444;
    
    --love-color: #ec4899;
    --career-color: #3b82f6;
    --health-color: #22c55e;
    --finance-color: #f59e0b;
    
    --bg-card: rgba(42, 20, 80, 0.6);
    --border-color: rgba(168, 85, 247, 0.35);
    --text-primary: #f8f8ff;
    --text-secondary: #a8a3b8;
    --text-muted: #6b6585;
    
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
}

/* Base reset - Tailwind handles most but we need these */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; }
body {
    font-family: 'Quattrocento Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--purple-950);
    color: var(--text-primary);
}

/* Background gradient effect */
.bg-gradient {
    position: fixed;
    inset: 0;
    background: 
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(120, 50, 200, 0.12), transparent),
        radial-gradient(ellipse 60% 40% at 80% 100%, rgba(168, 85, 247, 0.06), transparent),
        linear-gradient(180deg, var(--purple-950) 0%, var(--purple-900) 50%, var(--purple-950) 100%);
    z-index: -3;
}

/* Hide scrollbar utility */
.scrollbar-hide { scrollbar-width: none; }
.scrollbar-hide::-webkit-scrollbar { display: none; }

/* Hidden state */
.hidden { display: none !important; }

/* ========================================
   Sidebar
   ======================================== */

.sidebar {
    width: 200px;
    min-width: 200px;
    min-height: calc(100vh - 57px);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 8px 0;
    background: var(--purple-900);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    overflow-x: visible;
    scrollbar-width: none;
    z-index: 20;
}
.sidebar::-webkit-scrollbar { display: none; }

.sidebar-element-label {
    font-size: 0.5rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-top: 8px;
    margin-bottom: 2px;
    user-select: none;
}

.sidebar-tab {
    display: flex;
    flex-direction: row;
    align-items: center;
    width: 100%;
    height: 42px;
    padding: 0 12px;
    border: none;
    border-radius: 0;
    background: transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
    color: var(--text-muted);
    gap: 10px;
}

.sidebar-tab:hover {
    background: rgba(168, 85, 247, 0.1);
    color: var(--text-secondary);
}

.sidebar-tab.active {
    background: rgba(168, 85, 247, 0.3);
    color: #fff;
}

/* No left accent — arrow on right side handles the visual cue */

/* Sign-specific colors */
.sidebar-tab[data-element="fire"]  { color: rgba(239, 68, 68, 0.5); }
.sidebar-tab[data-element="earth"] { color: rgba(34, 197, 94, 0.5); }
.sidebar-tab[data-element="air"]   { color: rgba(234, 179, 8, 0.5); }
.sidebar-tab[data-element="water"] { color: rgba(59, 130, 246, 0.5); }
.sidebar-tab[data-sign="all"]      { color: rgba(168, 85, 247, 0.6); }

.sidebar-tab:hover[data-element="fire"]  { color: #ef4444; }
.sidebar-tab:hover[data-element="earth"] { color: #22c55e; }
.sidebar-tab:hover[data-element="air"]   { color: #eab308; }
.sidebar-tab:hover[data-element="water"] { color: #3b82f6; }
.sidebar-tab:hover[data-sign="all"]      { color: #a855f7; }

.sidebar-tab.active[data-element="fire"]  { color: #fca5a5; }
.sidebar-tab.active[data-element="earth"] { color: #86efac; }
.sidebar-tab.active[data-element="air"]   { color: #fde047; }
.sidebar-tab.active[data-element="water"] { color: #93c5fd; }
.sidebar-tab.active[data-sign="all"]      { color: #d8b4fe; }

.sidebar-tab-symbol {
    font-size: 1.25rem;
    line-height: 1;
}

.sidebar-tab-label {
    font-family: 'Quattrocento Sans', sans-serif;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.02em;
    line-height: 1;
    white-space: nowrap;
}

/* ========================================
   Top bar date button
   ======================================== */

.date-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: rgba(45, 27, 78, 0.7);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}
.date-btn:hover {
    border-color: var(--purple-500);
    color: white;
}

/* ========================================
   Snapshot cards (overview grid)
   ======================================== */

.snapshot-card {
    display: block;
    width: 100%;
    text-align: left;
    padding: 1rem;
    background: rgba(42, 20, 80, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-primary);
}
.snapshot-card:hover {
    border-color: var(--purple-500);
    background: rgba(42, 20, 80, 0.8);
    box-shadow: 0 4px 16px rgba(168, 85, 247, 0.15);
    transform: translateY(-1px);
}

/* ========================================
   Element-based Sign Colors (legacy compat)
   ======================================== */

/* Element badge colors */
.element-badge[data-element="fire"] { background: rgba(239, 68, 68, 0.2); border-color: rgba(239, 68, 68, 0.3); color: #fca5a5; }
.element-badge[data-element="earth"] { background: rgba(34, 197, 94, 0.2); border-color: rgba(34, 197, 94, 0.3); color: #86efac; }
.element-badge[data-element="air"] { background: rgba(59, 130, 246, 0.2); border-color: rgba(59, 130, 246, 0.3); color: #93c5fd; }
.element-badge[data-element="water"] { background: rgba(99, 102, 241, 0.2); border-color: rgba(99, 102, 241, 0.3); color: #a5b4fc; }

/* ========================================
   Domain Bars (JS-generated)
   ======================================== */

.domain-bars {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 0.5rem;
    align-items: center;
}

.domain-bar { display: contents; }

.domain-bar-header {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    justify-content: flex-end;
    white-space: nowrap;
}

.domain-bar-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-primary);
    text-align: right;
}

.domain-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Diverging bar */
.diverging-bar-container {
    display: flex;
    align-items: center;
    flex: 1;
    height: 14px;
    position: relative;
}

.negative-side, .positive-side {
    flex: 1;
    display: flex;
    height: 100%;
    gap: 3px;
}
.negative-side { justify-content: flex-end; padding-right: 4px; }
.positive-side { justify-content: flex-start; padding-left: 4px; }

.center-line {
    width: 2px;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 1px;
    flex-shrink: 0;
}

/* Sentiment capsules */
.sentiment-capsule {
    height: 100%;
    width: 16px;
    min-width: 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.sentiment-capsule.positive { background: linear-gradient(135deg, var(--green-500), #16a34a); }
.sentiment-capsule.negative { background: linear-gradient(135deg, var(--red-500), #dc2626); }

.sentiment-capsule:hover { transform: scale(1.2); filter: brightness(1.15); z-index: 10; }

.sentiment-capsule::after {
    content: attr(data-tag);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.6875rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    margin-bottom: 6px;
    z-index: 100;
}
.sentiment-capsule:hover::after { opacity: 1; }

/* ========================================
   Sentiment Badges
   ======================================== */

.sentiment-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.85rem;
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
}

.sentiment-badge.positive { background: rgba(34, 197, 94, 0.15); color: var(--green-500); border: 1px solid rgba(34, 197, 94, 0.3); }
.sentiment-badge.negative { background: rgba(239, 68, 68, 0.15); color: var(--red-500); border: 1px solid rgba(239, 68, 68, 0.3); }
.sentiment-badge.neutral { background: rgba(168, 85, 247, 0.15); color: var(--purple-400); border: 1px solid rgba(168, 85, 247, 0.3); }

/* ========================================
   Tag Cloud (JS-generated)  
   ======================================== */

/* Container */
.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    padding: 0.75rem;
}

/* Individual tag items - no base padding, let size variants control */
.tag-cloud-item {
    display: inline-block;
    box-sizing: border-box;
    border-radius: 9999px;
    cursor: pointer;
    position: relative;
    white-space: nowrap;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    /* padding set by size-* classes */
}

.tag-cloud-item:hover {
    transform: scale(1.08);
    z-index: 20;
}

/* Sentiment colors */
.tag-cloud-item.positive {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.4);
}

.tag-cloud-item.negative {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.4);
}

.tag-cloud-item.positive:hover {
    background: rgba(34, 197, 94, 0.3);
    box-shadow: 0 4px 16px rgba(34, 197, 94, 0.3);
}

.tag-cloud-item.negative:hover {
    background: rgba(239, 68, 68, 0.3);
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.3);
}

/* Size variants - use !important to ensure override */
.tag-cloud-item.size-1 { font-size: 0.8rem !important; padding: 0.35rem 0.7rem !important; }
.tag-cloud-item.size-2 { font-size: 0.9rem !important; padding: 0.4rem 0.85rem !important; }
.tag-cloud-item.size-3 { font-size: 1rem !important; font-weight: 500; padding: 0.5rem 1rem !important; }
.tag-cloud-item.size-4 { font-size: 1.1rem !important; font-weight: 600; padding: 0.55rem 1.15rem !important; }
.tag-cloud-item.size-5 { font-size: 1.25rem !important; font-weight: 700; padding: 0.6rem 1.25rem !important; }

/* Tooltip inside tag-cloud-item - must not affect parent size */
.tag-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem 0.75rem;
    background: var(--purple-800);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.75rem !important;
    font-weight: 400 !important;
    color: var(--text-primary);
    white-space: nowrap;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.tag-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--purple-800);
}

.tag-cloud-item:hover .tag-tooltip {
    opacity: 1;
}

/* ========================================
   Explainer Items (JS-generated)
   ======================================== */

.explainer-item {
    padding: 1rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(168, 85, 247, 0.15);
    border-radius: var(--radius-md);
}

.explainer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.explainer-tag { font-weight: 600; color: var(--text-primary); }

.explainer-domain {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.explainer-domain.love { background: rgba(236, 72, 153, 0.2); color: var(--love-color); }
.explainer-domain.career { background: rgba(59, 130, 246, 0.2); color: var(--career-color); }
.explainer-domain.health { background: rgba(34, 197, 94, 0.2); color: var(--health-color); }
.explainer-domain.finance { background: rgba(245, 158, 11, 0.2); color: var(--finance-color); }

.explainer-description { font-size: 0.85rem; color: var(--text-secondary); line-height: 1.5; }

.explainer-sentiment { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.5rem; font-size: 0.75rem; }

.explainer-sentiment-dot { width: 8px; height: 8px; border-radius: 50%; }
.explainer-sentiment-dot.positive { background: var(--green-500); }
.explainer-sentiment-dot.negative { background: var(--red-500); }

/* ========================================
   Astro Events Banner
   ======================================== */

.astro-events-inline .astro-event-icon { font-size: 1.25rem; }
.astro-events-inline .astro-event-title { font-size: 0.85rem; font-weight: 600; color: var(--purple-300); }
.astro-events-inline .astro-event-description { font-size: 0.75rem; color: var(--text-secondary); }
.astro-event-content { flex: 1; }
.astro-event-dates { font-size: 0.7rem; color: var(--text-muted); margin-left: auto; text-align: right; }

/* ========================================
   Animations
   ======================================== */

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

.analytics-container { animation: fadeIn 0.5s ease; }

/* ========================================
   Responsive
   ======================================== */

@media (max-width: 900px) {
    .domain-bars { grid-template-columns: 100px 1fr; }
}

@media (max-width: 640px) {
    .sidebar { width: 140px; min-width: 140px; }
    .sidebar-tab { padding: 0 8px; height: 38px; gap: 8px; }
    .sidebar-tab-symbol { font-size: 1rem; }
    .sidebar-tab-label { font-size: 0.7rem; }
    .domain-bars { grid-template-columns: 80px 1fr; gap: 0.35rem; }
    .domain-bar-label { font-size: 0.7rem; }
    .domain-dot { width: 6px; height: 6px; }
}
