
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;500;600;700&family=Rajdhani:wght@400;500;600;700&display=swap');

:root {
    --cyan: #00eaff;
    --blue: #168bff;
    --deep-blue: #06172a;
    --panel: rgba(5, 24, 43, 0.88);
    --border: rgba(0, 220, 255, 0.28);
    --text: #d9f8ff;
    --muted: #6899b5;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background:
        radial-gradient(ellipse at 50% 40%, #0b2945 0%, #030a14 75%);
    font-family: 'Rajdhani', sans-serif;
    overflow-x: hidden;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(0, 210, 255, .035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 210, 255, .035) 1px, transparent 1px);
    background-size: 35px 35px;
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 20;
    background: repeating-linear-gradient(
        transparent 0px,
        transparent 3px,
        rgba(0, 220, 255, .018) 4px
    );
}

.topbar {
    height: 85px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 4%;
    border-bottom: 1px solid var(--border);
    background: rgba(2, 10, 20, .92);
    position: relative;
    z-index: 2;
}

.brand {
    font-family: 'Orbitron', sans-serif;
    font-size: 27px;
    letter-spacing: 6px;
    color: var(--cyan);
    text-shadow: 0 0 20px var(--blue);
}

.subtitle {
    font-size: 9px;
    letter-spacing: 2px;
    color: var(--muted);
    margin-top: 5px;
}

.connection {
    font-family: 'Orbitron', sans-serif;
    font-size: 10px;
    letter-spacing: 2px;
    color: #00ffae;
}

.pulse {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #00ffae;
    box-shadow: 0 0 12px #00ffae;
    animation: pulse 1.5s infinite;
    margin-right: 8px;
}

.clock {
    color: var(--cyan);
    font-family: 'Orbitron', sans-serif;
    font-size: 16px;
    letter-spacing: 2px;
}

.dashboard {
    width: 94%;
    max-width: 1600px;
    margin: 28px auto;
    display: grid;
    grid-template-columns: minmax(220px, .85fr) minmax(400px, 1.7fr) minmax(220px, .85fr);
    grid-template-rows: minmax(430px, 1fr) 190px;
    gap: 18px;
}

.panel {
    position: relative;
    background: var(--panel);
    border: 1px solid var(--border);
    padding: 20px;
    overflow: hidden;
    box-shadow:
        0 0 20px rgba(0, 180, 255, .045),
        inset 0 0 25px rgba(0, 150, 255, .025);
    clip-path: polygon(
        0 12px, 12px 0, 100% 0,
        100% calc(100% - 12px),
        calc(100% - 12px) 100%, 0 100%
    );
}

.panel::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 65px;
    height: 2px;
    background: var(--cyan);
    box-shadow: 0 0 15px var(--cyan);
}

.panel h2 {
    color: var(--cyan);
    font-family: 'Orbitron', sans-serif;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 2px;
    margin: 0 0 25px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.telemetry {
    grid-column: 1;
    grid-row: 1;
}

.gauges {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 28px 10px;
}

.gauge {
    min-height: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(0, 200, 255, .18);
    border-radius: 50%;
    aspect-ratio: 1;
    max-width: 115px;
    margin: auto;
    box-shadow: inset 0 0 20px rgba(0, 180, 255, .07);
}

.gauge-value {
    font-family: 'Orbitron', sans-serif;
    font-size: 19px;
    color: var(--cyan);
    text-shadow: 0 0 12px var(--blue);
}

.gauge span {
    color: var(--muted);
    font-size: 9px;
    letter-spacing: 1px;
    margin-top: 8px;
}

.small-info {
    margin-top: 30px;
    font-size: 12px;
    color: var(--muted);
}

.small-info span {
    color: var(--cyan);
}

.core-section {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    min-width: 0;
    border: 1px solid rgba(0, 210, 255, .15);
    background: radial-gradient(
        ellipse at center,
        rgba(0, 130, 255, .09),
        transparent 72%
    );
}

.core-label,
.core-name {
    font-family: 'Orbitron', sans-serif;
    color: var(--cyan);
    letter-spacing: 3px;
    font-size: 11px;
    text-align: center;
}

.core-container {
    width: min(100%, 470px);
    aspect-ratio: 1;
    position: relative;
}

#neural-core {
    display: block;
    width: 100%;
    height: 100%;
}

.core-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.reactor {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: radial-gradient(circle, white, #5ffaff 35%, #007bff 75%);
    box-shadow:
        0 0 15px #00eaff,
        0 0 35px #008cff,
        0 0 65px rgba(0, 170, 255, .8);
    animation: reactor 2s ease-in-out infinite;
}

.core-name {
    font-size: 15px;
    margin-top: 3px;
}

.core-state {
    color: #00ffae;
    font-size: 10px;
    letter-spacing: 2px;
    margin-top: 12px;
    text-align: center;
}

.core-footer {
    display: flex;
    justify-content: space-between;
    width: 75%;
    max-width: 380px;
    color: var(--muted);
    font-size: 9px;
    letter-spacing: 1px;
    margin-top: 24px;
}

.memory-panel {
    grid-column: 3;
    grid-row: 1;
}

.memory-summary {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 15px;
    border: 1px solid var(--border);
    background: rgba(0, 130, 255, .06);
}

.brain-icon {
    font-size: 38px;
    color: var(--cyan);
    text-shadow: 0 0 18px var(--blue);
}

.memory-number {
    font-family: 'Orbitron', sans-serif;
    font-size: 32px;
    color: var(--cyan);
}

.muted {
    font-size: 10px;
    color: var(--muted);
    letter-spacing: 1px;
}

.memory-panel h3 {
    font-family: 'Orbitron', sans-serif;
    font-size: 10px;
    color: var(--cyan);
    letter-spacing: 2px;
    margin: 28px 0 15px;
}

.memory-list {
    display: grid;
    gap: 10px;
}

.memory-item {
    padding: 12px;
    border-left: 2px solid var(--blue);
    background: rgba(0, 130, 255, .06);
    display: flex;
    flex-direction: column;
    gap: 5px;
    overflow-wrap: anywhere;
}

.memory-item strong {
    font-size: 13px;
    color: var(--text);
}

.memory-item span {
    font-size: 9px;
    color: var(--cyan);
    text-transform: uppercase;
}

.activity-panel {
    grid-column: 1 / 3;
    grid-row: 2;
}

.activity-item {
    padding: 7px 0;
    border-bottom: 1px solid rgba(0, 200, 255, .1);
    font-size: 12px;
    color: #a6d8ee;
}

.activity-item::before {
    content: "›";
    color: var(--cyan);
    margin-right: 10px;
}

.system-panel {
    grid-column: 3;
    grid-row: 2;
}

.status-item {
    font-size: 12px;
    margin: 12px 0;
    color: #a6d8ee;
}

.status-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #00ffae;
    box-shadow: 0 0 10px #00ffae;
    margin-right: 9px;
}

.status-dot.offline {
    background: #ff4757;
    box-shadow: 0 0 10px #ff4757;
}

footer {
    display: flex;
    justify-content: space-between;
    padding: 20px 4%;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-family: 'Orbitron', sans-serif;
    font-size: 9px;
    letter-spacing: 2px;
}

@keyframes pulse {
    50% { opacity: .3; }
}

@keyframes reactor {
    50% {
        transform: scale(1.2);
        box-shadow:
            0 0 25px #00eaff,
            0 0 50px #008cff,
            0 0 85px rgba(0, 170, 255, .9);
    }
}

@media (max-width: 1000px) {
    .dashboard {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto;
    }

    .telemetry {
        grid-column: 1;
        grid-row: 1;
    }

    .core-section {
        grid-column: 2;
        grid-row: 1;
        min-height: 400px;
    }

    .memory-panel {
        grid-column: 1 / 3;
        grid-row: 2;
    }

    .activity-panel {
        grid-column: 1;
        grid-row: 3;
    }

    .system-panel {
        grid-column: 2;
        grid-row: 3;
    }
}

@media (max-width: 600px) {
    .topbar {
        height: auto;
        min-height: 80px;
        padding: 15px 4%;
        flex-wrap: wrap;
        gap: 12px;
    }

    .brand {
        font-size: 20px;
    }

    .clock {
        font-size: 12px;
    }

    .dashboard {
        display: flex;
        flex-direction: column;
    }

    .core-section {
        min-height: 350px;
        order: -1;
    }

    .core-container {
        width: min(100%, 360px);
    }

    .telemetry,
    .memory-panel,
    .activity-panel,
    .system-panel {
        width: 100%;
    }

    footer {
        font-size: 7px;
        gap: 12px;
    }
}


/* =====================================
   JARVIS FULL-WIDTH CHAT INTERFACE
===================================== */

.dashboard {
    grid-template-rows: minmax(430px, 1fr) 190px auto;
}

.chat-panel {
    grid-column: 1 / -1;
    min-height: 430px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.chat-heading h2 {
    margin-bottom: 8px;
}

.chat-subtitle,
.chat-footnote {
    color: #56869e;
    font-size: 9px;
    letter-spacing: 1.5px;
}

.chat-live {
    color: #62e6bd;
    font-size: 10px;
    letter-spacing: 1px;
    white-space: nowrap;
}

.chat-messages {
    height: 290px;
    min-height: 200px;
    overflow-y: auto;
    padding: 18px;
    background: rgba(2, 12, 23, .8);
    border: 1px solid rgba(0, 180, 255, .18);
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.chat-empty {
    margin: auto;
    text-align: center;
    color: #56c9ee;
    font-family: 'Orbitron', sans-serif;
    font-size: 11px;
    letter-spacing: 2px;
}

.chat-empty span {
    display: block;
    margin-top: 12px;
    color: #66899b;
    font-family: 'Rajdhani', sans-serif;
    letter-spacing: 1px;
}

.chat-message {
    max-width: 82%;
    padding: 12px 15px;
    border: 1px solid rgba(0, 180, 255, .2);
    background: rgba(8, 35, 53, .85);
    color: #d8f4ff;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

.chat-message.user {
    align-self: flex-end;
    border-color: rgba(0, 200, 255, .4);
    background: rgba(0, 105, 150, .2);
}

.chat-message.assistant {
    align-self: flex-start;
}

.chat-message-label {
    margin-bottom: 5px;
    color: #49d5ff;
    font-family: 'Orbitron', sans-serif;
    font-size: 9px;
    letter-spacing: 2px;
}

.chat-message-body {
    white-space: pre-wrap;
    font-size: 14px;
}

.chat-form {
    display: flex;
    gap: 12px;
}

.chat-form textarea {
    flex: 1;
    min-width: 0;
    resize: vertical;
    min-height: 48px;
    max-height: 130px;
    padding: 14px;
    background: #061522;
    border: 1px solid #176181;
    color: #d9f7ff;
    font: inherit;
    outline: none;
}

.chat-form textarea:focus {
    border-color: #35caff;
    box-shadow: 0 0 12px rgba(0, 180, 255, .15);
}

.chat-form button {
    min-width: 105px;
    border: 1px solid #35caff;
    background: #087da8;
    color: white;
    font-family: 'Orbitron', sans-serif;
    font-size: 11px;
    letter-spacing: 2px;
    cursor: pointer;
}

.chat-form button:disabled {
    opacity: .5;
    cursor: wait;
}

.chat-thinking {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #55dcff;
    font-family: 'Orbitron', sans-serif;
    font-size: 10px;
    letter-spacing: 2px;
}

.chat-thinking[hidden] {
    display: none;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots i {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #55dcff;
    animation: jarvisTyping 1s infinite alternate;
}

.typing-dots i:nth-child(2) { animation-delay: .2s; }
.typing-dots i:nth-child(3) { animation-delay: .4s; }

@keyframes jarvisTyping {
    from { opacity: .25; transform: translateY(0); }
    to { opacity: 1; transform: translateY(-4px); }
}

.logout-link {
    color: #67cbe9;
    text-decoration: none;
    font-size: 10px;
    letter-spacing: 1px;
}

.logout-link:hover {
    color: white;
}

@media (max-width: 1000px) {
    .chat-panel {
        grid-column: 1 / -1;
    }
}

@media (max-width: 600px) {
    .chat-panel {
        width: 100%;
        min-height: 400px;
    }

    .chat-heading {
        align-items: flex-start;
    }

    .chat-messages {
        height: 280px;
        padding: 10px;
    }

    .chat-message {
        max-width: 94%;
    }

    .chat-form button {
        min-width: 75px;
        font-size: 9px;
    }
}
