/* File: public/style.css */

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

:root {
  /* Material Palenight Colors */
  --bg-dark: #292d3e;
  --bg-darker: #1b1e2b;
  --bg-darkest: #1b1e2b;
  --border-color: #3b3f51;
  --text-primary: #bfc7d5;
  --text-secondary: #676e95;
  --accent-blue: #89ddff;
  --accent-green: #c3e88d;
  --accent-red: #f07178;
  --accent-yellow: #ffcb6b;
  --accent-purple: #c792ea;
  --accent-orange: #f78c6c;
  --success: #c3e88d;
  --error: #f07178;
  --warning: #ffcb6b;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background-color: var(--bg-darkest);
  color: var(--text-primary);
  overflow: hidden;
  height: 100vh;
}

.container {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

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

.header h1 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

/* Toolbar */
.toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid var(--border-color);
  background-color: var(--bg-dark);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn:hover {
  background-color: var(--bg-darker);
  border-color: var(--accent-blue);
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background-color: #4fc3f7;
  border-color: #4fc3f7;
  color: #000000;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(79, 195, 247, 0.3);
}

.btn-primary:hover {
  background-color: #29b6f6;
  border-color: #29b6f6;
  box-shadow: 0 4px 12px rgba(79, 195, 247, 0.5);
}

.btn-secondary {
  background-color: #a5d6a7;
  border-color: #a5d6a7;
  color: #000000;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(165, 214, 167, 0.3);
}

.btn-secondary:hover {
  background-color: #81c784;
  border-color: #81c784;
  box-shadow: 0 4px 12px rgba(165, 214, 167, 0.5);
}

.btn-danger {
  background-color: transparent;
  border-color: #ff6b6b;
  color: #ff6b6b;
  font-weight: 600;
}

.btn-danger:hover {
  background-color: #ff6b6b;
  border-color: #ff6b6b;
  color: #000000;
  box-shadow: 0 4px 12px rgba(255, 107, 107, 0.5);
}

.btn-success {
  background-color: #66bb6a;
  border-color: #66bb6a;
  color: #000000;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(102, 187, 106, 0.3);
}

.btn-success:hover {
  background-color: #4caf50;
  border-color: #4caf50;
  box-shadow: 0 4px 12px rgba(102, 187, 106, 0.5);
}

.btn-info {
  background-color: transparent;
  border-color: #42a5f5;
  color: #42a5f5;
  font-weight: 600;
}

.btn-info:hover {
  background-color: #42a5f5;
  border-color: #42a5f5;
  color: #000000;
  box-shadow: 0 4px 12px rgba(66, 165, 245, 0.5);
}

.btn.active {
  background-color: var(--accent-blue);
  border-color: var(--accent-blue);
  color: #000000;
}

.btn-icon {
  font-size: 14px;
}

.btn.loading {
  position: relative;
  pointer-events: none;
}

.btn.loading::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  top: 50%;
  left: 50%;
  margin-left: -7px;
  margin-top: -7px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* Status Indicator */
.status-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background-color: var(--bg-darkest);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 12px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--success);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.status-indicator.compiling .status-dot {
  background-color: var(--warning);
}

.status-indicator.error .status-dot {
  background-color: var(--error);
  animation: none;
}

/* Main Wrapper */
.main-wrapper {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

/* Editor Container */
.editor-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

.editor-pane {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-color);
  background-color: var(--bg-dark);
}

.editor-pane:last-child {
  border-right: none;
}

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

.pane-title {
  font-weight: 600;
  color: var(--text-primary);
}

.pane-info {
  color: var(--text-secondary);
  font-size: 11px;
}

.editor {
  flex: 1;
  overflow: hidden;
}

/* Notification */
.notification {
  position: fixed;
  top: 70px;
  right: 20px;
  max-width: 500px;
  background-color: var(--bg-darker);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  z-index: 1000;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    transform: translateX(120%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.notification.hidden {
  display: none;
}

.notification-content {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
}

.notification-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.notification-message {
  flex: 1;
  font-size: 13px;
  line-height: 1.5;
  word-wrap: break-word;
}

.notification-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color 0.2s;
}

.notification-close:hover {
  color: var(--text-primary);
}

.notification.success {
  border-left: 4px solid var(--success);
}

.notification.error {
  border-left: 4px solid var(--error);
}

.notification.warning {
  border-left: 4px solid var(--warning);
}

.notification.info {
  border-left: 4px solid var(--accent-blue);
}

/* Responsive Layout */
@media (max-width: 1024px) {
  .editor-container {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr;
  }

  .editor-pane {
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }

  .editor-pane:last-child {
    border-bottom: none;
  }

  .toolbar {
    gap: 8px;
  }

  .btn {
    padding: 6px 12px;
    font-size: 12px;
  }

  .btn-icon {
    display: none;
  }
}

@media (max-width: 768px) {
  .header {
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
  }

  .header h1 {
    text-align: center;
  }

  .toolbar {
    flex-wrap: wrap;
    justify-content: center;
  }

  .status-indicator {
    width: 100%;
    justify-content: center;
  }

  .notification {
    left: 10px;
    right: 10px;
    max-width: none;
  }
}

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

::-webkit-scrollbar-track {
  background: var(--bg-darkest);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: #4e4e52;
}

/* Terminal Panel (VS Code style) */
.terminal-panel {
  display: flex;
  flex-direction: column;
  background-color: var(--bg-darkest);
  border-top: 1px solid var(--border-color);
  height: 300px;
  min-height: 150px;
  max-height: 70vh;
  transition: transform 0.2s ease;
}

.terminal-panel.hidden {
  display: none;
}

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

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

.terminal-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background-color: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.terminal-tab:hover {
  background-color: var(--bg-dark);
  color: var(--text-primary);
}

.terminal-tab.active {
  color: var(--text-primary);
  border-bottom-color: var(--accent-blue);
  background-color: var(--bg-darkest);
}

.terminal-tab-icon {
  font-size: 12px;
}

.terminal-actions {
  display: flex;
  gap: 4px;
  padding: 4px 8px;
}

.terminal-action-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 3px;
  transition: all 0.2s;
}

.terminal-action-btn:hover {
  background-color: var(--bg-dark);
  color: var(--text-primary);
}

.terminal-content {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.terminal-output {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: 'Ubuntu Nerd Font', 'Ubuntu Nerd Font Mono', 'UbuntuMono Nerd Font', 'UbuntuMono Nerd Font Mono', 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-primary);
}

.terminal-history {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 16px;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.terminal-input-line {
  display: flex;
  align-items: center;
  padding: 8px 16px;
  background-color: var(--bg-darkest);
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
}

.terminal-prompt {
  color: var(--accent-green);
  margin-right: 8px;
  font-weight: 600;
  user-select: none;
}

.terminal-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: 'Ubuntu Nerd Font', 'Ubuntu Nerd Font Mono', 'UbuntuMono Nerd Font', 'UbuntuMono Nerd Font Mono', 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.6;
  caret-color: var(--accent-green);
}

.terminal-prompt-line {
  margin: 2px 0;
  padding: 2px 0;
  display: flex;
  align-items: center;
}

.terminal-prompt-text {
  color: var(--accent-green);
  margin-right: 8px;
  font-weight: 600;
  font-family: 'Ubuntu Nerd Font', 'Ubuntu Nerd Font Mono', 'UbuntuMono Nerd Font', 'UbuntuMono Nerd Font Mono', 'Consolas', 'Monaco', 'Courier New', monospace;
}

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

.terminal-console,
.terminal-problems {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 12px 16px;
  font-family: 'Ubuntu Nerd Font', 'Ubuntu Nerd Font Mono', 'UbuntuMono Nerd Font', 'UbuntuMono Nerd Font Mono', 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-primary);
  overflow-y: auto;
  overflow-x: hidden;
  white-space: pre-wrap;
  word-wrap: break-word;
  display: none;
}

.terminal-output.active {
  display: flex;
}

.terminal-console.active,
.terminal-problems.active {
  display: block;
}

.terminal-history .terminal-line {
  margin: 2px 0;
  padding: 2px 0;
  color: var(--text-primary);
}

.terminal-history .terminal-line.error {
  color: var(--accent-red);
}

.terminal-history .terminal-line.warning {
  color: var(--accent-yellow);
}

.terminal-history .terminal-line.success {
  color: var(--accent-green);
}

.terminal-history .terminal-line.info {
  color: var(--text-primary);
}

.terminal-output .terminal-line.info,
.terminal-console .terminal-line.info {
  color: var(--accent-blue);
}

.terminal-output .terminal-line.timestamp,
.terminal-console .terminal-line.timestamp {
  color: var(--text-secondary);
  font-size: 11px;
}

.terminal-console .terminal-line {
  margin: 2px 0;
  padding: 2px 0;
}

.terminal-console .terminal-line.error {
  color: var(--accent-red);
}

.terminal-console .terminal-line.warning {
  color: var(--accent-yellow);
}

.terminal-console .terminal-line.success {
  color: var(--accent-green);
}

.terminal-problems {
  font-size: 12px;
}

.problem-item {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: background-color 0.2s;
}

.problem-item:hover {
  background-color: var(--bg-dark);
}

.problem-item.error {
  border-left: 3px solid var(--accent-red);
}

.problem-item.warning {
  border-left: 3px solid var(--accent-yellow);
}

.problem-item.info {
  border-left: 3px solid var(--accent-blue);
}

.problem-severity {
  font-weight: 600;
  margin-right: 8px;
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.5px;
}

.problem-severity.error {
  color: var(--accent-red);
}

.problem-severity.warning {
  color: var(--accent-yellow);
}

.problem-severity.info {
  color: var(--accent-blue);
}

.problem-message {
  color: var(--text-primary);
}

.problem-location {
  color: var(--text-secondary);
  font-size: 11px;
  margin-top: 4px;
}

/* Command Palette (VS Code style) */
.command-palette {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 600px;
  max-width: 90vw;
  background-color: var(--bg-darker);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  max-height: 70vh;
}

.command-palette.hidden {
  display: none;
}

.command-palette-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.command-palette-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  transition: color 0.2s;
}

.command-palette-close:hover {
  color: var(--text-primary);
}

.command-palette-input {
  width: 100%;
  padding: 12px 16px;
  background-color: var(--bg-darkest);
  border: none;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  outline: none;
}

.command-palette-input::placeholder {
  color: var(--text-secondary);
}

.command-palette-list {
  max-height: 400px;
  overflow-y: auto;
  padding: 4px 0;
}

.command-item {
  display: flex;
  align-items: center;
  padding: 8px 16px;
  cursor: pointer;
  transition: background-color 0.15s;
  color: var(--text-primary);
}

.command-item:hover,
.command-item.selected {
  background-color: var(--bg-dark);
}

.command-item-icon {
  margin-right: 12px;
  font-size: 16px;
  width: 20px;
  text-align: center;
}

.command-item-label {
  flex: 1;
  font-size: 13px;
}

.command-item-shortcut {
  color: var(--text-secondary);
  font-size: 11px;
  margin-left: 12px;
  font-family: 'Consolas', 'Monaco', monospace;
}
