/* ==========================================================================
   MODUL 02: THE MORPHOLOGICAL GALAXY MAP - 22 WAZAN (PRESERVED DESIGN)
   ========================================================================== */
:root {
    --bg-space: #05050A;
    --bg-surface-glass: rgba(18, 24, 34, 0.82);
    --bg-drawer-glass: rgba(11, 14, 20, 0.96);

    --sector-cyan: #66FCF1;
    --sector-cyan-dim: rgba(102, 252, 241, 0.14);
    --sector-cyan-glow: rgba(102, 252, 241, 0.45);

    --sector-emerald: #2ECC71;
    --sector-emerald-dim: rgba(46, 204, 113, 0.15);
    --sector-emerald-glow: rgba(46, 204, 113, 0.45);

    --sector-purple: #9B59B6;
    --sector-purple-dim: rgba(155, 89, 182, 0.18);
    --sector-purple-glow: rgba(155, 89, 182, 0.5);

    --sector-gold: #D4AF37;
    --sector-gold-dim: rgba(212, 175, 55, 0.16);
    --sector-gold-glow: rgba(212, 175, 55, 0.48);

    --fs-ar-node: clamp(1.35rem, 1.2rem + 0.65vw, 1.78rem);
    --fs-ar-drawer: clamp(1.85rem, 1.6rem + 1vw, 2.5rem);
    --sp-xs: clamp(0.4rem, 0.35rem + 0.25vw, 0.65rem);
    --sp-sm: clamp(0.7rem, 0.55rem + 0.45vw, 1rem);
    --sp-md: clamp(1rem, 0.8rem + 0.75vw, 1.5rem);
    --sp-lg: clamp(1.4rem, 1.1rem + 1.1vw, 2.1rem);
    --ease-smooth: 280ms cubic-bezier(0.16, 1, 0.3, 1);
}

.c-root { color: var(--sector-cyan); font-weight: 700; }
.c-affix-emerald { color: var(--sector-emerald); font-weight: 700; }
.c-affix-purple { color: #C39BD3; font-weight: 700; }
.c-affix-gold { color: var(--sector-gold); font-weight: 700; }

/* Constellation HUD */
.constellation-hud {
    width: 100%;
    background: rgba(5, 5, 10, 0.86);
    border-bottom: 1px solid var(--border-subtle);
    padding: var(--sp-sm) var(--sp-lg);
    display: flex;
    flex-direction: column;
    gap: var(--sp-sm);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
}

.hud-top-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-sm);
}

.hud-brand-cluster {
    display: flex;
    align-items: center;
    gap: var(--sp-sm);
    flex-wrap: wrap;
}

.back-portal-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.42rem 0.9rem;
    border-radius: var(--radius-pill);
    background: var(--bg-charcoal);
    border: 1px solid var(--border-subtle);
    color: var(--sector-cyan);
    font-size: var(--fs-xs);
    font-weight: 700;
    transition: all var(--ease-smooth);
}

.back-portal-btn:hover {
    background: var(--sector-cyan);
    color: var(--bg-space);
    box-shadow: 0 0 16px var(--sector-cyan-glow);
}

.hud-title-badge { display: flex; flex-direction: column; }

.hud-main-title {
    font-size: var(--fs-md);
    font-weight: 800;
    letter-spacing: -0.01em;
    background: linear-gradient(90deg, #FFFFFF, var(--sector-cyan), var(--sector-emerald));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.hud-subtitle {
    font-family: var(--font-mono);
    font-size: var(--fs-2xs);
    color: var(--text-muted);
}

.hud-controls-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-sm);
    padding-top: 0.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.hud-search-box {
    flex: 1 1 260px;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    background: rgba(31, 40, 51, 0.78);
    border: 1px solid rgba(102, 252, 241, 0.25);
    border-radius: var(--radius-pill);
    padding: 0.42rem 0.9rem;
    transition: all var(--ease-smooth);
}

.hud-search-box:focus-within {
    border-color: var(--sector-cyan);
    box-shadow: 0 0 18px var(--sector-cyan-dim);
    background: rgba(31, 40, 51, 0.98);
}

.hud-search-input {
    width: 100%;
    font-size: var(--fs-xs);
    color: var(--text-primary);
    outline: none;
}

.hud-search-input::placeholder { color: var(--text-muted); }

.addition-pills-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.38rem;
    align-items: center;
}

.hud-filter-pill {
    padding: 0.34rem 0.75rem;
    border-radius: var(--radius-pill);
    background: rgba(11, 12, 16, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.12);
    font-size: var(--fs-2xs);
    font-weight: 700;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--ease-smooth);
    white-space: nowrap;
}

.hud-filter-pill:hover,
.hud-filter-pill.active {
    background: var(--sector-cyan-dim);
    border-color: var(--sector-cyan);
    color: var(--sector-cyan);
    box-shadow: 0 0 12px var(--sector-cyan-dim);
}

.semantic-select-wrapper {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    background: rgba(31, 40, 51, 0.85);
    border: 1px solid rgba(46, 204, 113, 0.35);
    border-radius: var(--radius-pill);
    padding: 0.32rem 0.8rem;
}

.semantic-select {
    font-size: var(--fs-2xs);
    font-weight: 700;
    color: var(--sector-emerald);
    background: transparent;
    outline: none;
    cursor: pointer;
}

.semantic-select option {
    background: var(--bg-obsidian);
    color: var(--text-primary);
}

/* Galaxy Stage & Laser Overlay */
.galaxy-stage-wrapper {
    position: relative;
    z-index: 1;
    width: 100%;
    padding: var(--sp-md) var(--sp-lg) var(--sp-lg);
    display: flex;
    flex-direction: column;
    gap: var(--sp-md);
}

.laser-svg-overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
    overflow: visible;
}

.laser-beam-base {
    fill: none;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-dasharray: 8 6;
    animation: laserFlow 1.2s linear infinite;
    filter: drop-shadow(0 0 8px currentColor);
}

.laser-beam-glow {
    fill: none;
    stroke-width: 6;
    stroke-linecap: round;
    opacity: 0.25;
}

@keyframes laserFlow {
    0% { stroke-dashoffset: 28; }
    100% { stroke-dashoffset: 0; }
}

.central-root-banner {
    position: relative;
    z-index: 5;
    margin: 0 auto;
    width: min(680px, 100%);
    background: radial-gradient(circle at 50% 50%, rgba(102, 252, 241, 0.14), rgba(11, 12, 16, 0.95));
    border: 1.5px solid var(--sector-cyan);
    border-radius: var(--radius-pill);
    padding: 0.65rem 1.4rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-sm);
    flex-wrap: wrap;
    box-shadow: 0 0 32px rgba(102, 252, 241, 0.2), inset 0 0 18px rgba(102, 252, 241, 0.1);
}

.core-anchor-orb { display: flex; align-items: center; gap: 0.75rem; }

.core-pulse-circle {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: radial-gradient(circle, #1F2833 0%, #05050A 100%);
    border: 2px solid var(--sector-cyan);
    box-shadow: 0 0 18px var(--sector-cyan);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-arabic);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--sector-cyan);
    flex-shrink: 0;
}

.laser-status-readout {
    font-family: var(--font-mono);
    font-size: var(--fs-2xs);
    color: var(--sector-gold);
    background: rgba(212, 175, 55, 0.12);
    border: 1px solid rgba(212, 175, 55, 0.35);
    padding: 0.28rem 0.75rem;
    border-radius: var(--radius-pill);
}

/* 4-Sector Grid */
.orbital-sectors-grid {
    position: relative;
    z-index: 5;
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--sp-lg);
}

.sector-quadrant {
    background: var(--bg-surface-glass);
    border-radius: var(--radius-lg);
    padding: var(--sp-md);
    display: flex;
    flex-direction: column;
    gap: var(--sp-md);
    position: relative;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.sector-quadrant.sector-1 { border: 1px solid rgba(102, 252, 241, 0.32); box-shadow: inset 0 0 25px rgba(102, 252, 241, 0.04); }
.sector-quadrant.sector-2 { border: 1px solid rgba(46, 204, 113, 0.32); box-shadow: inset 0 0 25px rgba(46, 204, 113, 0.04); }
.sector-quadrant.sector-3 { border: 1px solid rgba(155, 89, 182, 0.38); box-shadow: inset 0 0 25px rgba(155, 89, 182, 0.05); }
.sector-quadrant.sector-4 { border: 1px solid rgba(212, 175, 55, 0.38); box-shadow: inset 0 0 25px rgba(212, 175, 55, 0.05); }

.sector-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-xs);
    flex-wrap: wrap;
    padding-bottom: var(--sp-xs);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sector-title-group { display: flex; align-items: center; gap: 0.6rem; }
.sector-orb-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.sector-1 .sector-orb-dot { background: var(--sector-cyan); box-shadow: 0 0 10px var(--sector-cyan); }
.sector-2 .sector-orb-dot { background: var(--sector-emerald); box-shadow: 0 0 10px var(--sector-emerald); }
.sector-3 .sector-orb-dot { background: var(--sector-purple); box-shadow: 0 0 10px var(--sector-purple); }
.sector-4 .sector-orb-dot { background: var(--sector-gold); box-shadow: 0 0 10px var(--sector-gold); }

.sector-title { font-size: var(--fs-md); font-weight: 800; color: var(--text-primary); }

.sector-count-pill {
    font-family: var(--font-mono);
    font-size: var(--fs-2xs);
    padding: 0.2rem 0.65rem;
    border-radius: var(--radius-pill);
    background: rgba(5, 5, 10, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text-secondary);
}

.mazeed-tier-label {
    font-family: var(--font-mono);
    font-size: var(--fs-2xs);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--sector-emerald);
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin-top: 0.25rem;
}

.mazeed-tier-label::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, rgba(46, 204, 113, 0.35), transparent);
}

.sector-nodes-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--sp-sm);
}

.wazan-star-node {
    position: relative;
    background: rgba(8, 10, 16, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-md);
    padding: 0.75rem 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    cursor: pointer;
    transition: transform var(--ease-smooth), opacity var(--ease-smooth), border-color var(--ease-smooth), box-shadow var(--ease-smooth), filter var(--ease-smooth);
    outline: none;
}

.wazan-star-node.is-dimmed {
    opacity: 0.18;
    filter: grayscale(80%);
    transform: scale(0.96);
    pointer-events: none;
}

.wazan-star-node[data-sector="1"] { border-left: 3.5px solid var(--sector-cyan); }
.wazan-star-node[data-sector="2"] { border-left: 3.5px solid var(--sector-emerald); }
.wazan-star-node[data-sector="3"] { border-left: 3.5px solid var(--sector-purple); }
.wazan-star-node[data-sector="4"] { border-left: 3.5px solid var(--sector-gold); }

.wazan-star-node[data-sector="1"]:hover,
.wazan-star-node[data-sector="1"].active-node {
    transform: translateY(-4px) scale(1.015);
    border-color: var(--sector-cyan);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.9), 0 0 22px var(--sector-cyan-dim);
}

.wazan-star-node[data-sector="2"]:hover,
.wazan-star-node[data-sector="2"].active-node {
    transform: translateY(-4px) scale(1.015);
    border-color: var(--sector-emerald);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.9), 0 0 22px var(--sector-emerald-dim);
}

.wazan-star-node[data-sector="3"]:hover,
.wazan-star-node[data-sector="3"].active-node {
    transform: translateY(-4px) scale(1.015);
    border-color: var(--sector-purple);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.9), 0 0 22px var(--sector-purple-dim);
}

.wazan-star-node[data-sector="4"]:hover,
.wazan-star-node[data-sector="4"].active-node {
    transform: translateY(-4px) scale(1.015);
    border-color: var(--sector-gold);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.9), 0 0 22px var(--sector-gold-dim);
}

.node-top-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
    font-family: var(--font-mono);
    font-size: 0.66rem;
    color: var(--text-muted);
}

.node-addition-tag {
    padding: 0.1rem 0.45rem;
    border-radius: 4px;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
}

.node-arabic-wazan {
    font-family: var(--font-arabic);
    font-size: var(--fs-ar-node);
    text-align: center;
    padding: 0.2rem 0;
}

.node-bottom-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
    font-size: var(--fs-2xs);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding-top: 0.35rem;
}

.node-semantic-pill {
    color: var(--text-secondary);
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.node-example-ar {
    font-family: var(--font-arabic);
    font-size: 1.05rem;
    color: var(--sector-gold);
    font-weight: 700;
}

/* Collapsible Inspector Drawer */
.inspector-drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 140;
    background: rgba(5, 5, 10, 0.65);
    backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--ease-smooth), visibility var(--ease-smooth);
}

.inspector-drawer-backdrop.open { opacity: 1; visibility: visible; }

.morphological-inspector-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 150;
    width: min(500px, 100vw);
    background: var(--bg-drawer-glass);
    border-left: 1.5px solid var(--sector-cyan);
    box-shadow: -20px 0 50px rgba(0, 0, 0, 0.95), 0 0 35px rgba(102, 252, 241, 0.18);
    padding: var(--sp-lg);
    display: flex;
    flex-direction: column;
    gap: var(--sp-md);
    overflow-y: auto;
    transform: translateX(102%);
    transition: transform 340ms cubic-bezier(0.16, 1, 0.3, 1);
}

.morphological-inspector-drawer.open { transform: translateX(0); }

.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-sm);
    padding-bottom: var(--sp-sm);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.drawer-close-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.drawer-close-btn:hover { background: var(--sector-cyan); color: var(--bg-space); }

.drawer-hero-schema {
    background: radial-gradient(circle at 50% 0%, rgba(102, 252, 241, 0.12), rgba(5, 5, 10, 0.95));
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--sp-md);
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.drawer-wazan-ar { font-family: var(--font-arabic); font-size: var(--fs-ar-drawer); font-weight: 700; }

.drawer-info-card {
    background: rgba(22, 29, 40, 0.78);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    padding: var(--sp-sm) var(--sp-md);
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.drawer-section-label {
    font-family: var(--font-mono);
    font-size: var(--fs-2xs);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--sector-cyan);
    font-weight: 700;
}

.drawer-timeline-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.timeline-mini-node {
    background: rgba(5, 5, 10, 0.85);
    border: 1px solid rgba(102, 252, 241, 0.18);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.65rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.15rem;
}

.tm-shighat { font-family: var(--font-mono); font-size: 0.64rem; color: var(--text-muted); text-transform: uppercase; }
.tm-arabic { font-family: var(--font-arabic); font-size: 1.38rem; color: var(--sector-cyan); font-weight: 700; }
.tm-mauzun { font-family: var(--font-arabic); font-size: 1.1rem; color: var(--sector-gold); }

.drawer-action-links {
    display: flex;
    gap: var(--sp-sm);
    flex-wrap: wrap;
    margin-top: auto;
    padding-top: var(--sp-sm);
}

.drawer-btn-primary {
    flex: 1;
    text-align: center;
    padding: 0.65rem 1rem;
    border-radius: var(--radius-pill);
    background: var(--sector-cyan);
    color: var(--bg-space);
    font-size: var(--fs-xs);
    font-weight: 800;
    box-shadow: 0 0 18px var(--sector-cyan-glow);
}

@media screen and (min-width: 640px) {
    .sector-nodes-grid { grid-template-columns: repeat(2, 1fr); }
    .drawer-timeline-grid { grid-template-columns: repeat(3, 1fr); }
}

@media screen and (min-width: 1120px) {
    .orbital-sectors-grid { grid-template-columns: repeat(12, 1fr); align-items: start; }
    .sector-quadrant.sector-1 { grid-column: span 5; }
    .sector-quadrant.sector-2 { grid-column: span 7; }
    .sector-quadrant.sector-2 .sector-nodes-grid { grid-template-columns: repeat(3, 1fr); }
    .sector-quadrant.sector-3 { grid-column: span 6; }
    .sector-quadrant.sector-4 { grid-column: span 6; }
}

@media screen and (min-width: 1600px) {
    .sector-quadrant.sector-1 .sector-nodes-grid { grid-template-columns: repeat(3, 1fr); }
    .sector-quadrant.sector-2 .sector-nodes-grid { grid-template-columns: repeat(4, 1fr); }
}
