/* Base Styles and Variables */
:root {
    --bg-primary: #0f1520;
    --bg-secondary: #1b2536;
    --bg-tertiary: #232f42;
    --text-primary: #e6edf3;
    --text-secondary: #a3b9cc;
    --accent-blue: #3371e3;
    --accent-cyan: #00c2b2;
    --accent-purple: #746bde;
    --accent-green: #2ebb98;
    --accent-red: #e84855;
    --accent-yellow: #f2c94c;
    --glow-blue: rgba(51, 113, 227, 0.4);
    --glow-cyan: rgba(0, 194, 178, 0.4);
    --glow-green: rgba(46, 187, 152, 0.4);
    --glow-red: rgba(232, 72, 85, 0.4);
    --border-radius: 6px;
    --transition-speed: 0.3s;
    --box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

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

body {
    font-family: 'Inter', 'Roboto', 'Helvetica Neue', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Container Layout */
.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* Typography */
h1, h2, h3, h4 {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

h1 {
    font-size: 2rem;
    color: var(--accent-blue);
}

h3 {
    font-size: 1.2rem;
    color: var(--text-primary);
}

h4 {
    font-size: 1rem;
    color: var(--text-primary);
}

.subtitle {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 2rem;
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin-bottom: 1rem;
}

.back-btn {
    position: absolute;
    left: 0;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--accent-blue);
    border-radius: var(--border-radius);
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all var(--transition-speed);
    box-shadow: 0 0 8px var(--glow-blue);
}

.back-btn:hover {
    background-color: var(--accent-blue);
    box-shadow: 0 0 12px var(--glow-blue);
}

/* Simulation Layout */
.simulation-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

@media (min-width: 992px) {
    .simulation-container {
        flex-direction: row;
    }
}

/* Control Panel */
.control-panel {
    background-color: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 1.25rem;
    box-shadow: var(--box-shadow);
    flex: 0 0 100%;
}

@media (min-width: 992px) {
    .control-panel {
        flex: 0 0 25%;
    }
}

.control-group {
    margin-bottom: 1.5rem;
}

.control-group h3 {
    margin-bottom: 1rem;
    color: var(--accent-cyan);
    border-bottom: 1px solid var(--bg-tertiary);
    padding-bottom: 0.5rem;
}

/* Buttons */
.action-btn {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    margin-bottom: 0.75rem;
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--accent-blue);
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all var(--transition-speed);
    box-shadow: 0 0 8px var(--glow-blue);
}

.action-btn:hover {
    background-color: var(--accent-blue);
    box-shadow: 0 0 12px var(--glow-blue);
}

.action-btn.reset {
    border-color: var(--accent-red);
    box-shadow: 0 0 8px var(--glow-red);
}

.action-btn.reset:hover {
    background-color: var(--accent-red);
    box-shadow: 0 0 12px var(--glow-red);
}

/* Simulation View */
.simulation-view {
    flex: 1;
    background-color: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 1.25rem;
    box-shadow: var(--box-shadow);
    min-height: 500px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .simulation-view {
        flex-direction: row;
    }
}

/* Node Container */
.node-container {
    flex: 3;
    display: flex;
    flex-direction: column;
}

.node {
    background-color: var(--bg-tertiary);
    border-radius: var(--border-radius);
    padding: 1.25rem;
    box-shadow: var(--box-shadow);
    height: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    border: 1px solid var(--accent-green);
    box-shadow: 0 0 15px var(--glow-green);
}

.node-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--bg-secondary);
}

.status-indicator {
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
}

.status-indicator.ready {
    background-color: var(--accent-green);
    color: var(--bg-primary);
}

.status-indicator.warning {
    background-color: var(--accent-yellow);
    color: var(--bg-primary);
}

.status-indicator.error {
    background-color: var(--accent-red);
    color: var(--bg-primary);
}

/* Components */
.component {
    background-color: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 1rem;
    position: relative;
}

.kubelet {
    border: 1px solid var(--accent-blue);
    box-shadow: 0 0 15px var(--glow-blue);
}

.container-runtime {
    border: 1px solid var(--accent-purple);
    box-shadow: 0 0 15px rgba(116, 107, 222, 0.4);
    flex: 1;
}

.api-server {
    border: 1px solid var(--accent-cyan);
    box-shadow: 0 0 15px var(--glow-cyan);
    margin-bottom: 1rem;
}

.volume-storage {
    border: 1px solid var(--accent-yellow);
    box-shadow: 0 0 15px rgba(242, 201, 76, 0.4);
}

/* Status Logs */
.status-logs {
    margin-top: 0.75rem;
    max-height: 100px;
    overflow-y: auto;
    font-family: monospace;
    font-size: 0.85rem;
}

.log {
    padding: 0.25rem 0;
    border-bottom: 1px dashed var(--bg-tertiary);
}

/* Containers Area */
.containers-area {
    margin-top: 1rem;
    min-height: 150px;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.container-item {
    background-color: var(--bg-tertiary);
    padding: 0.5rem;
    border-radius: var(--border-radius);
    font-size: 0.85rem;
    width: calc(50% - 0.75rem);
    border: 1px solid var(--accent-purple);
    position: relative;
    opacity: 0;
    transform: translateY(10px);
    animation: fadeIn 0.5s forwards;
}

/* Kube Components */
.kube-components {
    flex: 2;
    display: flex;
    flex-direction: column;
}

.pod-objects {
    flex: 1;
    background-color: var(--bg-tertiary);
    border-radius: var(--border-radius);
    padding: 1rem;
    margin: 1rem 0;
    border: 1px solid var(--accent-blue);
    box-shadow: 0 0 15px var(--glow-blue);
}

.object-list {
    margin-top: 0.75rem;
    max-height: 200px;
    overflow-y: auto;
}

.pod-object {
    background-color: var(--bg-secondary);
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    border-radius: var(--border-radius);
    border-left: 3px solid var(--accent-blue);
    opacity: 0;
    transform: translateX(10px);
    animation: slideIn 0.5s forwards;
}

.pod-object h5 {
    font-size: 0.9rem;
    margin-bottom: 0.3rem;
}

.pod-object p {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.volumes-area {
    margin-top: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.volume {
    background-color: var(--bg-secondary);
    padding: 0.5rem;
    border-radius: var(--border-radius);
    font-size: 0.8rem;
    width: calc(50% - 0.5rem);
    border: 1px solid var(--accent-yellow);
    opacity: 0;
    animation: fadeIn 0.5s forwards;
}

/* Information Panel */
.information-panel {
    background-color: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 1.25rem;
    box-shadow: var(--box-shadow);
    margin: 1.5rem 0;
}

.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--bg-tertiary);
    padding-bottom: 0.5rem;
    overflow-x: auto;
}

.tab-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    transition: all var(--transition-speed);
}

.tab-btn.active {
    color: var(--accent-blue);
    border-bottom: 2px solid var(--accent-blue);
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

.event-log {
    max-height: 200px;
    overflow-y: auto;
    font-family: monospace;
    font-size: 0.9rem;
}

.event {
    padding: 0.5rem;
    border-bottom: 1px solid var(--bg-tertiary);
}

.event:nth-child(even) {
    background-color: rgba(0, 0, 0, 0.1);
}

/* Architecture Diagram */
.architecture-diagram {
    position: relative;
    height: 300px;
    margin: 1.5rem 0;
}

.component-box {
    position: absolute;
    padding: 0.75rem;
    background-color: var(--bg-tertiary);
    border-radius: var(--border-radius);
    text-align: center;
    width: 150px;
}

.api-box {
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    border: 1px solid var(--accent-cyan);
    box-shadow: 0 0 8px var(--glow-cyan);
}

.kubelet-box {
    top: 100px;
    left: 50%;
    transform: translateX(-50%);
    border: 1px solid var(--accent-blue);
    box-shadow: 0 0 8px var(--glow-blue);
}

.cri-box {
    top: 200px;
    left: 50%;
    transform: translateX(-50%);
    border: 1px solid var(--accent-purple);
    box-shadow: 0 0 8px rgba(116, 107, 222, 0.4);
}

.containers-box {
    top: 200px;
    left: 70%;
    border: 1px solid var(--accent-green);
    box-shadow: 0 0 8px var(--glow-green);
}

.volumes-box {
    top: 100px;
    left: 20%;
    border: 1px solid var(--accent-yellow);
    box-shadow: 0 0 8px rgba(242, 201, 76, 0.4);
}

.architecture-arrow {
    position: absolute;
    width: 2px;
    background-color: var(--text-secondary);
}

.architecture-arrow::before,
.architecture-arrow::after {
    content: "";
    position: absolute;
    width: 6px;
    height: 6px;
    background-color: var(--text-secondary);
    border-radius: 50%;
}

.architecture-arrow::before {
    top: -3px;
    left: -2px;
}

.architecture-arrow::after {
    bottom: -3px;
    left: -2px;
}

/* Footer */
footer {
    text-align: center;
    padding: 1.5rem 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Connection lines animation */
.connection-line {
    position: absolute;
    background-color: var(--accent-blue);
    height: 2px;
    opacity: 0;
    z-index: 10;
}

.connection-line.active {
    opacity: 1;
    animation: pulseLine 1.5s infinite;
}

@keyframes pulseLine {
    0% {
        opacity: 0.3;
        box-shadow: 0 0 3px var(--glow-blue);
    }
    50% {
        opacity: 1;
        box-shadow: 0 0 8px var(--glow-blue);
    }
    100% {
        opacity: 0.3;
        box-shadow: 0 0 3px var(--glow-blue);
    }
}

/* Mobile Responsive Adjustments */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    h1 {
        font-size: 1.5rem;
    }

    .architecture-diagram {
        height: 500px;
    }

    .component-box {
        width: 120px;
    }

    .api-box {
        top: 0;
        left: 50%;
    }

    .kubelet-box {
        top: 80px;
        left: 50%;
    }

    .cri-box {
        top: 160px;
        left: 50%;
    }

    .containers-box {
        top: 240px;
        left: 50%;
    }

    .volumes-box {
        top: 320px;
        left: 50%;
    }

    .container-item,
    .volume {
        width: 100%;
    }
}

/* Speed Control Slider */
#speedControl {
    width: 100%;
    margin: 0.5rem 0;
    -webkit-appearance: none;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    outline: none;
}

#speedControl::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent-blue);
    cursor: pointer;
    box-shadow: 0 0 5px var(--glow-blue);
}

#speedControl::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent-blue);
    cursor: pointer;
    box-shadow: 0 0 5px var(--glow-blue);
}

#speedValue {
    display: block;
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-secondary);
}