/* =========================================================
   ORDBITS // CORE VISUAL SYSTEM v5.0 (RESTORED + SAFE PATCH)
   Theme: Industrial Cyber - Deep Dark & Neon
   NOTE: Keeps original aesthetic intact; only fills missing
   selectors used by modules/index.html to prevent "ugly" layout.
   ========================================================= */

/* ===== ORIGINAL BASE (UNCHANGED) ===== */
:root {
    --bg-deep: #050505;
    --bg-panel: rgba(20, 20, 25, 0.7);
    --neon-core: #00d4ff;  /* Azul Cyan */
    --neon-purple: #b026ff; /* Violeta Neon Intenso */
    --neon-gold: #ffd700; /* Amarillo/Dorado Neon */
    --neon-green: #00ff88;
    --neon-red: #ff3333;
    --text-main: #e0e0e0;
    --text-dim: #8892b0;
    --onyx-color: #ffd700;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    background-color: var(--bg-deep);
    color: var(--text-main);
    font-family: 'Segoe UI', 'Roboto', sans-serif;
    height: 100vh;
    overflow: hidden;
}

/* --- BACKGROUND LAYERS --- */
.orb-layer-bg {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle at 50% 30%, #1a1f2e 0%, #050505 70%);
    z-index: -3;
}

.orb-layer-grid-perspective {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 200%;
    background-image:
        linear-gradient(rgba(0, 212, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 212, 255, 0.03) 1px, transparent 1px);
    background-size: 40px 40px;
    transform: perspective(500px) rotateX(60deg) translateY(-100px) scale(2);
    opacity: 0.5;
    z-index: -2;
    animation: gridMove 20s linear infinite;
}

@keyframes gridMove {
    from { background-position: 0 0; }
    to { background-position: 0 40px; }
}

.orb-layer-vignette {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at center, transparent 40%, #000 100%);
    pointer-events: none;
    z-index: -1;
}

/* --- HUD CONTAINER --- */
.orb-hud-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 0 40px;
}

/* --- HEADER --- */
.orb-top-bar {
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    margin-bottom: 20px;
}

.orb-brand {
    display: flex;
    align-items: center;
    gap: 15px;
}

.orb-logo-symbol {
    font-size: 2rem;
    color: var(--neon-core);
    text-shadow: 0 0 10px var(--neon-core);
}

.orb-brand-text h1 {
    font-size: 1.5rem;
    letter-spacing: 2px;
    font-weight: 800;
    line-height: 1;
    color: #fff;
    text-transform: uppercase;
}

/* --- RAINBOW TEXT EFFECT --- */
.text-rainbow-anim {
    background: linear-gradient(
        90deg,
        #ff0000, #ff9900, #ffff00, #33ff00, #0099ff, #6633ff, #ff00ff, #ff0000
    );
    background-size: 200% auto;
    color: transparent;
    -webkit-background-clip: text;
    background-clip: text;
    animation: shineRainbow 3s linear infinite;
    font-weight: 900;
}

@keyframes shineRainbow {
    to { background-position: 200% center; }
}

.orb-system-stats {
    display: flex;
    gap: 20px;
    align-items: center;
}

.stat-group {
    display: flex;
    flex-direction: column;
    text-align: right;
}

.stat-group .label {
    font-size: 0.6rem;
    color: var(--text-dim);
    letter-spacing: 1px;
}

.stat-group .value {
    font-size: 0.9rem;
    font-weight: bold;
    font-family: monospace;
}

/* --- MINI AVATAR CORRECTION --- */
.onyx-mini-avatar-mount {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid var(--neon-core);
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-left: 15px;
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.3);
}

.onyx-mini-avatar-mount .onyx-svg-container,
.onyx-mini-avatar-mount svg {
    width: 44px !important;
    height: 44px !important;
    animation: none !important;
    filter: none !important;
}

.btn-logout {
    background: transparent;
    border: 1px solid rgba(255,50,50,0.3);
    color: var(--neon-red);
    width: 40px; height: 40px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
    margin-left: 15px;
}

.btn-logout:hover {
    background: rgba(255,50,50,0.1);
    box-shadow: 0 0 10px rgba(255,50,50,0.4);
}

.text-neon-core { color: var(--neon-core); }
.text-neon-green { color: var(--neon-green); }
.text-warn { color: var(--neon-gold); }

/* --- HERO SECTION --- */
.hero-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 40px;
    padding: 20px 0;
}

.hero-content-left {
    flex: 1;
    max-width: 60%;
}

.hook-title {
    font-size: 3.5rem;
    font-weight: 900;
    line-height: 1.1;
    margin-bottom: 20px;
    background: linear-gradient(90deg, #fff, var(--neon-core));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 30px rgba(0, 212, 255, 0.2);
}

.hook-desc {
    font-size: 1.1rem;
    color: var(--text-dim);
    max-width: 600px;
    margin-bottom: 30px;
    line-height: 1.6;
}

.hero-kpis { display: flex; gap: 40px; }
.hk-item { display: flex; flex-direction: column; }
.hk-item .lbl { font-size: 0.7rem; color: var(--neon-core); letter-spacing: 1px; }
.hk-item .val { font-size: 2rem; font-weight: bold; color: #fff; }

/* --- ONYX AVATAR STYLES --- */
.hero-onyx-right {
    flex: 0 0 300px;
    height: 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    margin-right: 50px;
}

/* --- WIDGET UI RE-ANCHORING (AUDIT FIX) --- */
#onyx-wrapper {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

#onyx-widget-ui {
    position: relative !important;
    top: auto !important;
    bottom: auto !important;
    left: auto !important;
    right: auto !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
    z-index: 10;
}

.onyx-badge {
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid var(--neon-gold);
    color: var(--neon-gold);
    padding: 8px 20px;
    border-radius: 20px;
    font-family: monospace;
    font-size: 0.85rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.2);
    transition: all 0.3s ease;
    text-transform: uppercase;
}

.onyx-badge:hover {
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
    background: rgba(255, 215, 0, 0.1);
}

.onyx-svg-container {
    width: 280px;
    height: 280px;
    animation: float 6s ease-in-out infinite;
    filter: drop-shadow(0 0 30px rgba(255, 215, 0, 0.2));
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

.onyx-status {
    margin-top: -20px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: monospace;
    font-size: 0.8rem;
    color: var(--onyx-color);
    background: rgba(0,0,0,0.6);
    padding: 5px 15px;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.1);
    z-index: 2;
}

.onyx-dot {
    width: 8px; height: 8px;
    background-color: var(--onyx-color);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--onyx-color);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.4; }
    100% { opacity: 1; }
}

.blink-anim { animation: blink 4.5s infinite; transform-origin: center; }
@keyframes blink {
    0%, 48%, 52%, 100% { transform: scaleY(1); }
    50% { transform: scaleY(0.1); }
}

/* --- MODULES GRID --- */
.modules-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 25px;
    padding-bottom: 40px;
    flex: 1;
}

.module-column { display: flex; flex-direction: column; gap: 15px; }

.group-label {
    font-size: 0.75rem;
    color: var(--text-dim);
    letter-spacing: 1px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 5px;
    margin-bottom: 5px;
}

/* --- CARDS (Vertical) --- */
.mod-card {
    background: linear-gradient(145deg, rgba(30,30,35,0.6), rgba(20,20,25,0.8));
    border: 1px solid rgba(255,255,255,0.05);
    border-left: 3px solid transparent;
    padding: 15px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 20px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    overflow: hidden;
}

.mod-card:hover {
    transform: translateX(5px);
    background: rgba(255,255,255,0.05);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.mc-content { flex: 1; min-width: 0; }

.mod-card h4 {
    font-family: 'Segoe UI', 'Roboto', sans-serif !important;
    font-size: 0.85rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 3px;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 0.3px;
}

.mc-meta { font-size: 0.75rem; color: #888; white-space: nowrap; }

.mc-icon {
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,0.3);
    border-radius: 6px;
    font-size: 1rem;
    color: #aaa;
    transition: color 0.3s;
    flex-shrink: 0;
}

/* --- COLORES DE TARJETAS --- */
.mod-card.mat { border-left-color: var(--neon-core); }
.mod-card.mat:hover .mc-icon { color: var(--neon-core); text-shadow: 0 0 8px var(--neon-core); }

.mod-card.pur, .mod-card.rec, .mod-card.inv { border-left-color: var(--neon-green); }
.mod-card.pur:hover .mc-icon, .mod-card.rec:hover .mc-icon, .mod-card.inv:hover .mc-icon { color: var(--neon-green); text-shadow: 0 0 8px var(--neon-green); }

.mod-card.ship-dash { border-left-color: #ff9900; }
.mod-card.ship-dash:hover .mc-icon { color: #ff9900; text-shadow: 0 0 8px #ff9900; }

.mod-card.draw { border-left-color: var(--neon-gold); }
.mod-card.draw:hover .mc-icon { color: var(--neon-gold); text-shadow: 0 0 8px var(--neon-gold); }

.mod-card.card-fab, .mod-card.field { border-left-color: #ff3333; }
.mod-card.card-fab:hover .mc-icon, .mod-card.field:hover .mc-icon { color: #ff3333; text-shadow: 0 0 8px #ff3333; }

.mod-card.exec, .mod-card.app, .mod-card.set { border-left-color: var(--neon-purple); }
.mod-card.exec:hover .mc-icon, .mod-card.app:hover .mc-icon, .mod-card.set:hover .mc-icon { color: var(--neon-purple); text-shadow: 0 0 8px var(--neon-purple); }

/* --- ROLODEX RAINBOW CARD --- */
.mod-card.rdx {
    position: relative;
    border-left: none;
    overflow: hidden;
}

.mod-card.rdx::before {
    content: '';
    position: absolute;
    top: 0; left: 0; bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, #ff0000, #ff9900, #ffff00, #33ff00, #0099ff, #6633ff, #ff00ff);
    background-size: 100% 200%;
    animation: rainbowFlow 3s linear infinite;
}

@keyframes rainbowFlow {
    0% { background-position: 0% 0%; }
    100% { background-position: 0% 200%; }
}

.mod-card.rdx:hover {
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.1), inset 0 0 20px rgba(100, 100, 255, 0.1);
}

.mod-card.rdx .mc-icon {
    color: #fff;
    text-shadow: 2px 0 #f00, -2px 0 #00f;
}

/* =========================================
   EMOTION EXPRESSIONS
   ========================================= */
.emotion-happy { transform: scale(1.03); filter: drop-shadow(0 0 25px #00ff88); }
.emotion-tense { transform: scale(0.98); filter: drop-shadow(0 0 30px #ff003c); }
.emotion-focused { transform: translateY(-2px); filter: drop-shadow(0 0 20px #007bff); }
.emotion-attentive { filter: drop-shadow(0 0 18px #00f0ff); }

/* =========================================
   EYES BLINK
   ========================================= */
.onyx-eye { transition: transform 0.1s ease; transform-origin: center; }
.onyx-eye.blink { transform: scaleY(0.1); }

/* =========================================
   TALKING ANIMATION
   ========================================= */
.talking-anim { animation: mouthMove 0.2s infinite alternate; }
@keyframes mouthMove { from { transform: scaleY(1); } to { transform: scaleY(1.3); } }

/* =========================================
   PUPILS
   ========================================= */
.onyx-eye { position: relative; overflow: hidden; }
.onyx-pupil {
  width: 6px;
  height: 6px;
  background: black;
  border-radius: 50%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(0px, 0px);
  transition: transform 0.08s linear;
}

/* ===== SAFE ADDITIONS (for classes used in modules/index.html) ===== */

/* Make the main area scrollable without breaking the neon layout */
.dashboard-scroll{
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 8px;
}

/* Scrollbar subtle */
.dashboard-scroll::-webkit-scrollbar{ width: 10px; }
.dashboard-scroll::-webkit-scrollbar-thumb{
  background: rgba(0,212,255,0.10);
  border: 1px solid rgba(0,212,255,0.15);
  border-radius: 10px;
}
.dashboard-scroll::-webkit-scrollbar-track{ background: rgba(0,0,0,0.25); }

/* Optional particles container safe */
.orb-particles{
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -2;
  opacity: 0.25;
}

/* Header spacer (prevents squeeze) */
.orb-header-spacer{
  flex: 1;
}

/* App container width guard */
#app-container{
  width: 100%;
}

/* Keep ONYX feed panel from pushing layout if present */
#onyx-feed-panel{
  position: absolute;
  inset: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Responsive safety (keeps the same design, just stacks on small screens) */
@media (max-width: 1100px){
  .orb-hud-container{ padding: 0 20px; }
  .hero-section{ gap: 20px; }
  .hero-content-left{ max-width: 65%; }
  .hook-title{ font-size: 3.0rem; }
  .hero-onyx-right{ margin-right: 0; }
}

@media (max-width: 900px){
  .hero-section{ flex-direction: column; align-items: flex-start; }
  .hero-content-left{ max-width: 100%; }
  .hero-onyx-right{ align-self: center; }
  .modules-grid{ grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 560px){
  .modules-grid{ grid-template-columns: 1fr; }
  .hook-title{ font-size: 2.4rem; }
}