:root {
    --navy-blue: #1e3a8a;
    --navy-dark: #0f172a;
    --yellow-accent: #fbbf24;
    --green-accent: #22c55e;
    --red-accent: #ef4444;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --bg-main: #020617;
    --bg-panel: rgba(15, 23, 42, 0.7);
    --border-color: rgba(30, 58, 138, 0.5);
    
    --font-ui: 'Inter', sans-serif;
    --font-mono: 'Fira Code', monospace;
}

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

body {
    font-family: var(--font-ui);
    background-color: var(--bg-main);
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(30, 58, 138, 0.15), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(34, 197, 94, 0.05), transparent 25%);
    color: var(--text-primary);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--navy-blue), var(--yellow-accent));
    border-radius: 8px;
    box-shadow: 0 0 15px rgba(251, 191, 36, 0.3);
}

.logo h1 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--text-primary);
}

.app-nav button {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-family: var(--font-ui);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.app-nav button:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.app-nav button.active {
    color: var(--yellow-accent);
    border-color: rgba(251, 191, 36, 0.3);
    background: rgba(251, 191, 36, 0.1);
}

/* Layout */
.app-container {
    display: flex;
    flex: 1;
    overflow: hidden;
    padding: 1rem;
    gap: 1rem;
}

.sidebar-left {
    width: 350px;
    display: flex;
    flex-direction: column;
}

.workspace {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.panel {
    background: var(--bg-panel);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--navy-blue);
    padding-bottom: 0.5rem;
    display: inline-block;
}

/* Tasks & Hints */
.task-panel {
    flex: 1;
    overflow-y: auto;
}

.task-desc {
    margin: 1rem 0;
    line-height: 1.6;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.hints-section {
    margin-top: 1.5rem;
    background: rgba(30, 58, 138, 0.2);
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid var(--yellow-accent);
}

.hints-section h3 {
    font-size: 0.9rem;
    color: var(--yellow-accent);
    margin-bottom: 0.5rem;
}

#task-hints p {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.btn-primary, .btn-secondary {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 1rem;
    width: 100%;
}

.btn-primary {
    background: var(--navy-blue);
    color: white;
}

.btn-primary:hover {
    background: #2563eb;
    box-shadow: 0 0 12px rgba(37, 99, 235, 0.4);
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--yellow-accent);
    color: var(--yellow-accent);
}

.btn-secondary:hover {
    background: rgba(251, 191, 36, 0.1);
}

.progress-container {
    margin-top: 2rem;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--green-accent);
    width: 0%;
    transition: width 0.5s ease;
    box-shadow: 0 0 8px var(--green-accent);
}

.progress-text {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

/* Topology */
.topology-panel {
    height: 40%;
}

.topology-container {
    flex: 1;
    position: relative;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    overflow: hidden;
}

.legend {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.dot.green { background: var(--green-accent); box-shadow: 0 0 5px var(--green-accent); }
.dot.red { background: var(--red-accent); box-shadow: 0 0 5px var(--red-accent); }

/* Terminal */
.terminal-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.device-selector select {
    background: rgba(15, 23, 42, 0.9);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    outline: none;
    cursor: pointer;
}

.terminal-container {
    flex: 1;
    background: #000;
    border-radius: 8px;
    padding: 1rem;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: #e2e8f0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8);
    position: relative;
}

.terminal-output {
    white-space: pre-wrap;
    word-wrap: break-word;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.terminal-input-line {
    display: flex;
    align-items: center;
}

.prompt {
    color: var(--green-accent);
    margin-right: 0.5rem;
    white-space: pre;
}

#terminal-input {
    flex: 1;
    background: transparent;
    border: none;
    color: #e2e8f0;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    outline: none;
}

/* Utilities */
.hidden { display: none !important; }

/* SVG Styling for Topology */
svg text {
    fill: var(--text-primary);
    font-family: var(--font-ui);
    font-size: 12px;
}

svg .link {
    stroke: var(--text-secondary);
    stroke-width: 2;
    transition: stroke 0.3s;
}

svg .link.up { stroke: var(--green-accent); }
svg .link.down { stroke: var(--red-accent); }

svg .device-rect {
    fill: var(--navy-dark);
    stroke: var(--navy-blue);
    stroke-width: 2;
    rx: 6;
    transition: all 0.3s ease;
}

svg .device-rect:hover {
    stroke: var(--yellow-accent);
    filter: drop-shadow(0 0 8px rgba(251, 191, 36, 0.4));
    cursor: pointer;
}

svg .device-icon {
    fill: var(--text-primary);
}
