/* PRC Editor - Premium Styles */
:root {
  /* Color Palette - Deep Space & Neon */
  --bg-dark: #0f111a;
  --bg-panel: rgba(23, 27, 39, 0.7);
  --bg-panel-solid: #171b27;
  --primary-accent: #6c5ce7;
  --primary-glow: rgba(108, 92, 231, 0.4);
  --secondary-accent: #00cec9;
  --text-primary: #dfe6e9;
  --text-secondary: #b2bec3;
  --border-color: rgba(255, 255, 255, 0.1);
  --glass-border: 1px solid rgba(255, 255, 255, 0.08);

  /* Spacing */
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 12px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', 'Segoe UI', sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
  /* Gradients removed for static look */
}

/* App Container */
.app-container {
  display: grid;
  grid-template-columns: 250px 1fr;
  grid-template-rows: 60px 1fr 200px;
  /* Header / Main / Output */
  height: 100vh;
  width: 100%;
  overflow-x: hidden;
}

/* Header (Restored) */
.top-bar {
  grid-column: 1 / -1;
  grid-row: 1 / 2;
  background: var(--bg-panel);
  border-bottom: var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 100;
}

/* Sidebar */
.sidebar {
  grid-row: 2 / -1;
  /* Sidebar starts after header */
  background: var(--bg-panel);
  border-right: var(--glass-border);
  display: flex;
  flex-direction: column;
  padding: var(--spacing-md);
  overflow-y: hidden;
}

.brand-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-logo {
  height: 50px;
  /* Increased from 35px */
  width: auto;
  filter: drop-shadow(0 0 5px rgba(108, 92, 231, 0.5));
  transition: transform 0.3s ease;
}

.nav-logo:hover {
  transform: scale(1.1);
}

.nav-title {
  font-weight: 700;
  font-size: 1.8rem;
  /* Increased from 1.2rem */
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, #fff 0%, #a5b1c2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Proper Loading Screen */
#loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #0f111a;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  transition: opacity 0.5s ease-out;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(108, 92, 231, 0.3);
  border-top-color: #6c5ce7;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 20px;
}

.loading-text {
  font-size: 1.2rem;
  color: #b2bec3;
  letter-spacing: 1px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.nav-copyright {
  color: var(--text-secondary);
  font-size: 0.85rem;
  letter-spacing: 0.5px;
  opacity: 0.8;
}

.nav-controls {
  display: flex;
  align-items: center;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--text-primary), var(--primary-accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.5px;
}

.controls {
  display: flex;
  gap: var(--spacing-md);
}

.btn {
  background: rgba(255, 255, 255, 0.05);
  border: var(--glass-border);
  color: var(--text-primary);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--primary-accent);
  border: none;
  box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-primary:hover {
  background: #5b4cc4;
  box-shadow: 0 6px 20px var(--primary-glow);
}

/* Sidebar */
.sidebar {
  grid-row: 2 / -1;
  background: var(--bg-panel);
  border-right: var(--glass-border);
  display: flex;
  flex-direction: column;
  padding: var(--spacing-md);
  overflow-y: hidden;
  /* Container fixed */
}

.lang-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  /* Scrollable list */
  flex: 1;
  padding-right: 4px;
  /* Space for scrollbar */
}

.lang-item {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 12px;
  /* Increased gap for icon */
  font-size: 0.95rem;
}

.lang-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.lang-item.active {
  background: rgba(108, 92, 231, 0.1);
  color: var(--primary-accent);
  border-left: 2px solid var(--primary-accent);
}

/* Editor Area */
.editor-wrapper {
  grid-column: 2;
  grid-row: 2;
  position: relative;
  background-color: #1e1e1e;
  /* Match monaco vs-dark generic bg to reduce flicker */
  overflow: hidden;
}

#editor-container {
  width: 100%;
  height: 100%;
}

/* Loading Overlay */
#loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background: #090a10;
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: opacity 0.5s ease;
}

.loader-content {
  text-align: center;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 3px solid rgba(108, 92, 231, 0.3);
  border-top: 3px solid var(--primary-accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px auto;
}

.loading-text {
  color: var(--text-secondary);
  font-family: 'Fira Code', monospace;
  font-size: 0.9rem;
  letter-spacing: 1px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

/* Home Dashboard (Welcome Screen) */
.welcome-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  background: var(--bg-dark);
  z-index: 10;
  text-align: center;
  overflow-y: auto;
  padding: 40px 20px;
  /* Top padding for space */
}

/* Background Effect (Static) */
.welcome-bg {
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: transparent;
  /* Removed gradient */
  display: none;
  /* Hide element entirely */
  z-index: 0;
}

.welcome-content {
  position: relative;
  z-index: 1;
  max-width: 800px;
  padding: 20px;
  margin-top: 0 !important;
  /* Force top alignment */
}

.hero-logo {
  width: 120px;
  height: auto;
  margin-bottom: 1.5rem;
  filter: drop-shadow(0 0 20px rgba(108, 92, 231, 0.4));
}

.welcome-content h1 {
  font-size: 3rem;
  /* Reduced from 4rem for longer text */
  margin-bottom: 0.2rem;
  background: linear-gradient(to right, #00cec9, #6c5ce7);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  white-space: nowrap;
  /* Force one line */
}

.subtitle {
  font-size: 1.5rem;
  color: white;
  margin-bottom: 1rem;
  font-weight: 300;
}

.description {
  color: var(--text-secondary);
  font-size: 1.1rem;
  line-height: 1.6;
  margin-bottom: 2rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.description b {
  color: var(--primary-accent);
}

.stats-row {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin-bottom: 3rem;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-num {
  font-size: 1.8rem;
  font-weight: bold;
  color: #fff;
}

.stat-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.section-title {
  font-size: 1.2rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.home-footer {
  margin-top: 4rem;
  color: #555;
  font-size: 0.8rem;
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Quick Start Grid */
.quick-start-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  max-width: 800px;
  margin: 0 auto;
}

.qs-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  padding: 24px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.qs-card:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-5px);
  border-color: var(--primary-accent);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.qs-card i {
  font-size: 2.5rem;
}

.qs-card span {
  font-size: 0.9rem;
  color: var(--text-primary);
}

/* Output Panel */
.output-panel {
  grid-column: 2;
  grid-row: 3;
  background: #12141d;
  border-top: var(--glass-border);
  overflow: hidden;
  /* Changed from auto to hidden for frame */
  display: flex;
  flex-direction: column;
  position: relative;
}

.resizer-handle {
  width: 100%;
  height: 6px;
  background: transparent;
  cursor: ns-resize;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 20;
  transition: background 0.2s;
}

.resizer-handle:hover,
.resizer-handle.dragging {
  background: var(--primary-accent);
}

.output-header {
  flex-shrink: 0;
  /* Header stays fixed */
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.8rem;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.console-content {
  padding: var(--spacing-md);
  color: var(--text-secondary);
  white-space: pre-wrap;
  flex: 1;
  /* Take remaining space */
  overflow-y: auto;
  font-family: 'Fira Code', monospace;
}

.output-frame {
  flex: 1;
  border: none;
  background: white;
  /* Web pages usually expect white bg */
  width: 100%;
  height: 100%;
}

.hidden {
  display: none !important;
}

.log-info {
  color: #74b9ff;
}

.log-success {
  color: #00cec9;
}

.log-error {
  color: #ff7675;
}

.output-panel.fullscreen {
  position: absolute;
  top: 60px;
  /* Below header */
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  height: auto;
  border-top: none;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Settings Panel (Overlay) */
.settings-modal {
  position: fixed;
  top: 60px;
  /* Below header */
  right: -320px;
  /* Hidden off-screen */
  width: 300px;
  height: calc(100% - 60px);
  background: rgba(30, 30, 30, 0.95);
  backdrop-filter: blur(10px);
  z-index: 2000;
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -5px 0 15px rgba(0, 0, 0, 0.5);
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  display: block;
}

.settings-modal.active {
  right: 0;
  /* Slide in */
}

/* Override utility hidden if present */
.settings-modal.hidden {
  display: none !important;
}

.settings-content {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 24px;
  width: 100%;
  height: 100%;
  overflow-y: auto;
}

.settings-content h3 {
  margin-top: 0;
  margin-bottom: 20px;
  color: var(--text-primary);
  text-align: center;
}

.setting-group {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  color: var(--text-secondary);
}

.setting-group input[type="color"] {
  border: none;
  width: 40px;
  height: 30px;
  cursor: pointer;
  background: none;
}

/* Polish for Settings */
.setting-group select {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  outline: none;
  cursor: pointer;
  font-family: inherit;
  width: 150px;
  appearance: none;
  /* Remove default arrow */
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  padding-right: 35px;
  /* Prevent text overlapping arrow */
}

.setting-group select:hover {
  border-color: var(--primary-accent);
}

.setting-group select:focus {
  border-color: var(--primary-accent);
  box-shadow: 0 0 0 2px var(--primary-glow);
}

.close-btn-icon {
  position: absolute;
  top: 15px;
  right: 15px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.2rem;
  cursor: pointer;
  transition: color 0.2s;
}

.close-btn-icon:hover {
  color: white;
}