/* -------------------------------------------------------------
   GIDEON DASHBOARD - VISUAL CORE DESIGN
   ------------------------------------------------------------- */

*,
*::before,
*::after {
    box-sizing: border-box;
}

body,
html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: radial-gradient(circle at center, #0d0f12 0%, #030405 100%);
    color: #f0f4f8;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

body::before,
body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

body::before {
    background:
        radial-gradient(circle at 25% 30%, rgba(100, 181, 246, 0.08), transparent 42%),
        radial-gradient(circle at 74% 70%, rgba(165, 214, 167, 0.1), transparent 44%);
    filter: blur(16px);
}

body::after {
    background:
        radial-gradient(circle at 50% 58%, rgba(8, 26, 36, 0.5), transparent 54%),
        linear-gradient(180deg, rgba(2, 4, 5, 0.06), rgba(2, 4, 5, 0.42));
}

/* Three.js Canvas im Hintergrund fixieren */
#sphere-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    filter: saturate(1.1) contrast(1.05);
}

#brain-regions {
    position: fixed;
    left: 26px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 3;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.region-node {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border: 1px solid rgba(136, 196, 226, 0.2);
    border-radius: 999px;
    background: rgba(8, 20, 26, 0.35);
    color: rgba(176, 216, 236, 0.65);
    font-family: "SFMono-Regular", Consolas, monospace;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    transition: all 0.35s ease;
}

.region-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(136, 196, 226, 0.5);
    box-shadow: 0 0 10px rgba(136, 196, 226, 0.2);
    transition: all 0.35s ease;
}

.region-node.active {
    color: rgba(226, 247, 255, 0.95);
    border-color: rgba(148, 219, 255, 0.55);
    background: rgba(18, 42, 54, 0.55);
    box-shadow: 0 0 14px rgba(109, 196, 239, 0.14);
}

.region-node.active .region-dot {
    background: rgba(154, 234, 255, 0.95);
    box-shadow: 0 0 14px rgba(125, 226, 255, 0.65);
}

/* Boxless Chat-Overlay über der Sphäre */
#chat-flow {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    overflow-y: auto;
    padding: 40px 60px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

#message-container {
    display: block;
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    padding-top: 10vh;
    flex-grow: 1;
    overflow-y: auto;
}

/* Eingabebereich unboxed und zentral */
#input-container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px 0 30px 0;
    flex-shrink: 0;
}

#voice-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 8px;
}

#voice-controls button {
    background: transparent;
    border: 1px solid rgba(165, 214, 167, 0.25);
    color: #a5d6a7;
    border-radius: 4px;
    padding: 6px 10px;
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    font-family: "SFMono-Regular", Consolas, monospace;
    cursor: pointer;
    transition: border-color 0.3s ease, color 0.3s ease, background 0.3s ease;
}

#voice-controls button:hover {
    border-color: #a5d6a7;
    color: #ffffff;
}

#voice-record-btn.recording {
    border-color: rgba(239, 154, 154, 0.8);
    color: #ef9a9a;
    background: rgba(239, 154, 154, 0.08);
}

#voice-status {
    min-height: 1.1em;
    margin-top: 6px;
    font-size: 0.8rem;
    color: rgba(165, 214, 167, 0.85);
    font-family: "SFMono-Regular", Consolas, monospace;
}

#user-input {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: #ffffff;
    font-size: 1.15rem;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
    border-bottom: 1px solid rgba(165, 214, 167, 0.2);
    padding: 10px 0;
    transition: border-color 0.3s ease;
}

#user-input:focus {
    border-color: #a5d6a7;
}

@media (max-width: 900px) {
    #brain-regions {
        left: 12px;
        top: 18px;
        transform: none;
        gap: 6px;
    }

    .region-node {
        font-size: 0.64rem;
        padding: 5px 8px;
    }

    #chat-flow {
        padding: 24px 20px;
    }

    #message-container {
        padding-top: 6vh;
    }

    .msg {
        font-size: 1rem;
        margin-bottom: 1.8rem;
    }

    .msg.gideon {
        padding-right: 4%;
    }

    .msg.user {
        padding-left: 4%;
    }

    #user-input {
        font-size: 1rem;
    }
}

/* Nachrichten-Typen komplett rahmenlos */
.msg {
    margin-bottom: 2.5rem;
    line-height: 1.6;
    font-size: 1.15rem;
    letter-spacing: -0.01em;
    opacity: 0;
    transform: translateY(10px);
    animation: fadeInFlow 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Gideon: Linksbuendig, Monospace für Systemcharakter */
.msg.gideon {
    text-align: left;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
    color: #a5d6a7;
    /* Dezent biologisches, softes Gruen */
    padding-right: 20%;
}

/* User: Rechtsbuendig, Schlichte Grotesk */
.msg.user {
    text-align: right;
    color: #ffffff;
    padding-left: 20%;
}

/* Admin-Gate (Erscheint fließend bei awaiting_approval) */
#admin-gate {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    padding: 12px 24px;
    background: rgba(255, 183, 77, 0.05);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 183, 77, 0.15);
    border-radius: 4px;
    transition: all 0.5s ease;
}

#admin-gate.hidden {
    display: none;
    opacity: 0;
}

.gate-prompt {
    font-family: "SFMono-Regular", Consolas, monospace;
    color: #ffb74d;
    /* Warmes Gold */
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.1em;
}

@keyframes fadeInFlow {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* -------------------------------------------------------------
   LOGIN-POPUP (Freischalt-Phrase)
   ------------------------------------------------------------- */

#auth-trigger {
    position: fixed;
    top: 24px;
    right: 30px;
    z-index: 4;
    background: transparent;
    border: 1px solid rgba(165, 214, 167, 0.25);
    color: #a5d6a7;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 1rem;
    cursor: pointer;
    transition: border-color 0.3s ease, color 0.3s ease;
}

#auth-trigger:hover {
    border-color: #a5d6a7;
    color: #ffffff;
}

#auth-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    background: rgba(3, 4, 5, 0.75);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
}

#auth-modal.hidden {
    display: none;
}

#auth-modal-box {
    background: #0d0f12;
    border: 1px solid rgba(165, 214, 167, 0.2);
    border-radius: 6px;
    padding: 28px 32px;
    width: 320px;
    text-align: center;
}

#auth-modal-title {
    color: #f0f4f8;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
    letter-spacing: 0.05em;
    margin: 0 0 16px 0;
    font-size: 1rem;
}

#auth-phrase-input {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: #ffffff;
    font-size: 1.05rem;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
    border-bottom: 1px solid rgba(165, 214, 167, 0.3);
    padding: 8px 0;
    text-align: center;
}

#auth-phrase-input:focus {
    border-color: #a5d6a7;
}

#auth-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

#auth-modal-actions button {
    background: transparent;
    border: 1px solid rgba(165, 214, 167, 0.3);
    color: #a5d6a7;
    padding: 8px 16px;
    border-radius: 4px;
    font-family: "SFMono-Regular", Consolas, monospace;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

#auth-modal-actions button:hover {
    border-color: #a5d6a7;
    color: #ffffff;
}

#auth-modal-feedback {
    margin: 14px 0 0 0;
    font-size: 0.85rem;
    font-family: "SFMono-Regular", Consolas, monospace;
    min-height: 1.2em;
}

#auth-modal-feedback.success {
    color: #a5d6a7;
}

#auth-modal-feedback.error {
    color: #ef9a9a;
}