:root {
    --bg-dark: #0f172a;
    --sidebar-bg: rgba(30, 41, 59, 0.7);
    --card-bg: rgba(51, 65, 85, 0.4);
    --accent-primary: #6366f1;
    --accent-success: #10b981;
    --accent-danger: #ef4444;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --glass-border: rgba(255, 255, 255, 0.1);
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--bg-dark);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
    background-image: 
        radial-gradient(circle at 0% 0%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 100% 100%, rgba(16, 185, 129, 0.1) 0%, transparent 50%);
}

.glass-container {
    display: flex;
    height: 100vh;
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
}

/* Sidebar Styling */
.sidebar {
    width: 300px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: var(--text-main);
}

.logo-icon {
    color: var(--accent-primary);
    filter: drop-shadow(0 0 8px rgba(99, 102, 241, 0.5));
}

.vm-list-container {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.list-section {
    margin-bottom: 24px;
}

.section-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-left: 12px;
    display: block;
    margin-bottom: 12px;
}

#vm-list {
    list-style: none;
}

.vm-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 4px;
}

.vm-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.vm-item.active {
    background: rgba(99, 102, 241, 0.2);
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.vm-icon {
    width: 40px;
    height: 40px;
    padding: 8px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.2);
}

.vm-icon.ubuntu { color: #E95420; }
.vm-icon.windows { color: #00A4EF; }
.vm-icon.kali { color: #268BD2; }

.vm-info {
    display: flex;
    flex-direction: column;
}

.vm-name {
    font-size: 0.9rem;
    font-weight: 500;
}

.vm-status {
    font-size: 0.75rem;
}

.vm-status.running { color: var(--accent-success); }
.vm-status.powered-off { color: var(--text-muted); }
.vm-status.saved { color: #fbbf24; }

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--glass-border);
}

.host-stats {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stat-item {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.stat-bar {
    height: 4px;
    background: rgba(0,0,0,0.3);
    border-radius: 2px;
    margin-top: 4px;
    overflow: hidden;
}

.progress {
    height: 100%;
    background: var(--accent-primary);
    border-radius: 2px;
}

/* Main Content Styling */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: rgba(15, 23, 42, 0.3);
}

.toolbar {
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--glass-border);
}

.vm-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.action-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    background: var(--card-bg);
    color: var(--text-main);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.action-button:hover {
    background: rgba(255,255,255,0.1);
    transform: translateY(-1px);
}

.action-button.primary {
    background: var(--accent-primary);
    border: none;
}

.action-button.primary:hover {
    background: #4f46e5;
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.4);
}

.action-button.danger:hover {
    background: var(--accent-danger);
    border: none;
}

.divider {
    width: 1px;
    height: 24px;
    background: var(--glass-border);
    margin: 0 8px;
}

.icon-button {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s;
}

.icon-button:hover {
    color: var(--text-main);
    background: rgba(255,255,255,0.05);
}

/* Details Panel */
.details-panel {
    padding: 40px;
    overflow-y: auto;
    flex: 1;
}

.details-header {
    display: flex;
    gap: 32px;
    margin-bottom: 48px;
}

.vm-preview {
    position: relative;
    width: 320px;
    height: 200px;
    border-radius: 16px;
    overflow: hidden;
    border: 2px solid var(--glass-border);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
    cursor: pointer;
}

.vm-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    opacity: 0;
    transition: opacity 0.3s;
}

.vm-preview:hover .preview-overlay {
    opacity: 1;
}

.vm-summary h1 {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -0.05em;
    margin-bottom: 12px;
}

.vm-desc {
    color: var(--text-muted);
    font-size: 1.1rem;
    max-width: 600px;
    line-height: 1.6;
    margin-bottom: 20px;
}

.tags {
    display: flex;
    gap: 8px;
}

.tag.accent {
    background: rgba(99, 102, 241, 0.2);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.badge {
    font-size: 0.6rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
    text-transform: uppercase;
}

.badge.high-speed {
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    color: white;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
}

.vm-status-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

.detail-card {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    padding: 24px;
    border-radius: 20px;
}

.detail-card h3 {
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--accent-primary);
}

.detail-card ul {
    list-style: none;
}

.detail-card li {
    margin-bottom: 12px;
    font-size: 0.9rem;
    display: flex;
    justify-content: space-between;
}

.card-actions {
    margin-top: 16px;
    display: flex;
    gap: 8px;
    border-top: 1px solid var(--glass-border);
    padding-top: 16px;
}

.small-button {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px;
    font-size: 0.7rem;
    font-weight: 600;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.2s;
}

.small-button:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: var(--accent-primary);
}

.small-button i {
    width: 14px;
    height: 14px;
}

/* Session Overlay */
#vm-session-overlay {
    position: fixed;
    inset: 0;
    background: #000;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

#vm-session-overlay.hidden {
    display: none;
}

.session-header {
    height: 48px;
    background: #1e293b;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
}

.session-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

.session-controls {
    display: flex;
    gap: 4px;
}

.session-controls button {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 6px;
    cursor: pointer;
    border-radius: 4px;
}

.session-controls button:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

.canvas-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    position: relative;
}

#vm-canvas, #vm-video, #vm-iframe {
    max-width: 100%;
    max-height: 100%;
    box-shadow: 0 0 50px rgba(0,0,0,0.5);
    background: #111;
}

#vm-video, #vm-iframe {
    display: none; /* デフォルトは非表示 */
}

#vm-video.active, #vm-iframe.active {
    display: block;
    width: 100%;
    height: 100%;
}

.session-footer {
    height: 32px;
    background: #0f172a;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.indicators {
    display: flex;
    gap: 12px;
}

.indicator {
    width: 14px;
    opacity: 0.3;
}

.indicator.active {
    color: var(--accent-success);
    opacity: 1;
}

/* Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255,255,255,0.1);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

#boot-loader {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#boot-loader.hidden {
    display: none;
}

/* Modals */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal.hidden { display: none; }

.modal-content {
    width: 500px;
    background: var(--bg-dark);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 32px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.form-group input, .form-group select {
    width: 100%;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 12px;
    color: #fff;
    font-family: inherit;
}

.wizard-steps {
    display: flex;
    gap: 12px;
    margin-top: 32px;
}

.step {
    flex: 1;
    font-size: 0.7rem;
    padding: 8px;
    text-align: center;
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
    color: var(--text-muted);
}

.step.active {
    background: var(--accent-primary);
    color: #fff;
}

.modal-footer {
    margin-top: 40px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.btn-primary {
    background: var(--accent-primary);
    color: #fff;
    border: none;
    padding: 10px 24px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
}

.btn-secondary {
    background: transparent;
    color: var(--text-main);
    border: 1px solid var(--glass-border);
    padding: 10px 24px;
    border-radius: 10px;
    cursor: pointer;
}
