/* CSS Variable System for Premium Theme */
:root {
    --bg-main: #0b0f19;
    --bg-panel: rgba(17, 24, 39, 0.7);
    --bg-terminal: #030712;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(99, 102, 241, 0.2);
    
    /* Harmonious HSL Tailored Colors */
    --color-primary: #6366f1; /* Indigo */
    --color-primary-hover: #4f46e5;
    --color-success: #10b981; /* Emerald */
    --color-danger: #ef4444; /* Rose/Red */
    --color-warning: #f59e0b; /* Amber */
    --color-vlan10: #eab308; /* Yellow */
    --color-vlan20: #ec4899; /* Pink */
    
    --text-main: #e2e8f0;
    --text-muted: #94a3b8;
    --text-dark: #0f172a;
    
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'Fira Code', source-code-pro, Menlo, Monaco, Consolas, monospace;
    
    --shadow-premium: 0 10px 30px -10px rgba(0, 0, 0, 0.5), 0 1px 1px rgba(255, 255, 255, 0.05) inset;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: var(--font-sans);
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* App Container Layout */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
}

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

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

.header-logo h1 {
    font-size: 1.25rem;
    font-weight: 700;
    background: linear-gradient(135deg, #a5b4fc 0%, #6366f1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-logo .icon-shield {
    font-size: 1.5rem;
    animation: float 3s ease-in-out infinite;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.lab-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(0, 0, 0, 0.3);
    padding: 0.4rem 0.8rem;
    border-radius: 9999px;
    font-size: 0.85rem;
    border: 1px solid var(--border-color);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.success {
    background-color: var(--color-success);
    box-shadow: 0 0 8px var(--color-success);
}

.status-dot.warning {
    background-color: var(--color-warning);
    box-shadow: 0 0 8px var(--color-warning);
}

.status-dot.danger {
    background-color: var(--color-danger);
    box-shadow: 0 0 8px var(--color-danger);
}

/* Buttons */
.btn {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
}

.btn-primary:disabled {
    background: #334155;
    color: #64748b;
    box-shadow: none;
    cursor: not-allowed;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}

.btn-close:hover {
    color: white;
}

/* Main Grid Layout */
.app-main {
    display: grid;
    grid-template-columns: 1fr 480px;
    height: calc(100vh - 65px);
    flex-grow: 1;
    overflow: hidden;
}

/* Workspace (Left Panel) */
.workspace-panel {
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
    background: radial-gradient(circle at 10% 20%, rgba(15, 23, 42, 0.6) 0%, rgba(9, 13, 26, 0.8) 90%);
    overflow: hidden;
    position: relative;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: rgba(15, 23, 42, 0.3);
    border-bottom: 1px solid var(--border-color);
}

.panel-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
}

.simulation-controls {
    display: flex;
    gap: 0.75rem;
}

.btn-sim {
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    background: rgba(99, 102, 241, 0.1);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.3);
    transition: var(--transition-smooth);
}

.btn-sim:hover {
    background: rgba(99, 102, 241, 0.25);
    border-color: #6366f1;
}

.btn-sim.attack {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.3);
}

.btn-sim.attack:hover {
    background: rgba(239, 68, 68, 0.3);
    border-color: #ef4444;
}

.topology-container {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    overflow: auto;
}

/* SVG Topology Interactive styles */
#network-topology {
    max-width: 900px;
    max-height: 650px;
    user-select: none;
}

.node {
    cursor: pointer;
    transition: var(--transition-smooth);
}

.node:hover {
    filter: drop-shadow(0 0 8px rgba(99, 102, 241, 0.6));
}

.node.active-switch {
    filter: drop-shadow(0 0 12px rgba(99, 102, 241, 0.9));
}

.node.active-switch use {
    stroke: var(--color-primary);
    stroke-width: 2.5px;
}

.node-label {
    fill: var(--text-main);
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 600;
    text-anchor: middle;
}

.node-ip {
    fill: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 11px;
    text-anchor: middle;
}

.text-attacker {
    fill: #fca5a5;
}

.port-label {
    fill: var(--text-muted);
    font-family: var(--font-sans);
    font-size: 10px;
    font-weight: 500;
}

.port-led {
    stroke: #090d1a;
    stroke-width: 1px;
    box-shadow: 0 0 4px currentColor;
}

.port-led.up {
    fill: var(--color-success);
}

.port-led.blocked {
    fill: var(--color-danger);
    animation: blink 0.8s infinite alternate;
}

/* VLAN overlays */
.vlan-bg {
    fill: opacity 0.05;
    stroke-dasharray: 4, 4;
    pointer-events: none;
    transition: var(--transition-smooth);
}

.vlan-10 {
    fill: rgba(234, 179, 8, 0.03);
    stroke: rgba(234, 179, 8, 0.25);
    stroke-width: 1.5px;
}

.vlan-20 {
    fill: rgba(236, 72, 153, 0.03);
    stroke: rgba(236, 72, 153, 0.25);
    stroke-width: 1.5px;
}

/* Inspection Panel */
.inspect-panel {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(17, 24, 39, 0.85);
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 40;
}

.inspect-panel.open {
    transform: translateY(0);
}

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

.inspect-header h3 {
    font-size: 1rem;
    color: #a5b4fc;
    font-weight: 600;
}

.inspect-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.table-scroll {
    max-height: 180px;
    overflow-y: auto;
    margin-top: 0.5rem;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    font-family: var(--font-sans);
}

.data-table th, .data-table td {
    padding: 0.5rem 0.75rem;
    text-align: left;
}

.data-table th {
    background: rgba(0, 0, 0, 0.4);
    color: var(--text-main);
    font-weight: 600;
    position: sticky;
    top: 0;
}

.data-table tr {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.data-table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.hidden {
    display: none;
}

/* Sidebar Panel (Right Panel) */
.sidebar-panel {
    display: flex;
    flex-direction: column;
    background: var(--bg-panel);
    backdrop-filter: blur(8px);
    overflow: hidden;
}

/* Tabs Navigation */
.tabs-header {
    display: flex;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--border-color);
}

.tab-btn {
    flex: 1;
    padding: 1rem 0.5rem;
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 0.85rem;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: var(--transition-smooth);
}

.tab-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.02);
}

.tab-btn.active {
    color: #818cf8;
    border-bottom-color: #6366f1;
    background: rgba(99, 102, 241, 0.05);
}

/* Tab Content Areas */
.tab-contents {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 1.5rem;
    position: relative;
}

.tab-content {
    display: none;
    flex-direction: column;
    height: 100%;
}

.tab-content.active {
    display: flex;
}

/* Learning Guide Steps Styles */
.guide-steps-progress {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.progress-bar-bg {
    flex-grow: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar-fill {
    width: 20%;
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #a5b4fc);
    border-radius: 3px;
    transition: width 0.4s ease;
}

.progress-percent {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
    white-space: nowrap;
}

.step-card {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.25rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    overflow-y: auto;
}

#step-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #a5b4fc;
}

#step-description {
    font-size: 0.95rem;
    color: var(--text-main);
    line-height: 1.6;
}

#step-description p {
    margin-bottom: 0.75rem;
}

.alert {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 1rem 0;
}

.alert-info {
    background: rgba(99, 102, 241, 0.1);
    border-left: 4px solid var(--color-primary);
    color: #c7d2fe;
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border-left: 4px solid var(--color-warning);
    color: #fde68a;
}

.step-checklists h4 {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.checklist-items {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.checklist-items li {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-main);
    line-height: 1.4;
}

.checklist-items input[type="checkbox"] {
    margin-top: 0.2rem;
    accent-color: var(--color-primary);
    pointer-events: none; /* read-only status checks */
}

.checklist-items li.completed {
    color: var(--text-muted);
    text-decoration: line-through;
    opacity: 0.75;
}

.navigation-controls {
    display: flex;
    justify-content: space-between;
    margin-top: 1.5rem;
}

/* Cisco Terminal CLI styling */
.cli-selector-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
}

.cli-select {
    flex-grow: 1;
    background: #1e293b;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    font-family: var(--font-sans);
    cursor: pointer;
    font-weight: 600;
}

.cli-select:focus {
    outline: none;
    border-color: var(--color-primary);
}

.terminal-container {
    flex-grow: 1;
    background-color: var(--bg-terminal);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 1.5;
    color: #22c55e; /* Green phosphor look */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.8);
}

.terminal-body {
    flex-grow: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    justify-content: flex-end;
}

.terminal-output {
    white-space: pre-wrap;
    word-break: break-all;
    overflow-y: auto;
    max-height: 100%;
}

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

.terminal-prompt {
    color: #e2e8f0;
    white-space: nowrap;
}

#terminal-input {
    background: none;
    border: none;
    outline: none;
    color: #22c55e;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    flex-grow: 1;
    caret-color: #22c55e;
}

.terminal-tips {
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Syslog Monitor & Snooping DB */
.monitor-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.monitor-section h3 {
    font-size: 0.95rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #a5b4fc;
}

.table-scroll-mini {
    max-height: 160px;
    overflow-y: auto;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.data-table-mini {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    background: rgba(0,0,0,0.2);
}

.data-table-mini th, .data-table-mini td {
    padding: 0.4rem 0.6rem;
    text-align: left;
}

.data-table-mini th {
    background: rgba(0, 0, 0, 0.4);
    color: var(--text-muted);
    font-weight: 600;
}

.data-table-mini tr {
    border-bottom: 1px solid rgba(255,255,255,0.03);
}

.empty-state {
    color: var(--text-muted);
    text-align: center;
    font-style: italic;
    padding: 1.5rem !important;
}

.syslog-console {
    background: var(--bg-terminal);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.75rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: #f1f5f9;
    height: 180px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.syslog-line {
    word-break: break-all;
}

.syslog-line.system {
    color: #64748b;
}

.syslog-line.error {
    color: #ef4444;
}

.syslog-line.success {
    color: #10b981;
}

.syslog-line.warning {
    color: #f59e0b;
}

/* Animations for Packet Simulation */
.packet {
    filter: drop-shadow(0 0 6px currentColor);
}

/* Keyframes */
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

@keyframes blink {
    to { opacity: 0.3; }
}

/* Custom scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}
