/* ===== CSS Variables ===== */
:root {
  --bg: #0d1117;
  --bg-secondary: #161b22;
  --sidebar-bg: #0d1117;
  --sidebar-active: #0449aa;
  --sidebar-hover: rgba(102, 185, 154, 0.1);
  --border: #30363d;
  --accent: #0449aa;
  --accent-hover: #056598;
  --text: #c9d1d9;
  --text-muted: #8b949e;
  --code-bg: #1e1e1e;
  --warning: #ffc107;
  --header-bg: #282A35;
  --tabs-bg: #D9EEE1;
  --tab-text: #000000;
  --tab-active: #056598;
}

:root.light {
  --bg: #ffffff;
  --bg-secondary: #f6f8fa;
  --sidebar-bg: #f5f5f5;
  --sidebar-active: #0449aa;
  --sidebar-hover: rgba(4, 170, 109, 0.1);
  --border: #d0d7de;
  --accent: #0449aa;
  --accent-hover: #056598;
  --text: #24292f;
  --text-muted: #57606a;
  --code-bg: #f6f8fa;
  --header-bg: #282A35;
  --tabs-bg: #D9EEE1;
}

/* ===== Reset & Base ===== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
}

/* ===== HEADER - TOP BAR ===== */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 20px;
  background: var(--header-bg);
  position: sticky;
  top: 0;
  z-index: 1001;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo-link {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: inherit;
  gap: 10px;
}

.logo-icon {
  height: 36px;
}

.logo-text {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
}

/* Mobile menu toggle */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  padding: 4px 8px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-link {
  color: #fff;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: 4px;
  transition: all 0.2s;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Theme Toggle */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #fff;
}

.theme-switch {
  position: relative;
  width: 40px;
  height: 22px;
}

.theme-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.theme-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #555;
  border-radius: 22px;
  transition: 0.3s;
}

.theme-slider:before {
  content: "";
  position: absolute;
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.3s;
}

input:checked + .theme-slider {
  background: var(--accent);
}

input:checked + .theme-slider:before {
  transform: translateX(18px);
}

/* ===== TABS BAR - SECOND ROW (W3Schools Style) ===== */
.tabs-bar {
  background: var(--tabs-bg);
  padding: 0 20px;
  position: sticky;
  top: 52px;
  z-index: 1000;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.tabs-bar::-webkit-scrollbar {
  display: none;
}

.tabs-container {
  display: flex;
  gap: 0;
}

.tab-btn {
  padding: 12px 20px;
  background: transparent;
  border: none;
  color: var(--tab-text);
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.tab-btn:hover {
  background: rgba(0, 0, 0, 0.08);
}

.tab-btn.active {
  background: var(--tab-active);
  color: white;
}

/* ===== MAIN LAYOUT ===== */
.main-container {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: 280px;
  min-width: 280px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  background: var(--accent);
  color: white;
}

.sidebar-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
}

.sidebar-subtitle {
  font-size: 12px;
  opacity: 0.9;
  margin-top: 4px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

/* Experiment Items */
.nav-item {
  border-bottom: 1px solid var(--border);
}

.nav-item:last-child {
  border-bottom: none;
}

.nav-item-header {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.2s;
  gap: 8px;
  flex-direction: row-reverse;
}

.nav-item-header:hover {
  background: var(--sidebar-hover);
}

.nav-item-header.active {
  background: var(--accent);
  color: white;
}

.nav-item-header.active .nav-arrow {
  color: white;
}

.nav-arrow {
  font-size: 10px;
  color: var(--text-muted);
  transition: transform 0.2s;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  cursor: pointer;
  flex-shrink: 0;
}

.nav-arrow:hover {
  background: var(--sidebar-hover);
  color: var(--accent);
}

.nav-arrow.expanded {
  transform: rotate(90deg);
}

.nav-arrow.no-sub {
  visibility: hidden;
}

.nav-item-text {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.nav-item-text:hover {
  color: var(--accent);
}

/* Sub-experiments */
.sub-nav {
  display: none;
  background: var(--bg);
  border-top: 1px solid var(--border);
  margin-left: 20px;
  border-left: 2px solid var(--border);
}

.sub-nav.expanded {
  display: block;
}

.sub-nav-item {
  display: block;
  padding: 10px 16px 10px 24px;
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.sub-nav-item.nested {
  padding-left: 40px;
  font-size: 12px;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.02);
}

.sub-nav-item.nested:hover {
  background: var(--sidebar-hover);
  color: var(--accent);
}

.sub-nav-item:last-child {
  border-bottom: none;
}

.sub-nav-item:hover {
  background: var(--sidebar-hover);
  color: var(--accent);
  border-left-color: var(--accent);
}

.sub-nav-item.active {
  background: var(--sidebar-hover);
  color: var(--accent);
  font-weight: 600;
}

/* Running indicator for C++ processes */
.sub-nav-item.running::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  background: #4CAF50;
  border-radius: 50%;
  animation: pulse-running 1.5s ease-in-out infinite;
}

@keyframes pulse-running {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7); }
  50% { opacity: 0.8; box-shadow: 0 0 0 4px rgba(76, 175, 80, 0); }
}

.sub-nav-item.running {
  padding-left: 28px;
}

/* ===== MAIN CONTENT ===== */
.content {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.content-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
}

.content-title {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}

.content-subtitle {
  color: var(--text-muted);
  font-size: 14px;
}

.content-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.action-btn.primary {
  background: var(--accent);
  color: white;
}

.action-btn.primary:hover {
  background: var(--accent-hover);
}

.action-btn.secondary {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
}

.action-btn.secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Code Display */
.code-container {
  flex: 1;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}

.code-filename {
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 14px;
  color: var(--text-muted);
}

.copy-btn-container {
  display: flex;
  align-items: center;
  gap: 0;
}

.copy-btn {
  padding: 6px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 12.5px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.copy-btn svg {
  vertical-align: middle;
}

.copy-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.copy-btn.copied {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  cursor: default;
}

.copy-with-lines-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-right: none;
  border-radius: 4px 0 0 4px;
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  max-width: 0;
  opacity: 0;
  padding: 6px 0;
  overflow: hidden;
  transition: max-width 0.1s ease, opacity 0.1s ease, padding 0.1s ease, cursor 0.1s;
}

.copy-btn-container:hover .copy-with-lines-btn.show:not(.hidden) {
  max-width: 150px;
  opacity: 1;
  padding: 6px 12px;
}

.copy-with-lines-btn.hidden {
  max-width: 0 !important;
  opacity: 0 !important;
  padding: 6px 0 !important;
}

.copy-btn-container:hover .copy-btn {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

.copy-with-lines-btn:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.output-toggle-btn {
  padding: 6px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 12.5px;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-left: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.output-toggle-btn svg {
  vertical-align: middle;
}

.output-toggle-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.code-content {
  flex: 1;
  overflow: auto;
  background: var(--code-bg);
}

.code-content pre {
  margin: 0;
  padding: 16px 24px 16px 60px;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 13px;
  line-height: 1.6;
  overflow-x: auto;
  counter-reset: line-counter;
  position: relative;
}

.code-content code {
  font-family: inherit;
  display: block;
  counter-increment: line-counter;
  min-height: 1.6em;
  line-height: 1.6;
}

.code-content code::before {
  content: counter(line-counter);
  position: absolute;
  left: 16px;
  width: 32px;
  text-align: right;
  color: var(--text-muted);
  font-size: 12px;
  padding-right: 12px;
  border-right: 1px solid var(--border);
  user-select: none;
  pointer-events: none;
}

/* ===== MEDIA DISPLAY (Images, Audio, Video) ===== */
.media-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.media-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}

.media-filename {
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 14px;
  color: var(--text);
}

.media-type-badge {
  padding: 4px 12px;
  background: var(--accent);
  color: white;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.media-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--code-bg);
  overflow: auto;
}

/* Image Display */
.media-image {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  transition: transform 0.2s;
}

.media-image:hover {
  transform: scale(1.02);
}

/* Audio Display */
.audio-content {
  flex-direction: column;
  gap: 24px;
}

.audio-icon {
  font-size: 80px;
  opacity: 0.8;
}

.media-audio {
  width: 100%;
  max-width: 500px;
  height: 50px;
}

/* Video Display */
.media-video {
  max-width: 100%;
  max-height: 70vh;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* ===== SPLIT VIEW (Code + Output) ===== */
.split-container {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.split-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.code-panel {
  flex: 1;
  min-width: 0;
}

.output-panel {
  flex: 1;
  min-width: 0;
  background: var(--bg-secondary);
}

.split-divider {
  width: 4px;
  background: var(--border);
  cursor: col-resize;
  transition: background 0.2s;
}

.split-divider:hover {
  background: var(--accent);
}

/* Output Panel Header */
.output-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}

.output-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}

.output-badge {
  padding: 4px 10px;
  background: #059862;
  color: white;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

/* C++ Console */
.cpp-console {
  flex: 1;
  width: 100%;
  font-family: 'Consolas', 'Monaco', 'Menlo', monospace;
  font-size: 13px;
  line-height: 1.5;
  background: #0c0c0c;
  color: #00ff00;
  border: none;
  padding: 16px;
  resize: none;
  outline: none;
}

.cpp-console::placeholder {
  color: #666;
}

.cpp-console:focus {
  outline: none;
}

/* Run/Stop Buttons */
.run-btn {
  background: #059862 !important;
  color: white !important;
}

.run-btn:hover {
  background: #048654 !important;
}

.stop-btn {
  background: #dc2626 !important;
  color: white !important;
}

.stop-btn:hover {
  background: #b91c1c !important;
}

/* Loading States */
.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px;
  color: var(--text-muted);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.loading-text {
  margin-top: 16px;
  font-size: 14px;
}

/* Version dropdown */
.version-select {
  padding: 6px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}

.version-select:focus {
  outline: none;
  border-color: var(--accent);
}

/* Footer */
.footer {
  padding: 12px 24px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  text-align: center;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 8px;
}

.footer-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  transition: color 0.2s;
}

.footer-link:hover {
  color: var(--accent);
}

.footer-text {
  color: var(--text-muted);
  font-size: 12px;
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  top: 52px;
  background: rgba(0, 0, 0, 0.5);
  z-index: 998;
}

.sidebar-overlay.show {
  display: block;
}

/* Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state-title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}

.empty-state-text {
  color: var(--text-muted);
  font-size: 14px;
}

/* ===== MOBILE RESPONSIVE ===== */
/* Hide mobile tabs by default on desktop */
.mobile-tabs {
  display: none;
}

@media (max-width: 768px) {
  .menu-toggle {
    display: block;
  }

  .tabs-bar {
    display: none;
  }

  .header-right .nav-link {
    display: none;
  }

  .sidebar {
    position: fixed;
    top: 52px;
    left: 0;
    bottom: 0;
    z-index: 999;
    transform: translateX(-100%);
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay {
    top: 52px;
  }

  /* Mobile tabs in sidebar */
  .mobile-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--tabs-bg);
  }

  .mobile-tabs .tab-btn {
    flex: 1;
    min-width: 80px;
    text-align: center;
    padding: 8px 12px;
    font-size: 12px;
    border-radius: 4px;
  }

  .content-header {
    padding: 16px;
  }

  .content-title {
    font-size: 22px;
  }

  .code-header {
    padding: 10px 16px;
  }

  .code-content pre {
    padding: 12px 16px;
    font-size: 12px;
  }

  .content-actions {
    flex-direction: column;
  }

  .action-btn {
    width: 100%;
    justify-content: center;
  }

  /* Mobile media styles */
  .media-header {
    padding: 10px 16px;
  }

  .media-content {
    padding: 16px;
  }

  .media-image {
    max-height: 50vh;
  }

  .media-video {
    max-height: 50vh;
  }

  .audio-icon {
    font-size: 60px;
  }

  /* Mobile split view - stack vertically */
  .split-container {
    flex-direction: column;
  }

  .split-divider {
    width: 100%;
    height: 4px;
    cursor: row-resize;
  }

  .code-panel,
  .output-panel {
    flex: none;
    height: 50%;
  }

  .cpp-console {
    font-size: 12px;
    padding: 12px;
  }
}

/* ===== TABLET RESPONSIVE ===== */
@media (max-width: 1024px) and (min-width: 769px) {
  .sidebar {
    width: 240px;
    min-width: 240px;
  }

  .content-title {
    font-size: 24px;
  }
}

/* ===== SCROLLBAR STYLING ===== */
.sidebar::-webkit-scrollbar,
.code-content::-webkit-scrollbar {
  width: 8px;
}

.sidebar::-webkit-scrollbar-track,
.code-content::-webkit-scrollbar-track {
  background: var(--bg);
}

.sidebar::-webkit-scrollbar-thumb,
.code-content::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb:hover,
.code-content::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ===== MODAL STYLES ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(4px);
}

.modal-container {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  max-width: 450px;
  width: 90%;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  animation: modalSlideIn 0.2s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

.modal-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  border-radius: 4px;
  transition: background 0.2s, color 0.2s;
}

.modal-close:hover {
  background: var(--sidebar-hover);
  color: var(--text);
}

.modal-content {
  padding: 20px;
  color: var(--text);
  max-height: 60vh;
  overflow-y: auto;
}

.modal-content p {
  margin-bottom: 16px;
  line-height: 1.5;
}

.modal-footer {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

.modal-btn {
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

.modal-btn:hover {
  background: var(--sidebar-hover);
}

.modal-btn.primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.modal-btn.primary:hover {
  background: var(--accent-hover);
}

/* Running processes list in modal */
.running-processes-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

.running-process-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.process-name {
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 13px;
  color: var(--text);
  word-break: break-all;
}

.stop-process-btn {
  padding: 6px 14px;
  background: #dc2626;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
  margin-left: 12px;
}

.stop-process-btn:hover {
  background: #b91c1c;
}

/* ===== PRINT STYLES ===== */
@media print {
  .header,
  .tabs-bar,
  .sidebar,
  .sidebar-overlay,
  .content-actions,
  .modal-overlay {
    display: none !important;
  }

  .content {
    overflow: visible;
  }

  .code-content {
    overflow: visible;
    background: white;
  }

  .code-content pre {
    white-space: pre-wrap;
    word-wrap: break-word;
  }
}

/* ===== SPLIT VIEW FOR HTML OUTPUT ===== */
.split-view-container {
  display: flex;
  flex: 1;
  overflow: hidden;
  height: 100%;
}

.split-pane {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.code-pane {
  flex: 0 0 50%;
  min-width: 300px;
}

.output-pane {
  flex: 1;
  min-width: 300px;
}

.split-resizer {
  width: 4px;
  background: var(--border);
  cursor: col-resize;
  transition: background 0.2s;
  flex-shrink: 0;
}

.split-resizer:hover {
  background: var(--accent);
}

.output-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.output-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}

.output-label {
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 14px;
  color: var(--text-muted);
}

.refresh-btn {
  padding: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.refresh-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

#outputFrame {
  flex: 1;
  width: 100%;
  height: 100%;
  border: none;
  background: white;
}

/* ===== LINK REDIRECT NOTIFICATION ===== */
.link-redirect-notif {
  position: fixed;
  top: 20px;
  right: 20px;
  background: linear-gradient(135deg, #0449aa 0%, #056598 100%);
  color: white;
  padding: 16px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 10000;
  max-width: 320px;
  opacity: 0;
  transform: translateX(300px) translateY(-15px);
  transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
}

.link-redirect-notif.show {
  opacity: 1;
  transform: translateX(0) translateY(0);
}

.notif-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.notif-icon {
  font-size: 18px;
  flex-shrink: 0;
  animation: bounce 0.6s ease-in-out infinite;
}

.notif-text {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  display: flex;
  align-items: center;
  gap: 8px;
}

.notif-progress-bar {
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 4px;
  display: flex;
  justify-content: flex-start;
}

.notif-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.8), #ffffff);
  border-radius: 2px;
  width: 100%;
  transition: width 0.05s linear;
}

@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-3px);
  }
}

@media (max-width: 768px) {
  .split-view-container {
    flex-direction: column;
  }
  
  .code-pane,
  .output-pane {
    flex: 1 !important;
    min-width: unset;
    min-height: 300px;
  }
  
  .split-resizer {
    width: 100%;
    height: 4px;
    cursor: row-resize;
  }
  
  .link-redirect-notif {
    top: 10px;
    right: 10px;
    left: 10px;
    max-width: unset;
  }
}
