/* Modern Editor CSS - Enhanced & Fully Responsive */
:root {
  --bg-main: radial-gradient(circle at top, #1e1b4b 0%, #020617 70%);
  --card-bg: rgba(15, 23, 42, 0.9);
  --bg-dark: #0b1220;
  --bg-darker: #0f0f17;
  --bg-darkest: #020617;
  --panel: #0b1220;
  --border: rgba(255, 255, 255, 0.08);
  --text-main: #e5e7eb;
  --text: #e5e7eb;
  --text-primary: #f1f1f1;
  --text-secondary: #a0a0a0;
  --text-light: #cbd5e1;
  --text-muted: #94a3b8;
  --primary-color: #6c5ce7;
  --secondary: #00cec9;
  --secondary-color: #00cec9;
  --accent: #22c55e;
  --accent-blue: #38bdf8;
  --accent-light: #4ade80;
  --success: #00b894;
  --warning: #fdcb6e;
  --danger: #ff7675;
  --border-radius: 16px;
  --radius: 14px;
  --shadow-sm: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 10px 15px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 15px 25px rgba(0, 0, 0, 0.1);
  --shadow: 0 20px 40px rgba(0, 0, 0, 0.45);
  --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  --transition-fast: 0.15s ease;
  --transition-medium: 0.3s ease;
  --scrollbar: rgba(255, 255, 255, 0.2);
  --scrollbar-hover: rgba(255, 255, 255, 0.3);
  --font-mono: 'Cascadia Code', Consolas, Monaco, monospace;
  --font-ui: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --sidebar-bg: #0a0e1a;
}

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

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #6c5ce7, #00cec9);
  border-radius: 10px;
  transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #5f4fd1, #00b5a8);
}

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

body {
  font-family: 'Inter', var(--font-ui);
  background: var(--bg-main);
  color: var(--text-main);
  height: 100vh;
  line-height: 1.6;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Settings Toggle */
.settings {
  width: 280px;
  background: #1a1d23;
  padding: 15px;
  border-radius: 8px;
  color: #ccc;
}

.setting {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.switch {
  position: relative;
  width: 42px;
  height: 22px;
}

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

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

.slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 2px;
  top: 2px;
  background-color: white;
  border-radius: 50%;
  transition: 0.3s;
}

input:checked+.slider {
  background-color: #00c853;
}

input:checked+.slider::before {
  transform: translateX(20px);
}

/* Enhanced Heading Styles */
.editor-heading {
  text-align: center;
  padding: 20px 15px 10px;
  flex-shrink: 0;
  animation: fadeInDown 0.8s ease-out;
}

/* Header - Desktop App Style */
.header {
  background: var(--bg-darker);
  padding: 0 26px;
  height: 48px;
  display: flex;
  align-items: center;
  flex-direction: column;
  border-bottom: 1px solid var(--border);
  -webkit-app-region: drag;
  justify-content: center;
  padding: 40px;
  flex-shrink: 0;
}

.menu-bar {
  display: flex;
  gap: 4px;
}

.menu-item {
  background: none;
  border: none;
  color: var(--text);
  font-size: 14px;
  padding: 8px 12px;
  cursor: pointer;
  border-radius: 4px;
  transition: background var(--transition-fast);
}

.menu-item:hover {
  background: rgba(255, 255, 255, 0.1);
}

.header-controls {
  display: flex;
  gap: 8px;
  -webkit-app-region: no-drag;
}

.header-btn {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  border: none;
  border-radius: 4px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background var(--transition-fast);
}

.header-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

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

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

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }

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

.editor-heading h2 {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-weight: 800;
  line-height: 1.2;
}

.gradient-text {
  font-size: clamp(1.5rem, 4vw, 2rem);
  background: linear-gradient(135deg, #6c5ce7, #00cec9, #a29bfe);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  position: relative;
  padding-bottom: 10px;
  animation: gradientShift 5s ease infinite;
  transition: transform 0.3s ease, filter 0.3s ease;
}

@keyframes gradientShift {

  0%,
  100% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }
}

.gradient-text:hover {
  transform: translateY(-3px) scale(1.02);
  filter: drop-shadow(0 10px 25px rgba(108, 92, 231, 0.4));
}

.gradient-text::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 4px;
  background: linear-gradient(90deg, #6c5ce7, #00cec9);
  border-radius: 2px;
  transition: width 0.4s ease, height 0.4s ease;
}

.editor-heading h2:hover .gradient-text::after {
  width: 120px;
  height: 5px;
}

.by-text {
  font-size: clamp(0.9rem, 2vw, 1.1rem);
  color: #a0a0a0;
  margin-top: 8px;
  font-weight: 500;
  letter-spacing: 2px;
  animation: fadeIn 1s ease-out 0.3s both;
}

@keyframes bounceIn {
  0% {
    transform: scale(0);
  }

  50% {
    transform: scale(1.1);
  }

  100% {
    transform: scale(1);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* Toolbar Container */
.toolbar {
  padding: 10px 15px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
}

/* Enhanced Button Styles */
button {
  padding: 10px 18px;
  font-size: clamp(11px, 1.5vw, 13px);
  font-weight: 700;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  letter-spacing: 0.8px;
  position: relative;
  overflow: hidden;
  white-space: nowrap;
  min-height: 36px;
  touch-action: manipulation;
  background-size: 200% 200%;
  animation: gradientShift 8s ease infinite;
}

button::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  transform: translate(-50%, -50%);
  transition: width 0.5s ease, height 0.5s ease;
}

button:active::before {
  width: 300px;
  height: 300px;
}

button::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0));
  transform: translateX(-100%);
  transition: transform 0.4s ease;
}

button:hover::after {
  transform: translateX(0);
}

button:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: var(--shadow-lg);
  filter: brightness(1.1);
}

button:active {
  transform: translateY(-1px) scale(0.98);
}

button:focus-visible {
  outline: 3px solid rgba(108, 92, 231, 0.6);
  outline-offset: 4px;
}

#format {
  background: linear-gradient(135deg, #a29bfe, #6c5ce7, #5f27cd);
  color: white;
}

#run {
  background: linear-gradient(135deg, #00b894, #20bf6b, #00a676);
  color: white;
}

#addfile {
  background: linear-gradient(135deg, #6c5ce7, #5f27cd, #4834d4);
  color: white;
}

#clear {
  background: linear-gradient(135deg, #ff7675, #d63031, #c0392b);
  color: white;
}

#download {
  background: linear-gradient(135deg, #fdcb6e, #fab1a0, #e17055);
  color: #2d3436;
}

.layout-btn {
  background: linear-gradient(135deg, #74b9ff, #0984e3, #0652dd);
  color: white;
}

.layout-btn.active {
  background: linear-gradient(135deg, #6c5ce7, #5f27cd, #4834d4);
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(108, 92, 231, 0.5);
}

/* Main Workspace Container */
.workspace {
  flex: 1;
  display: flex;
  padding: 0 15px 15px;
  gap: 15px;
  min-height: 0;
  overflow: hidden;
}

/* Main Layout */
.main-container {
  flex: 1;
  display: flex;
  overflow: hidden;
  min-height: 0;
}

/* Sidebar */
.sidebar {
  width: 60px;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 16px;
  border-right: 1px solid var(--border);
  transition: width var(--transition-medium);
  overflow: hidden;
  flex-shrink: 0;
}

.sidebar:hover,
.sidebar.expanded {
  width: 220px;
}

.sidebar-item {
  width: 100%;
  padding: 12px 0;
  display: flex;
  align-items: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}

.sidebar-item i {
  font-size: 18px;
  min-width: 60px;
  text-align: center;
}

.sidebar-item span {
  font-size: 13px;
  opacity: 0;
  transition: opacity var(--transition-medium);
}

.sidebar:hover .sidebar-item span,
.sidebar.expanded .sidebar-item span {
  opacity: 1;
}

.sidebar-item.active {
  color: white;
  background: rgba(255, 255, 255, 0.1);
}

.sidebar-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 3px;
  background: var(--accent);
}

.sidebar-item:hover:not(.active) {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-light);
}

.sidebar-item.badge::after {
  content: '3';
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--accent);
  color: white;
  font-size: 10px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Editor Area */
.editor-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

/* Container Styles */
.container {
  display: flex;
  flex-direction: row;
  gap: 15px;
  flex: 1;
  min-height: 0;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  animation: slideUp 0.6s ease-out;
  overflow: hidden;
}

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

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

.container.column-layout {
  flex-direction: column;
}

/* Editor Styles */
#editor {
  flex: 2;
  background: var(--panel);
  backdrop-filter: blur(10px);
  border-radius: var(--border-radius);
  padding: clamp(16px, 2vw, 24px);
  font-size: clamp(14px, 1.5vw, 16px);
  box-shadow: 0 8px 32px rgba(108, 92, 231, 0.1);
  border: 1px solid rgba(108, 92, 231, 0.2);
  transition: all 0.4s ease;
  position: relative;
  overflow: auto;
  min-height: 0;
  height: 100%;
}

/* Tabs Bar */
.tabs-bar {
  background: var(--bg-darkest);
  height: 40px;
  display: flex;
  align-items: flex-end;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar) transparent;
  flex-shrink: 0;
}

.tabs-bar::-webkit-scrollbar {
  height: 6px;
}

.tabs-bar::-webkit-scrollbar-track {
  background: transparent;
}

.tabs-bar::-webkit-scrollbar-thumb {
  background: var(--scrollbar);
  border-radius: 3px;
}

.tabs-bar::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-hover);
}

.tab {
  height: 100%;
  display: flex;
  align-items: center;
  padding: 0 20px 0 16px;
  background: var(--bg-darker);
  border-right: 1px solid var(--border);
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
  position: relative;
  transition: background var(--transition-fast);
  min-width: 140px;
  max-width: 200px;
}

.tab.active {
  background: var(--bg-dark);
  color: white;
  border-bottom: 2px solid var(--accent);
}

.tab:hover:not(.active) {
  background: rgba(255, 255, 255, 0.05);
}

.tab-icon {
  margin-right: 8px;
  font-size: 14px;
}

.tab-close {
  margin-left: auto;
  opacity: 0;
  transition: opacity var(--transition-fast);
  padding: 2px;
  border-radius: 2px;
}

.tab:hover .tab-close {
  opacity: 0.7;
}

.tab-close:hover {
  opacity: 1 !important;
  background: rgba(255, 255, 255, 0.1);
}

.tab.dirty::after {
  content: '●';
  color: var(--warning);
  font-size: 12px;
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
}

/* Editor Container */
.editor-container {
  flex: 2;
  display: flex;
  overflow: hidden;
  position: relative;
  min-height: 0;
}

.code-editor {
  flex: 1;
  display: none;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.code-editor.active {
  display: flex;
}

.editor-header {
  padding: 8px 16px;
  background: var(--bg-darkest);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.editor-actions {
  display: flex;
  gap: 8px;
}

.editor-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all var(--transition-fast);
}

.editor-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

/* Code Area */
.code-area {
  flex: 1;
  background: var(--panel);
  color: var(--text);
  border: none;
  outline: none;
  padding: 18px;
  font-family: "JetBrains Mono", var(--font-mono);
  font-size: 14.5px;
  line-height: 1.7;
  letter-spacing: 0.2px;
  caret-color: var(--accent);
  resize: none;
  tab-size: 2;
  overflow: auto;
  min-height: 0;
}

.code-area:focus {
  outline: none;
  box-shadow: none;
}

.code-area::selection {
  background: rgba(96, 165, 250, 0.25);
}

.code-area::-webkit-scrollbar {
  width: 8px;
}

.code-area::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 6px;
}

.code-area::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

.line-numbers {
  color: #64748b;
  font-size: 13px;
  user-select: none;
}

.html-code {
  width: 100%;
  height: 100%;
  background: var(--panel);
  color: var(--text);
  border: none;
  outline: none;
  padding: 18px;
  font-family: "JetBrains Mono", var(--font-mono);
  font-size: 14.5px;
  line-height: 1.7;
  letter-spacing: 0.2px;
  caret-color: var(--accent);
  resize: none;
  tab-size: 2;
}

#editor::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #6c5ce7, #00cec9, #a29bfe);
  background-size: 200% 100%;
  animation: shimmer 3s linear infinite;
  opacity: 0;
  transition: opacity 0.3s ease;
  border-radius: var(--border-radius) var(--border-radius) 0 0;
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }

  100% {
    background-position: 200% 0;
  }
}

#editor:hover::before {
  opacity: 1;
}

#editor:hover {
  box-shadow: 0 12px 40px rgba(108, 92, 231, 0.25);
  border-color: rgba(108, 92, 231, 0.4);
}

#editor:focus-within {
  border-color: rgba(108, 92, 231, 0.6);
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.1);
}

/* Output Container */
.output-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 15px;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.output-section {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  flex: 1;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: border-color 0.2s ease;
  min-height: 0;
  overflow: hidden;
}

.output-section:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

.output-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.output-header h4 {
  font-size: clamp(11px, 1.4vw, 13px);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 0;
}

.clear-btn {
  background: var(--danger);
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: clamp(10px, 1.3vw, 11px);
  font-weight: 500;
  transition: opacity 0.2s ease;
  min-height: 28px;
}

.clear-btn:hover {
  opacity: 0.9;
  transform: none;
}

.output-content {
  font-family: 'Fira Code', 'Cascadia Code', 'Courier New', monospace;
  line-height: 1.6;
  font-size: clamp(11px, 1.3vw, 13px);
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px 16px;
  min-height: 0;
}

/* Log Entry Styles */
.log-entry {
  margin-bottom: 10px;
  padding: 10px;
  border-radius: 6px;
  border-left: 3px solid;
  background: rgba(255, 255, 255, 0.03);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.log-entry.log {
  border-left-color: #00b894;
  color: #00b894;
}

.log-entry.error {
  border-left-color: #ff6b6b;
  color: #ff6b6b;
}

.log-entry.warn {
  border-left-color: #feca57;
  color: #feca57;
}

.log-entry.info {
  border-left-color: #54a0ff;
  color: #54a0ff;
}

.log-timestamp {
  font-size: clamp(9px, 1.1vw, 10px);
  opacity: 0.6;
  margin-bottom: 4px;
}

/* Object Inspector Styles */
.object-inspector {
  margin: 8px 0;
  font-family: 'Fira Code', monospace;
  font-size: clamp(11px, 1.3vw, 12px);
}

.object-tree {
  margin-left: 16px;
}

.object-key {
  color: #ff6b6b;
  font-weight: 600;
}

.object-value {
  color: #00b894;
}

.object-string {
  color: #feca57;
}

.object-number {
  color: #54a0ff;
}

.object-boolean {
  color: #a29bfe;
}

.object-null,
.object-undefined {
  color: #636e72;
  font-style: italic;
}

.prototype-section {
  background: rgba(108, 92, 231, 0.08);
  border: 1px solid rgba(108, 92, 231, 0.2);
  border-radius: 6px;
  padding: 10px;
  margin: 8px 0;
}

.prototype-header {
  color: #6c5ce7;
  font-weight: 600;
  font-size: clamp(11px, 1.2vw, 12px);
  margin-bottom: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}

.prototype-content {
  margin-left: 15px;
  font-size: clamp(10px, 1.1vw, 11px);
  max-height: 200px;
  overflow-y: auto;
}

.expandable {
  cursor: pointer;
  user-select: none;
}

.expandable::before {
  content: "▶";
  margin-right: 5px;
  transition: transform 0.2s ease;
  display: inline-block;
}

.expandable.expanded::before {
  transform: rotate(90deg);
}

.collapsed {
  display: none;
}

/* Language Panel */
.language-panel {
  width: 180px;
  background: rgba(2, 6, 23, 0.9);
  border-left: 1px solid rgba(30, 41, 59, 0.5);
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(10px);
  border-radius: 12px;
  overflow: hidden;
  min-height: 0;
  height: 100%;
  transition: width var(--transition-medium);
}

.language-title {
  padding: 16px;
  font-size: 14px;
  font-weight: 700;
  color: #38bdf8;
  border-bottom: 1px solid rgba(30, 41, 59, 0.5);
  background: rgba(0, 122, 204, 0.1);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

#languageList {
  list-style: none;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  padding: 8px 0;
  margin: 0;
}

#languageList li {
  padding: 12px 20px;
  cursor: pointer;
  font-size: 14px;
  color: #cbd5f5;
  position: relative;
  transition: all var(--transition-fast);
}

#languageList li:hover {
  background: rgba(30, 41, 59, 0.6);
  color: white;
}

#languageList li.active {
  background: linear-gradient(90deg, rgba(108, 92, 231, 0.15) 0%, transparent 100%);
  color: var(--secondary);
  font-weight: 700;
  border-left: 2px solid var(--secondary);
}

/* Language Ad */
.language-ad {
  padding: 12px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-top: 1px solid rgba(30, 41, 59, 0.5);
  background: linear-gradient(135deg, #00cec9, #00b5a8);
  min-height: 80px;
}

/* Custom Alert Styles */
.alert-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 9999;
  animation: fadeIn 0.3s ease;
}

.custom-alert {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.7);
  background: white;
  padding: 40px 30px 30px;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  z-index: 10000;
  max-width: 400px;
  width: 90%;
  text-align: center;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.custom-alert.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.alert-icon {
  color: #e0a800;
  margin-bottom: 20px;
  animation: bounceIn 0.6s ease;
}

.alert-icon svg {
  filter: drop-shadow(0 4px 8px rgba(224, 168, 0, 0.3));
}

.alert-message {
  font-size: 18px;
  color: #333;
  margin-bottom: 25px;
  line-height: 1.6;
  font-weight: 500;
}

.alert-btn {
  background: linear-gradient(135deg, #e0a800 0%, #d09800 100%);
  color: white;
  border: none;
  padding: 12px 40px;
  border-radius: 25px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(224, 168, 0, 0.3);
}

.alert-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(224, 168, 0, 0.4);
}

.alert-btn:active {
  transform: translateY(0);
}

/* Preview Panel */
.preview-panel {
  flex: 1;
  background: white;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border);
  transition: width var(--transition-medium);
  position: relative;
  min-width: 300px;
  overflow: hidden;
  min-height: 0;
}

.preview-panel.collapsed {
  width: 0;
  min-width: 0;
  border-left: none;
}

.preview-header {
  background: var(--bg-darker);
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.preview-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: white;
}

.preview-controls {
  display: flex;
  gap: 8px;
  padding: 10px;
}

.preview-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: var(--text);
  width: 32px;
  height: 32px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.preview-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

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

.preview-frame-container {
  flex: 1;
  position: relative;
  overflow: hidden;
  min-height: 0;
}

.preview-frame {
  width: 100%;
  height: 100%;
  border: none;
  background: white;
}

.preview-loading {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #333;
  font-size: 14px;
  display: none;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(0, 122, 204, 0.2);
  border-top: 4px solid var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 12px;
}

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

  100% {
    transform: rotate(360deg);
  }
}

/* Resize Handle */
.resize-handle {
  width: 6px;
  background: transparent;
  cursor: col-resize;
  position: absolute;
  top: 0;
  bottom: 0;
  left: -3px;
  z-index: 10;
}

.resize-handle:hover,
.resize-handle.active {
  background: var(--accent);
}

/* Bottom Panel */
.bottom-panel {
  height: 0;
  background: var(--bg-darker);
  border-top: 1px solid var(--border);
  overflow: hidden;
  transition: height var(--transition-medium);
  flex-shrink: 0;
}

.bottom-panel.expanded {
  height: 200px;
}

.panel-tabs {
  display: flex;
  background: var(--bg-darkest);
  border-bottom: 1px solid var(--border);
  height: 36px;
}

.panel-tab {
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  border-right: 1px solid var(--border);
  transition: background var(--transition-fast);
}

.panel-tab.active {
  background: var(--bg-darker);
  color: white;
}

.panel-tab:hover:not(.active) {
  background: rgba(255, 255, 255, 0.05);
}

.panel-content {
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 13px;
  overflow: auto;
  height: calc(100% - 36px);
}

.terminal {
  color: var(--text-light);
}

.terminal-line {
  margin: 4px 0;
}

/* Status Bar */
.status-bar {
  background: var(--accent);
  height: 24px;
  padding: 0 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: white;
  flex-shrink: 0;
}

.status-left,
.status-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.status-item {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 2px;
  transition: background var(--transition-fast);
}

.status-item:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 40px;
  right: 20px;
  background: var(--bg-darker);
  border: 1px solid var(--border);
  border-left: 4px solid var(--success);
  padding: 12px 16px;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 1000;
  transform: translateY(100px);
  opacity: 0;
  transition: transform var(--transition-medium), opacity var(--transition-medium);
}

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

.toast-icon {
  font-size: 18px;
  color: var(--success);
}

/* Responsive Breakpoints */
@media (max-width: 1200px) {
  .language-panel {
    width: 160px;
  }

  .preview-panel {
    width: 50%;
  }
}

@media (max-width: 992px) {
  .workspace {
    flex-direction: column;
  }

  .container {
    flex-direction: column !important;
  }

  .sidebar {
    width: 100%;
    height: auto;
    flex-direction: row;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 8px;
  }

  .sidebar-item {
    flex-direction: column;
    padding: 8px;
  }

  .sidebar-item i {
    min-width: auto;
  }

  .sidebar-item span {
    font-size: 10px;
    margin-top: 4px;
  }

  .language-panel {
    width: 100%;
    height: auto;
    flex-direction: row;
    border-left: none;
    border-top: 1px solid rgba(108, 92, 231, 0.2);
  }

  .language-title {
    border-bottom: none;
    border-right: 1px solid rgba(108, 92, 231, 0.2);
  }

  #languageList {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0;
  }

  #languageList li {
    white-space: nowrap;
  }

  #languageList li.active {
    border-left: none;
    border-bottom: 3px solid #22d3ee;
  }

  .language-ad {
    display: none;
  }

  .preview-panel {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: 50;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.5);
  }

  .preview-panel.collapsed {
    transform: translateX(100%);
  }
}

@media (max-width: 768px) {
  .editor-heading {
    padding: 15px 10px 5px;
  }

  .toolbar {
    padding: 8px 10px;
    gap: 8px;
  }

  button {
    padding: 8px 14px;
    min-height: 32px;
  }

  .workspace {
    padding: 0 10px 10px;
    gap: 10px;
  }

  .container {
    gap: 10px;
  }

  #editor {
    padding: 14px;
    border-radius: 12px;
  }

  .output-section {
    border-radius: 12px;
  }
}

@media (max-width: 640px) {
  .gradient-text {
    font-size: 1.3rem;
  }

  .by-text {
    font-size: 0.85rem;
  }

  button {
    font-size: 10px;
    padding: 7px 12px;
    gap: 5px;
  }
}

@media (max-width: 480px) {
  .workspace {
    padding: 0 8px 8px;
  }

  .container {
    gap: 8px;
  }

  #editor {
    font-size: 13px;
    padding: 12px;
  }

  .output-content {
    font-size: 11px;
    padding: 10px 12px;
  }

  button {
    padding: 6px 10px;
    font-size: 9px;
  }

  .log-entry {
    padding: 8px;
  }
}

/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Print Styles */
@media print {
  body {
    background: white;
    color: black;
  }

  button {
    display: none;
  }

  .output-section {
    border: 1px solid #000;
    box-shadow: none;
  }
}