/* 459.network VM Manager – Dark Cyber Theme */

:root {
    --bg: #05060a;
    --panel: #0f111b;
    --panel-border: #1f2335;
    --text-primary: #e2e8f0;
    --text-muted: #94a3b8;
    --accent-blue: #38bdf8;
    --accent-blue-bright: #60a5fa;
    --accent-magenta: #ff2dd1;
    --accent-cyan: #06b6d4;
    --accent-amber: #f97316;
    --accent-red: #f43f5e;
}

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

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: radial-gradient(circle at top, rgba(56, 189, 248, 0.12), transparent 45%), var(--bg);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.4;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 16px 40px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.home-body {
    background: radial-gradient(circle at 10% 20%, rgba(103, 232, 249, 0.12), transparent 45%), radial-gradient(circle at 80% 0%, rgba(248, 113, 113, 0.12), transparent 35%), var(--bg);
}

.home-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 32px 20px 40px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.home-hero {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid #1f2335;
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: 0 15px 50px rgba(15, 23, 42, 0.55);
}

.hero-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.hero-right {
    display: flex;
    align-items: center;
}

.home-hero h1 {
    font-size: 1.6rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    line-height: 1.2;
}

.tagline {
    color: var(--text-muted);
    font-size: 0.9rem;
    max-width: 520px;
}

.hero-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--accent-blue);
    background: rgba(56, 189, 248, 0.1);
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid rgba(56, 189, 248, 0.3);
}

.indicator-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent-blue);
    box-shadow: 0 0 10px rgba(96, 165, 250, 0.9);
    animation: indicatorPulse 3s ease-in-out infinite;
}

.service-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
}

.service-card {
    padding: 20px;
    border-radius: 16px;
    text-decoration: none;
    color: var(--text-primary);
    border: 1px solid #1f2335;
    background: linear-gradient(145deg, rgba(15, 23, 42, 0.85), rgba(9, 9, 18, 0.9));
    box-shadow: 0 15px 30px rgba(2, 6, 23, 0.65);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.service-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 25px 45px rgba(59, 130, 246, 0.25);
}

.service-card__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.service-card h2 {
    font-size: 1.2rem;
    letter-spacing: 0.08em;
}

.service-status {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.service-description {
    font-size: 0.9rem;
    color: #cbd5f5;
}

.service-meta {
    font-size: 0.78rem;
    color: var(--text-muted);
    letter-spacing: 0.08em;
}

.accent-primary {
    border-color: rgba(96, 165, 250, 0.4);
}

.accent-cyan {
    border-color: rgba(45, 212, 191, 0.4);
}

.accent-magenta {
    border-color: rgba(255, 45, 209, 0.35);
}

.accent-violet {
    border-color: rgba(192, 132, 252, 0.45);
}

.accent-amber {
    border-color: rgba(249, 115, 22, 0.45);
}

.service-card.status-online {
    box-shadow: 0 20px 30px rgba(94, 234, 212, 0.2);
}

.service-card.status-maintenance {
    opacity: 0.8;
}

.service-card.status-maintenance .service-status {
    color: var(--accent-amber);
    border-color: rgba(249, 115, 22, 0.5);
}

.service-card.status-online .service-status {
    color: var(--accent-blue);
    border-color: rgba(96, 165, 250, 0.5);
}

.home-footer {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.home-footer a {
    color: var(--accent-blue);
    text-decoration: none;
}

.home-footer a:hover {
    text-decoration: underline;
}

.port-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 12px 0;
}

.port-badge {
    font-family: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 6px;
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.3);
}

.service-actions {
    margin-top: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.btn-link {
    background: rgba(56, 189, 248, 0.08);
    border: 1px solid rgba(56, 189, 248, 0.4);
    color: #e0f2ff;
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.btn-link:hover {
    border-color: var(--accent-blue);
    background: rgba(56, 189, 248, 0.18);
    color: #ffffff;
}

.service-action-buttons {
    display: flex;
    gap: 6px;
}

.service-status-note {
    margin-top: 8px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.service-card.status-running .service-status-chip {
    color: #10b981;
    border-color: rgba(16, 185, 129, 0.5);
}

.service-card.status-stopped .service-status-chip {
    color: var(--accent-red);
    border-color: rgba(244, 63, 94, 0.4);
}

.service-card.status-pending .service-status-chip {
    color: var(--accent-amber);
    border-color: rgba(249, 115, 22, 0.4);
}

.service-card.status-error .service-status-chip {
    color: #facc15;
    border-color: rgba(250, 204, 21, 0.4);
}

.service-card.status-unknown .service-status-chip {
    color: var(--text-muted);
    border-color: rgba(148, 163, 184, 0.3);
}

.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: rgba(15, 17, 27, 0.95);
    color: #e2e8f0;
    padding: 12px 18px;
    border-radius: 10px;
    border: 1px solid rgba(56, 189, 248, 0.25);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.45);
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 2500;
}

.toast.visible {
    opacity: 1;
    transform: translateY(0);
}

.toast.success {
    border-color: rgba(16, 185, 129, 0.4);
}

.toast.error {
    border-color: rgba(244, 63, 94, 0.4);
}

.toast.info {
    border-color: rgba(59, 130, 246, 0.4);
}

.header {
    background: rgba(15, 17, 27, 0.9);
    border: 1px solid #1d2132;
    border-radius: 12px;
    padding: 12px 16px;
    box-shadow: 0 0 30px rgba(15, 23, 42, 0.45);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.home-link {
    background: linear-gradient(135deg, #1f6feb 0%, #1158c7 100%);
    color: white;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 8px rgba(31, 111, 235, 0.3);
    transition: all 0.2s ease;
}

.home-link:hover {
    background: linear-gradient(135deg, #1158c7 0%, #0d419d 100%);
    box-shadow: 0 4px 12px rgba(31, 111, 235, 0.4);
    transform: translateY(-1px);
}

.home-link svg {
    flex-shrink: 0;
}

.system-stats {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.stat-item {
    background: #15182a;
    border: 1px solid #1f2335;
    border-radius: 6px;
    padding: 6px 12px;
    box-shadow: inset 0 0 10px rgba(15, 23, 42, 0.35);
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 120px;
}

.stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    white-space: nowrap;
}

.stat-value {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent-cyan);
}

.vm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 12px;
}

.vm-card {
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 14px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: border 0.3s ease, box-shadow 0.3s ease;
    position: relative;
}

.vm-card.running {
    border-color: var(--accent-blue);
    box-shadow: 0 0 14px rgba(96, 165, 250, 0.45);
    animation: runningGlow 4s ease-in-out infinite;
}

.vm-card.stopped {
    border-color: #151727;
    box-shadow: 0 0 10px rgba(5, 6, 10, 0.9);
}

@keyframes runningGlow {
    0% {
        box-shadow: 0 0 10px rgba(96, 165, 250, 0.25);
    }
    50% {
        box-shadow: 0 0 18px rgba(96, 165, 250, 0.6);
    }
    100% {
        box-shadow: 0 0 10px rgba(96, 165, 250, 0.25);
    }
}

.vm-card__header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.vm-title {
    display: flex;
    gap: 10px;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-top: 3px;
}

.status-indicator.running {
    background: var(--accent-blue-bright);
    box-shadow: 0 0 10px rgba(96, 165, 250, 0.8);
    animation: indicatorPulse 3.2s ease-in-out infinite;
}

.status-indicator.stopped {
    background: var(--accent-magenta);
    box-shadow: 0 0 16px rgba(255, 45, 209, 0.95);
}

.status-indicator.undefined {
    background: #475569;
}

@keyframes indicatorPulse {
    0% { opacity: 0.65; }
    50% { opacity: 1; }
    100% { opacity: 0.65; }
}

.vm-name {
    font-size: 1rem;
    font-weight: 600;
    color: #f8fafc;
}

.vm-description {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.vm-state-chip {
    font-size: 0.95rem;
    font-weight: 700;
    padding: 6px 18px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    display: inline-flex;
    align-items: center;
    line-height: 1;
}

.vm-state-chip.running {
    background: rgba(56, 189, 248, 0.25);
    color: #e0f2ff;
}

.vm-state-chip.stopped {
    background: rgba(24, 26, 43, 0.85);
    color: var(--accent-magenta);
}

.vm-card__body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.metrics-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.metric-block {
    border: 1px solid #1f2335;
    border-radius: 10px;
    padding: 8px;
    background: #111425;
    box-shadow: inset 0 0 12px rgba(15, 23, 42, 0.4);
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.metric-block h4 {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.metric-pair {
    display: grid;
    grid-template-columns: auto auto;
    justify-content: space-between;
    column-gap: 4px;
    font-size: 0.8rem;
}

.metric-pair span {
    color: var(--text-muted);
    letter-spacing: 0.06em;
}

.metric-pair strong {
    color: var(--text-primary);
}

.vm-card.stopped .vm-name,
.vm-card.stopped .metric-pair strong,
.vm-card.stopped .service-name,
.vm-card.stopped .access-value {
    color: #9ea7c6;
}

.vm-card.stopped .vm-description,
.vm-card.stopped .metric-pair span,
.vm-card.stopped .metric-subtext,
.vm-card.stopped .guest-port {
    color: #6b728e;
}

.disk-usage-bar {
    width: 100%;
    height: 4px;
    background: #1f2335;
    border-radius: 999px;
    overflow: hidden;
    margin-top: 4px;
}

.disk-usage-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-blue), #7c3aed);
    border-radius: 999px;
    transition: width 0.3s ease;
}

.disk-usage-fill.high {
    background: linear-gradient(90deg, var(--accent-amber), #fb7185);
}

.disk-usage-fill.critical {
    background: linear-gradient(90deg, var(--accent-red), #be123c);
}

.metric-subtext {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.access-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 4px;
}

.access-line {
    display: flex;
    justify-content: space-between;
    font-size: 0.78rem;
}

.access-label {
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.access-value {
    font-family: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;
    color: var(--accent-cyan);
}

.service-ports {
    border-top: 1px dashed #23263a;
    padding-top: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 110px;
    overflow-y: auto;
}

.service-row {
    display: flex;
    justify-content: space-between;
    gap: 6px;
    font-size: 0.76rem;
}

.service-name {
    color: var(--text-primary);
    font-weight: 600;
}

.service-target {
    display: flex;
    gap: 6px;
    align-items: center;
}

.service-link {
    color: var(--accent-blue);
    text-decoration: none;
    font-weight: 600;
}

.service-link:hover {
    text-shadow: 0 0 8px rgba(96, 165, 250, 0.8);
}

.service-text {
    color: var(--text-muted);
    font-family: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;
}

.guest-port {
    color: #c084fc;
    font-size: 0.68rem;
}

.vm-card__footer {
    border-top: 1px solid #1e2132;
    padding-top: 6px;
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.vm-controls {
    display: flex;
    gap: 6px;
}

.btn {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    color: #0b0d17;
    transition: transform 0.1s ease, box-shadow 0.2s ease;
}

.btn:active {
    transform: translateY(1px);
}

.btn-start {
    background: linear-gradient(120deg, var(--accent-blue), #14b8a6);
    box-shadow: 0 0 10px rgba(45, 212, 191, 0.4);
}

.btn-stop {
    background: linear-gradient(120deg, #fb7185, #f43f5e);
    box-shadow: 0 0 10px rgba(244, 63, 94, 0.4);
}

.btn-force-stop {
    background: linear-gradient(120deg, #a855f7, #7c3aed);
    box-shadow: 0 0 10px rgba(168, 85, 247, 0.4);
}

.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(5, 6, 10, 0.8);
    backdrop-filter: blur(6px);
    z-index: 1000;
}

.modal-content {
    background: #0f111b;
    border: 1px solid #1f2335;
    border-radius: 12px;
    max-width: 420px;
    margin: 10% auto;
    box-shadow: 0 0 25px rgba(15, 23, 42, 0.7);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid #1f2335;
}

.modal-header h2 {
    font-size: 1rem;
}

.close {
    font-size: 22px;
    cursor: pointer;
    color: var(--text-muted);
}

.modal-body {
    padding: 18px;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px;
}

.btn-primary {
    background: var(--accent-blue);
    color: #05060a;
}

.btn-secondary {
    background: var(--panel-border);
    color: var(--text-primary);
}

.loading-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(5, 6, 10, 0.85);
    color: var(--text-primary);
    text-align: center;
    padding-top: 20%;
    z-index: 2000;
}

.spinner {
    width: 44px;
    height: 44px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top: 4px solid var(--accent-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 14px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.footer {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.78rem;
    padding-top: 10px;
}

@media (max-width: 720px) {
    .home-hero {
        flex-direction: column;
        gap: 12px;
        padding: 14px 16px;
        align-items: stretch;
    }

    .home-hero h1 {
        font-size: 1.4rem;
    }

    .hero-right {
        justify-content: center;
    }

    .header-top {
        flex-direction: row;
        gap: 10px;
        align-items: center;
    }

    .header h1 {
        font-size: 1.1rem;
    }

    .system-stats {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }

    .stat-item {
        min-width: auto;
        flex-direction: column;
        text-align: center;
        gap: 2px;
    }

    .vm-grid {
        grid-template-columns: 1fr;
    }

    .metrics-row {
        grid-template-columns: 1fr;
    }

    .vm-card__header,
    .vm-card__footer {
        flex-direction: column;
        gap: 6px;
    }

    .vm-controls {
        width: 100%;
    }

    .vm-controls .btn {
        flex: 1;
    }
}
