:root {
    --bg-primary: #0a0e17;
    --bg-secondary: #0d1321;
    --bg-panel: rgba(13, 25, 45, 0.85);
    --border-color: rgba(0, 180, 255, 0.15);
    --border-glow: rgba(0, 180, 255, 0.3);
    --accent: #00b4ff;
    --accent-dim: rgba(0, 180, 255, 0.4);
    --accent-bright: #00e5ff;
    --text-primary: #e0e8f0;
    --text-secondary: #7a8ba0;
    --text-dim: #4a5a6a;
    --success: #00ff88;
    --warning: #ffaa00;
    --danger: #ff4466;
    --font-mono: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-sans);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

/* Scanline overlay */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 180, 255, 0.015) 2px,
        rgba(0, 180, 255, 0.015) 4px
    );
    pointer-events: none;
    z-index: 9999;
}

#jarvis-app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* HEADER */
#header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 24px;
    background: linear-gradient(180deg, rgba(0,20,40,0.95) 0%, rgba(0,10,20,0.8) 100%);
    border-bottom: 1px solid var(--border-color);
    z-index: 10;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo {
    font-family: var(--font-mono);
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 4px;
    color: var(--accent);
    text-shadow: 0 0 20px rgba(0, 180, 255, 0.5), 0 0 40px rgba(0, 180, 255, 0.2);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

#status-text {
    font-size: 12px;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.header-right {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-secondary);
    letter-spacing: 1px;
}

.separator { margin: 0 10px; opacity: 0.3; }

/* DASHBOARD GRID */
#dashboard {
    display: grid;
    grid-template-columns: 260px 1fr 300px;
    gap: 12px;
    padding: 12px;
    flex: 1;
    overflow: hidden;
}

/* PANELS */
.panel {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    backdrop-filter: blur(10px);
    transition: border-color 0.3s;
}

.panel:hover {
    border-color: var(--border-glow);
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    font-size: 11px;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--accent);
    border-bottom: 1px solid var(--border-color);
    background: rgba(0, 180, 255, 0.03);
}

.panel-icon {
    font-size: 10px;
    opacity: 0.7;
}

.panel-badge {
    margin-left: auto;
    font-size: 9px;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(0, 255, 136, 0.15);
    color: var(--success);
    border: 1px solid rgba(0, 255, 136, 0.3);
}

.panel-btn {
    margin-left: auto;
    font-size: 9px;
    padding: 2px 10px;
    border-radius: 4px;
    background: rgba(0, 180, 255, 0.1);
    color: var(--accent);
    border: 1px solid var(--border-color);
    cursor: pointer;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.panel-btn:hover { background: rgba(0, 180, 255, 0.2); }

.panel-body {
    padding: 12px 14px;
}

/* LEFT PANELS */
#left-panels {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    scrollbar-width: none;
}

#left-panels::-webkit-scrollbar { display: none; }

/* STAT ROWS */
.stat-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.stat-label {
    font-size: 10px;
    font-family: var(--font-mono);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    min-width: 70px;
}

.stat-bar {
    flex: 1;
    height: 4px;
    background: rgba(0, 180, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.stat-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-bright));
    border-radius: 2px;
    transition: width 0.8s ease;
    box-shadow: 0 0 8px rgba(0, 180, 255, 0.4);
    width: 0%;
}

.stat-value {
    font-size: 11px;
    font-family: var(--font-mono);
    color: var(--text-primary);
    min-width: 55px;
    text-align: right;
}

/* WEATHER */
.weather-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.weather-temp {
    font-size: 28px;
    font-weight: 300;
    font-family: var(--font-mono);
    color: var(--text-primary);
}

.weather-icon {
    font-size: 32px;
}

.weather-desc {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 6px;
    text-transform: capitalize;
}

.weather-city {
    font-size: 10px;
    color: var(--text-dim);
    font-family: var(--font-mono);
    margin-top: 2px;
}

/* CAMERA */
.camera-body {
    padding: 0 !important;
    position: relative;
    height: 120px;
}

#camera-feed {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
    border-radius: 0 0 8px 8px;
}

.camera-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    font-size: 11px;
    color: var(--text-dim);
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 2px;
    background: rgba(0, 0, 0, 0.3);
}

/* TIMER */
.timer-display {
    font-family: var(--font-mono);
    font-size: 24px;
    color: var(--accent);
    text-align: center;
    text-shadow: 0 0 15px rgba(0, 180, 255, 0.3);
    letter-spacing: 3px;
}

/* CENTER ORB AREA */
#center-orb {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

#orb-container {
    width: 100%;
    flex: 1;
    min-height: 300px;
}

#orb-label {
    text-align: center;
    margin-top: -20px;
    position: relative;
    z-index: 5;
}

.orb-name {
    font-family: var(--font-mono);
    font-size: 16px;
    letter-spacing: 6px;
    color: var(--text-primary);
    text-shadow: 0 0 20px rgba(0, 180, 255, 0.3);
}

.orb-status {
    font-size: 11px;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    margin-top: 4px;
    letter-spacing: 1px;
}

/* CONTROLS */
#controls {
    display: flex;
    gap: 16px;
    margin: 16px 0;
    z-index: 5;
}

.ctrl-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: rgba(0, 20, 40, 0.8);
    color: var(--accent);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.ctrl-btn:hover {
    border-color: var(--accent);
    background: rgba(0, 180, 255, 0.1);
    box-shadow: 0 0 20px rgba(0, 180, 255, 0.2);
}

.ctrl-btn.active {
    background: rgba(0, 180, 255, 0.2);
    border-color: var(--accent);
    box-shadow: 0 0 25px rgba(0, 180, 255, 0.4);
    animation: pulse-btn 1.5s ease-in-out infinite;
}

@keyframes pulse-btn {
    0%, 100% { box-shadow: 0 0 15px rgba(0, 180, 255, 0.3); }
    50% { box-shadow: 0 0 30px rgba(0, 180, 255, 0.6); }
}

/* TEXT INPUT */
#text-input-area {
    width: 100%;
    max-width: 500px;
    z-index: 5;
}

#frontline-label {
    font-size: 9px;
    font-family: var(--font-mono);
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 6px;
    text-align: center;
}

.input-row {
    display: flex;
    gap: 8px;
}

#chat-input {
    flex: 1;
    background: rgba(0, 20, 40, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 16px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: var(--font-sans);
    outline: none;
    transition: border-color 0.3s;
}

#chat-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 15px rgba(0, 180, 255, 0.1);
}

#chat-input::placeholder {
    color: var(--text-dim);
}

#btn-send {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: rgba(0, 180, 255, 0.1);
    color: var(--accent);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

#btn-send:hover {
    background: rgba(0, 180, 255, 0.25);
    border-color: var(--accent);
}

.model-selector {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    justify-content: center;
}

.model-selector select {
    background: rgba(0, 20, 40, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-secondary);
    font-size: 10px;
    font-family: var(--font-mono);
    padding: 4px 8px;
    outline: none;
    cursor: pointer;
}

.model-selector select:focus {
    border-color: var(--accent);
}

/* RIGHT PANELS */
#right-panels {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow: hidden;
}

.panel-full {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-full .panel-body {
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

/* CHAT MESSAGES */
.msg {
    margin-bottom: 14px;
    animation: msg-in 0.3s ease;
}

@keyframes msg-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.msg-author {
    display: block;
    font-size: 10px;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.msg-jarvis .msg-author { color: var(--accent); }
.msg-user .msg-author { color: var(--success); }

.msg-text {
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-primary);
}

.msg-user .msg-text {
    color: var(--text-secondary);
}

/* CALENDAR */
.calendar-empty {
    font-size: 11px;
    color: var(--text-dim);
    text-align: center;
    padding: 10px;
    font-family: var(--font-mono);
}

/* NEWS */
.news-item {
    padding: 8px 0;
    border-bottom: 1px solid rgba(0, 180, 255, 0.05);
}

.news-item:last-child { border-bottom: none; }

.news-title {
    font-size: 11px;
    color: var(--text-primary);
    line-height: 1.4;
    cursor: pointer;
    transition: color 0.2s;
}

.news-title:hover { color: var(--accent); }

.news-source {
    font-size: 9px;
    color: var(--text-dim);
    font-family: var(--font-mono);
    margin-top: 2px;
}

.news-loading {
    font-size: 11px;
    color: var(--text-dim);
    text-align: center;
    padding: 10px;
    font-family: var(--font-mono);
}

/* SCROLLBAR */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-dim); }

/* Responsive */
@media (max-width: 1024px) {
    #dashboard {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto;
    }
    #left-panels { flex-direction: row; overflow-x: auto; }
    #left-panels .panel { min-width: 200px; }
}
