/* ============================================================
   EventHub — Consolidated Styles
   All custom CSS for the Hub admin panel in one place.
   Tailwind CSS handles utility classes via CDN.
   ============================================================ */

/* ── Page Loading Overlay ────────────────────────────────────── */

#page-loader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
    overflow: hidden;
}
#page-loader.loading {
    opacity: 1;
    pointer-events: auto;
}
#page-loader.done {
    opacity: 0;
    transition: opacity 0.25s ease;
}

/* Backdrop */
#page-loader .loader-bg {
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 23, 0.55);
    backdrop-filter: blur(4px);
}

/* Orbital rings — BIG */
.loader-ring { position: absolute; border-radius: 50%; border: 1.5px solid transparent; top: 50%; left: 50%; }
.loader-ring-1 { width: 100px; height: 100px; margin: -50px 0 0 -50px; border-top-color: rgba(99,102,241,0.7); border-right-color: rgba(99,102,241,0.15); animation: loader-spin 0.7s linear infinite; }
.loader-ring-2 { width: 160px; height: 160px; margin: -80px 0 0 -80px; border-bottom-color: rgba(139,92,246,0.5); border-left-color: rgba(139,92,246,0.1); animation: loader-spin 1.2s linear infinite reverse; }
.loader-ring-3 { width: 220px; height: 220px; margin: -110px 0 0 -110px; border-top-color: rgba(59,130,246,0.35); border-right-color: rgba(59,130,246,0.05); animation: loader-spin 2s linear infinite; }
.loader-ring-4 { width: 290px; height: 290px; margin: -145px 0 0 -145px; border-bottom-color: rgba(16,185,129,0.2); border-left-color: rgba(16,185,129,0.04); animation: loader-spin 3s linear infinite reverse; }
.loader-ring-5 { width: 360px; height: 360px; margin: -180px 0 0 -180px; border-top-color: rgba(244,114,182,0.12); animation: loader-spin 4.5s linear infinite; }

/* Center core — bigger glow */
.loader-core {
    position: absolute; width: 16px; height: 16px; top: 50%; left: 50%; margin: -8px 0 0 -8px;
    background: radial-gradient(circle, #a78bfa, #6366f1); border-radius: 50%;
    box-shadow: 0 0 30px rgba(99,102,241,0.8), 0 0 80px rgba(99,102,241,0.3), 0 0 120px rgba(139,92,246,0.15);
    animation: core-pulse 0.8s ease-in-out infinite;
}
@keyframes core-pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 30px rgba(99,102,241,0.8), 0 0 80px rgba(99,102,241,0.3), 0 0 120px rgba(139,92,246,0.15); }
    50% { transform: scale(1.8); box-shadow: 0 0 50px rgba(99,102,241,1), 0 0 120px rgba(99,102,241,0.5), 0 0 200px rgba(139,92,246,0.2); }
}

/* Flying data particles — 12 glowing particles */
.loader-particle { position: absolute; border-radius: 50%; top: 50%; left: 50%; }
.loader-particle:nth-child(6)  { width:4px; height:4px; animation: pf1  1.5s ease-in-out infinite;       background:#818cf8; box-shadow:0 0 6px #818cf8; }
.loader-particle:nth-child(7)  { width:3px; height:3px; animation: pf2  1.8s ease-in-out infinite 0.15s; background:#a78bfa; box-shadow:0 0 6px #a78bfa; }
.loader-particle:nth-child(8)  { width:5px; height:5px; animation: pf3  1.3s ease-in-out infinite 0.4s;  background:#6366f1; box-shadow:0 0 8px #6366f1; }
.loader-particle:nth-child(9)  { width:3px; height:3px; animation: pf4  2.0s ease-in-out infinite 0.25s; background:#38bdf8; box-shadow:0 0 6px #38bdf8; }
.loader-particle:nth-child(10) { width:4px; height:4px; animation: pf5  1.6s ease-in-out infinite 0.6s;  background:#34d399; box-shadow:0 0 6px #34d399; }
.loader-particle:nth-child(11) { width:3px; height:3px; animation: pf6  1.4s ease-in-out infinite 0.1s;  background:#f472b6; box-shadow:0 0 6px #f472b6; }
.loader-particle:nth-child(12) { width:5px; height:5px; animation: pf7  1.9s ease-in-out infinite 0.35s; background:#fbbf24; box-shadow:0 0 8px #fbbf24; }
.loader-particle:nth-child(13) { width:3px; height:3px; animation: pf8  1.7s ease-in-out infinite 0.5s;  background:#818cf8; box-shadow:0 0 6px #818cf8; }
.loader-particle:nth-child(14) { width:4px; height:4px; animation: pf9  1.2s ease-in-out infinite 0.2s;  background:#f87171; box-shadow:0 0 6px #f87171; }
.loader-particle:nth-child(15) { width:3px; height:3px; animation: pf10 2.1s ease-in-out infinite 0.45s; background:#2dd4bf; box-shadow:0 0 6px #2dd4bf; }
.loader-particle:nth-child(16) { width:4px; height:4px; animation: pf11 1.1s ease-in-out infinite 0.7s;  background:#c084fc; box-shadow:0 0 6px #c084fc; }
.loader-particle:nth-child(17) { width:3px; height:3px; animation: pf12 1.6s ease-in-out infinite 0.55s; background:#fb923c; box-shadow:0 0 6px #fb923c; }

@keyframes pf1  { 0%,100%{transform:translate(0,0);opacity:0}15%{opacity:1}85%{opacity:1}50%{transform:translate(160px,-120px)} }
@keyframes pf2  { 0%,100%{transform:translate(0,0);opacity:0}15%{opacity:1}85%{opacity:1}50%{transform:translate(-140px,-160px)} }
@keyframes pf3  { 0%,100%{transform:translate(0,0);opacity:0}15%{opacity:1}85%{opacity:1}50%{transform:translate(180px,100px)} }
@keyframes pf4  { 0%,100%{transform:translate(0,0);opacity:0}15%{opacity:1}85%{opacity:1}50%{transform:translate(-200px,60px)} }
@keyframes pf5  { 0%,100%{transform:translate(0,0);opacity:0}15%{opacity:1}85%{opacity:1}50%{transform:translate(80px,180px)} }
@keyframes pf6  { 0%,100%{transform:translate(0,0);opacity:0}15%{opacity:1}85%{opacity:1}50%{transform:translate(-100px,-200px)} }
@keyframes pf7  { 0%,100%{transform:translate(0,0);opacity:0}15%{opacity:1}85%{opacity:1}50%{transform:translate(220px,40px)} }
@keyframes pf8  { 0%,100%{transform:translate(0,0);opacity:0}15%{opacity:1}85%{opacity:1}50%{transform:translate(-60px,160px)} }
@keyframes pf9  { 0%,100%{transform:translate(0,0);opacity:0}15%{opacity:1}85%{opacity:1}50%{transform:translate(120px,-180px)} }
@keyframes pf10 { 0%,100%{transform:translate(0,0);opacity:0}15%{opacity:1}85%{opacity:1}50%{transform:translate(-180px,-80px)} }
@keyframes pf11 { 0%,100%{transform:translate(0,0);opacity:0}15%{opacity:1}85%{opacity:1}50%{transform:translate(50px,-220px)} }
@keyframes pf12 { 0%,100%{transform:translate(0,0);opacity:0}15%{opacity:1}85%{opacity:1}50%{transform:translate(-160px,140px)} }

/* Data streaks — 8 long streaks shooting across */
.loader-streak { position: absolute; height: 1.5px; border-radius: 1px; top: 50%; left: 50%; transform-origin: left center; }
.loader-streak:nth-child(18) { width:120px; background:linear-gradient(90deg,transparent,#818cf8 40%,transparent); animation:sk1 1.5s linear infinite; }
.loader-streak:nth-child(19) { width:150px; background:linear-gradient(90deg,transparent,#a78bfa 40%,transparent); animation:sk2 2.0s linear infinite 0.2s; }
.loader-streak:nth-child(20) { width:100px; background:linear-gradient(90deg,transparent,#38bdf8 40%,transparent); animation:sk3 1.3s linear infinite 0.5s; }
.loader-streak:nth-child(21) { width:130px; background:linear-gradient(90deg,transparent,#34d399 40%,transparent); animation:sk4 1.8s linear infinite 0.3s; }
.loader-streak:nth-child(22) { width:110px; background:linear-gradient(90deg,transparent,#f472b6 40%,transparent); animation:sk5 1.6s linear infinite 0.7s; }
.loader-streak:nth-child(23) { width:140px; background:linear-gradient(90deg,transparent,#fbbf24 40%,transparent); animation:sk6 2.2s linear infinite 0.1s; }
.loader-streak:nth-child(24) { width:90px;  background:linear-gradient(90deg,transparent,#f87171 40%,transparent); animation:sk7 1.4s linear infinite 0.4s; }
.loader-streak:nth-child(25) { width:160px; background:linear-gradient(90deg,transparent,#6366f1 40%,transparent); animation:sk8 2.5s linear infinite 0.6s; }

@keyframes sk1 { 0%{transform:rotate(15deg)  translateX(-300px);opacity:0}15%{opacity:.9}85%{opacity:.9}100%{transform:rotate(15deg)  translateX(300px);opacity:0} }
@keyframes sk2 { 0%{transform:rotate(135deg) translateX(-300px);opacity:0}15%{opacity:.7}85%{opacity:.7}100%{transform:rotate(135deg) translateX(300px);opacity:0} }
@keyframes sk3 { 0%{transform:rotate(240deg) translateX(-300px);opacity:0}15%{opacity:.8}85%{opacity:.8}100%{transform:rotate(240deg) translateX(300px);opacity:0} }
@keyframes sk4 { 0%{transform:rotate(60deg)  translateX(-300px);opacity:0}15%{opacity:.6}85%{opacity:.6}100%{transform:rotate(60deg)  translateX(300px);opacity:0} }
@keyframes sk5 { 0%{transform:rotate(190deg) translateX(-300px);opacity:0}15%{opacity:.7}85%{opacity:.7}100%{transform:rotate(190deg) translateX(300px);opacity:0} }
@keyframes sk6 { 0%{transform:rotate(310deg) translateX(-300px);opacity:0}15%{opacity:.5}85%{opacity:.5}100%{transform:rotate(310deg) translateX(300px);opacity:0} }
@keyframes sk7 { 0%{transform:rotate(95deg)  translateX(-300px);opacity:0}15%{opacity:.8}85%{opacity:.8}100%{transform:rotate(95deg)  translateX(300px);opacity:0} }
@keyframes sk8 { 0%{transform:rotate(275deg) translateX(-300px);opacity:0}15%{opacity:.6}85%{opacity:.6}100%{transform:rotate(275deg) translateX(300px);opacity:0} }

/* Text below the vortex */
.loader-text { position: absolute; top: calc(50% + 120px); left: 50%; transform: translateX(-50%); text-align: center; white-space: nowrap; }
.loader-title {
    font-size: 15px; font-weight: 600; color: rgba(165,180,252,0.9);
    letter-spacing: 0.12em; text-transform: uppercase;
    animation: text-glow 2s ease-in-out infinite;
}
.loader-sub { font-size: 12px; color: rgba(148,163,184,0.5); margin-top: 6px; font-style: italic; }
@keyframes text-glow {
    0%,100% { text-shadow: 0 0 10px rgba(99,102,241,0); }
    50% { text-shadow: 0 0 20px rgba(99,102,241,0.5), 0 0 50px rgba(99,102,241,0.15); }
}

@keyframes loader-spin { to { transform: rotate(360deg); } }


/* ── Global / Layout ────────────────────────────────────────── */

[x-cloak] { display: none !important; }

.nav-link-active {
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
    border-color: #818cf8;
}
.nav-link {
    transition: all 0.15s ease;
}
.nav-link:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #e2e8f0;
}

.logo-accent {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #818cf8;
    box-shadow: 0 0 8px 2px rgba(129, 140, 248, 0.5);
    animation: pulse-glow 2s ease-in-out infinite;
}
@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 8px 2px rgba(129, 140, 248, 0.4); }
    50%      { box-shadow: 0 0 14px 4px rgba(129, 140, 248, 0.7); }
}

/* htmx swap transitions */
.htmx-swapping { opacity: 0.6; transition: opacity 0.2s ease; }
.htmx-settling { opacity: 1;   transition: opacity 0.2s ease; }


/* ── Shared Card Styles ─────────────────────────────────────── */

.card {
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(12px);
    border-radius: 0.75rem;
    border: 1px solid rgba(51, 65, 85, 0.4);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3),
                0 2px 4px -2px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}
.card:hover {
    border-color: rgba(99, 102, 241, 0.2);
    box-shadow: 0 8px 25px -5px rgba(0, 0, 0, 0.4),
                0 0 12px -3px rgba(99, 102, 241, 0.06);
}

.premium-card {
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(51, 65, 85, 0.4);
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3),
                0 2px 4px -2px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}
.premium-card:hover {
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: 0 8px 25px -5px rgba(0, 0, 0, 0.4),
                0 0 15px -3px rgba(99, 102, 241, 0.08);
}

.stat-card {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.9), rgba(30, 41, 59, 0.6));
    border: 1px solid rgba(51, 65, 85, 0.5);
    border-radius: 0.75rem;
}

.section-card {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.9) 0%, rgba(15, 23, 42, 0.7) 100%);
    border: 1px solid rgba(51, 65, 85, 0.4);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}


/* ── Shared Table ───────────────────────────────────────────── */

.table-row-hover { transition: background-color 0.15s ease; }
.table-row-hover:hover { background-color: rgba(99, 102, 241, 0.06); }

.table-separator { border-color: rgba(51, 65, 85, 0.3); }

.tenant-table-row { transition: background-color 0.1s ease; }
.tenant-table-row:hover { background-color: rgba(99, 102, 241, 0.05); }

.detail-table-row { transition: background-color 0.1s ease; }
.detail-table-row:hover { background-color: rgba(99, 102, 241, 0.05); }


/* ── Status Indicators ──────────────────────────────────────── */

.status-pulse { animation: pulse-dot 2s ease-in-out infinite; }
@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.4; }
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}
.status-dot-green { background-color: #34d399; box-shadow: 0 0 6px rgba(16, 185, 129, 0.5); }
.status-dot-amber { background-color: #fbbf24; box-shadow: 0 0 6px rgba(245, 158, 11, 0.5); }
.status-dot-red   { background-color: #f87171; box-shadow: 0 0 6px rgba(239, 68, 68, 0.5); }
.status-dot-gray  { background-color: #9ca3af; }

.dot-pulse { animation: dot-pulse 2s ease-in-out infinite; }
@keyframes dot-pulse {
    0%, 100% { box-shadow: 0 0 0 0 currentColor; }
    50%      { box-shadow: 0 0 0 4px transparent; }
}

.glow-green { animation: glow-pulse-green 2s ease-in-out infinite; }
@keyframes glow-pulse-green {
    0%, 100% { box-shadow: 0 0 6px rgba(16, 185, 129, 0.5); }
    50%      { box-shadow: 0 0 16px rgba(16, 185, 129, 0.8); }
}
.glow-amber { animation: glow-pulse-amber 2s ease-in-out infinite; }
@keyframes glow-pulse-amber {
    0%, 100% { box-shadow: 0 0 6px rgba(245, 158, 11, 0.5); }
    50%      { box-shadow: 0 0 16px rgba(245, 158, 11, 0.8); }
}
.glow-red { animation: glow-pulse-red 2s ease-in-out infinite; }
@keyframes glow-pulse-red {
    0%, 100% { box-shadow: 0 0 6px rgba(239, 68, 68, 0.5); }
    50%      { box-shadow: 0 0 16px rgba(239, 68, 68, 0.8); }
}


/* ── Dashboard ──────────────────────────────────────────────── */

.kpi-card {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.9) 0%, rgba(15, 23, 42, 0.7) 100%);
    border: 1px solid rgba(51, 65, 85, 0.4);
    border-left: 3px solid var(--kpi-accent, rgba(99, 102, 241, 0.5));
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}
.kpi-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, var(--kpi-accent, rgba(99, 102, 241, 0.3)), transparent 80%);
}
.kpi-card:hover {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(99, 102, 241, 0.1);
    transform: translateY(-2px);
    border-color: rgba(99, 102, 241, 0.3);
}

.kpi-accent-indigo  { --kpi-accent: rgba(99, 102, 241, 0.6); }
.kpi-accent-blue    { --kpi-accent: rgba(59, 130, 246, 0.6); }
.kpi-accent-purple  { --kpi-accent: rgba(139, 92, 246, 0.6); }
.kpi-accent-cyan    { --kpi-accent: rgba(6, 182, 212, 0.6); }
.kpi-accent-green   { --kpi-accent: rgba(16, 185, 129, 0.6); }
.kpi-accent-amber   { --kpi-accent: rgba(245, 158, 11, 0.6); }
.kpi-accent-red     { --kpi-accent: rgba(239, 68, 68, 0.6); }
.kpi-accent-orange  { --kpi-accent: rgba(249, 115, 22, 0.6); }

.chart-bar {
    transition: height 0.3s ease, opacity 0.15s ease;
    opacity: 0.85;
    background: linear-gradient(180deg, rgba(99, 102, 241, 0.95) 0%, rgba(99, 102, 241, 0.6) 100%);
    box-shadow: 0 -2px 8px rgba(99, 102, 241, 0.15);
}
.chart-bar:hover {
    opacity: 1;
    box-shadow: 0 -4px 16px rgba(99, 102, 241, 0.3);
}
.chart-bar-peak {
    background: linear-gradient(180deg, rgba(139, 92, 246, 1) 0%, rgba(99, 102, 241, 0.7) 100%) !important;
    box-shadow: 0 -4px 16px rgba(139, 92, 246, 0.3);
}
.chart-bar-empty {
    background: rgba(30, 41, 59, 0.5) !important;
    box-shadow: none;
}
.chart-gridline {
    border-top: 1px dashed rgba(51, 65, 85, 0.5);
}

.progress-bar-track {
    height: 3px;
    border-radius: 2px;
    background: rgba(30, 41, 59, 0.8);
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}

.progress-animate {
    animation: progress-fill 1.5s ease-out forwards;
    width: 0;
}
@keyframes progress-fill {
    to { width: var(--target-width); }
}

.section-header {
    display: flex;
    align-items: center;
    gap: 10px;
}
.section-header::before {
    content: '';
    width: 3px;
    height: 16px;
    border-radius: 2px;
    background: rgba(99, 102, 241, 0.6);
    flex-shrink: 0;
}
.section-header-red::before { background: rgba(239, 68, 68, 0.6); }

.refresh-fade { animation: content-refresh 0.4s ease-out; }
@keyframes content-refresh {
    from { opacity: 0.6; }
    to   { opacity: 1; }
}

.shimmer-border {
    border: 1px solid transparent;
    border-image: linear-gradient(90deg, rgba(99,102,241,0.3), rgba(139,92,246,0.5), rgba(99,102,241,0.3)) 1;
    animation: shimmer 3s ease-in-out infinite;
}
@keyframes shimmer {
    0%, 100% { border-image-source: linear-gradient(90deg, rgba(99,102,241,0.2), rgba(139,92,246,0.4), rgba(99,102,241,0.2)); }
    50%      { border-image-source: linear-gradient(90deg, rgba(139,92,246,0.4), rgba(99,102,241,0.6), rgba(139,92,246,0.4)); }
}

/* Dashboard live ticker */
.live-dot {
    width: 7px; height: 7px; border-radius: 50%; background: #f87171;
    animation: live-pulse 1.5s ease-in-out infinite;
}
@keyframes live-pulse {
    0%, 100% { opacity: 1;   box-shadow: 0 0 6px rgba(239, 68, 68, 0.6); }
    50%      { opacity: 0.4; box-shadow: 0 0 12px rgba(239, 68, 68, 0.9); }
}
@keyframes ticker {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}



/* ── System Status ──────────────────────────────────────────── */

.gradient-pool-green  { background: linear-gradient(90deg, #10b981, #34d399); box-shadow: 0 0 8px rgba(16, 185, 129, 0.3); }
.gradient-pool-yellow { background: linear-gradient(90deg, #f59e0b, #fbbf24); box-shadow: 0 0 8px rgba(245, 158, 11, 0.3); }
.gradient-pool-red    { background: linear-gradient(90deg, #ef4444, #f87171); box-shadow: 0 0 8px rgba(239, 68, 68, 0.3); }

.section-icon { width: 1.25rem; height: 1.25rem; flex-shrink: 0; }
.stat-value   { font-variant-numeric: tabular-nums; }
.metric-label { font-size: 0.65rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: rgb(100, 116, 139); }
.pool-bar-bg  { background: rgba(15, 23, 42, 0.8); box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3); }

.health-ring            { position: relative; width: 44px; height: 44px; }
.health-ring svg        { transform: rotate(-90deg); }
.health-ring circle     { fill: none; stroke-width: 3; }


/* ── Event Detail ───────────────────────────────────────────── */

.pipeline-glow {
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.15),
                0 0 4px rgba(99, 102, 241, 0.1);
}

.timeline-entry {
    transition: all 0.15s ease;
    border-radius: 0.375rem;
    padding: 0.25rem 0.5rem;
    margin: -0.25rem -0.5rem;
}
.timeline-entry:hover {
    background: rgba(99, 102, 241, 0.04);
}

.gradient-text {
    background: linear-gradient(135deg, #818cf8, #6366f1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}


/* ── Heatmap ─────────────────────────────────────────────────── */

.group:hover .group-hover\:block {
    display: block !important;
}


/* ── Login ──────────────────────────────────────────────────── */

.login-float {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    z-index: 100;
}
.glass {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}
