@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
  /* Color Palette - Premium Dark */
  --bg-main: #0a0c10;
  --bg-sidebar: #0f1117;
  --bg-card: rgba(22, 27, 34, 0.7);
  --bg-card-hover: rgba(33, 38, 45, 0.9);

  --primary: #3b82f6;
  --primary-glow: rgba(59, 130, 246, 0.4);
  --secondary: #64748b;

  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #0ea5e9;

  --text-main: #f8fafc;
  --text-dim: #94a3b8;
  --text-muted: #64748b;

  --border-dim: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(59, 130, 246, 0.5);

  --glass-bg: rgba(15, 23, 42, 0.6);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-blur: blur(12px);

  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);

  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
}

/* Base Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: 'Outfit', sans-serif;
  background-color: var(--bg-main);
  background-image:
    radial-gradient(circle at 0% 0%, rgba(59, 130, 246, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 100% 100%, rgba(139, 92, 246, 0.05) 0%, transparent 40%);
  color: var(--text-main);
  height: 100vh;
  overflow: hidden;
}

/* App Layout */
.app-container {
  display: flex;
  height: 100vh;
  position: relative;
}

/* Sidebar Styling */
.sidebar {
  width: 320px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-dim);
  display: flex;
  flex-direction: column;
  z-index: 20;
  transition: var(--transition);
}

.sidebar-header {
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sidebar-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, #fff 0%, #94a3b8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sidebar-header h1 i {
  -webkit-text-fill-color: var(--primary);
  font-size: 1.25rem;
}

.sidebar-header .subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 500;
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 0 1rem 1rem;
}

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid var(--border-dim);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Section Styling */
.section-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.1em;
  margin: 1.5rem 0.5rem 0.75rem;
}

/* VM Card Item */
.vm-item {
  background: var(--bg-card);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 0.75rem;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.vm-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-focus);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.vm-item.selected {
  background: rgba(59, 130, 246, 0.1);
  border-color: var(--primary);
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.2);
}

.vm-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}

.vm-item-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-main);
}

.vm-item-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.75rem;
  color: var(--text-dim);
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 0.5rem;
}

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

.status-indicator.stopped {
  background-color: var(--secondary);
}

.status-indicator.error {
  background-color: var(--danger);
}

.vm-item-actions {
  position: absolute;
  right: 0.75rem;
  bottom: 0.75rem;
  display: flex;
  gap: 0.25rem;
  opacity: 0;
  transition: var(--transition);
}

.vm-item:hover .vm-item-actions {
  opacity: 1;
}

/* Buttons */
.btn {
  font-family: inherit;
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: var(--transition);
  outline: none;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 10px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover:not(:disabled) {
  background: #2563eb;
  transform: translateY(-1px);
  box-shadow: 0 6px 15px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-main);
  border-color: var(--border-dim);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-card-hover);
  border-color: var(--text-dim);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-dim);
  color: var(--text-dim);
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  padding: 0.4rem;
}

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

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  filter: grayscale(0.5);
}

.btn-icon-only {
  padding: 0.5rem;
  width: 36px;
  height: 36px;
}

/* Main Display Area */
.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  background: #161b22;
  /* 고급스럽고 일관된 다크 그레이 */
}

.top-bar {
  height: 56px;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--border-dim);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  z-index: 10;
}

.top-bar-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.top-bar-name {
  font-weight: 600;
  font-size: 1.1rem;
}

.display-container {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  padding: 2rem;
  background: #161b22;
  position: relative;
}

/* 비네팅 효과 제거 (사용자 요청에 따라 더 밝고 꽉 차게) */

.no-vm-placeholder {
  text-align: center;
  color: var(--text-muted);
}

.no-vm-placeholder i {
  font-size: 4rem;
  margin-bottom: 1.5rem;
  opacity: 0.3;
}

.no-vm-placeholder h2 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  color: var(--text-dim);
}

/* VNC Canvas Container */
.vnc-wrapper {
  background: #000;
  border-radius: 8px;
  /* 고급스러운 라운딩 */
  position: relative;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  transition: var(--transition);
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.vnc-wrapper canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  border-radius: inherit;
}

/* Bottom Control Bar (Stable Stack) */
.bottom-controls {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  border-top: 1px solid var(--border-dim);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  z-index: 15;
}

.bottom-controls:hover {
  border-color: var(--border-focus);
}

.control-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 0.5rem;
}

.control-separator {
  width: 1px;
  height: 24px;
  background: var(--border-dim);
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-sidebar);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 500px;
  box-shadow: var(--shadow-lg);
  transform: scale(0.9) translateY(20px);
  transition: var(--transition);
  overflow: hidden;
}

.modal-overlay.active .modal {
  transform: scale(1) translateY(0);
}

.modal-header {
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--border-dim);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
}

.modal-body {
  padding: 2rem;
  max-height: 70vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 1.25rem 2rem;
  background: rgba(0, 0, 0, 0.1);
  border-top: 1px solid var(--border-dim);
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
}

/* Forms */
.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
}

.form-control {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  color: var(--text-main);
  font-family: inherit;
  transition: var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.input-group {
  display: flex;
  gap: 0.5rem;
}

.input-group .form-control {
  flex: 1;
}

.input-group select {
  width: auto;
  min-width: 80px;
}

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
}

.checkbox-group input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

/* Progress Bar */
.progress-container {
  margin-top: 1rem;
}

.progress-bar {
  height: 6px;
  background: var(--border-dim);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--info));
  transition: width 0.3s ease;
}

/* Debug Console */
.debug-panel {
  position: fixed;
  bottom: 0;
  right: 0;
  left: 320px;
  height: 240px;
  background: rgba(10, 12, 16, 0.95);
  border-top: 1px solid var(--border-dim);
  z-index: 30;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: var(--transition);
}

.debug-panel.active {
  transform: translateY(0);
}

.debug-header {
  padding: 0.5rem 1.5rem;
  background: var(--bg-sidebar);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-dim);
}

.debug-content {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  font-family: 'Consolas', monospace;
  font-size: 0.8rem;
  line-height: 1.5;
}

.debug-line {
  margin-bottom: 0.25rem;
  white-space: pre-wrap;
}

.debug-line .time {
  color: var(--text-muted);
  margin-right: 0.75rem;
}

.debug-line.error {
  color: var(--danger);
}

.debug-line.warn {
  color: var(--warning);
}

.debug-line.info {
  color: var(--info);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-dim);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Transitions & Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.animate-fade {
  animation: fadeIn 0.4s ease;
}

.animate-slide {
  animation: slideUp 0.4s ease;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
  .sidebar {
    width: 260px;
  }

  .debug-panel {
    left: 260px;
  }
}

/* QEMU Mode indicator */
.qemu-badge {
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.qemu-badge.server {
  background: rgba(59, 130, 246, 0.15);
  color: var(--primary);
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.qemu-badge.host {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

/* File Item */
.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.75rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-sm);
  margin-bottom: 0.4rem;
  font-size: 0.8rem;
  transition: var(--transition);
}

.file-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.file-name {
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}