/* ==========================================================================
   Python Compiler - CodeDojo Tools
   ========================================================================== */

/* Main Compiler Section */
.compiler-section {
  padding: 40px 0;
  min-height: calc(100vh - 200px);
}

.compiler-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.compiler-header .back-link {
  color: var(--accent-color);
  text-decoration: none;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s ease;
}

.compiler-header .back-link:hover {
  color: var(--heading-color);
  transform: translateX(-5px);
}

.compiler-title {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
}

/* IDE Layout Container */
.ide-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  background: var(--surface-color);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

@media (min-width: 992px) {
  .ide-container {
    flex-direction: row;
    height: 600px;
  }
}

/* Editor Pane */
.editor-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.pane-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 15px;
  background: rgba(0, 0, 0, 0.4);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.pane-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--heading-color);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* CodeMirror Customization */
.CodeMirror {
  height: 100% !important;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 14px;
}

@media (max-width: 991px) {
  .CodeMirror {
    height: 300px !important;
  }
}

/* Run Button */
.btn-run {
  background: var(--accent-color);
  color: var(--contrast-color);
  border: none;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.3s ease;
}

.btn-run:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(var(--accent-color-rgb), 0.4);
}

.btn-run:disabled {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.5);
  cursor: not-allowed;
}

.btn-run .spinner-border {
  width: 14px;
  height: 14px;
  border-width: 2px;
  display: none;
}

/* Output Pane (Terminal) */
.output-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #1e1e1e;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.terminal-header {
  background: #2d2d2d;
  display: flex;
  padding: 10px 15px;
  align-items: center;
  border-bottom: 1px solid #111;
}

.terminal-dots {
  display: flex;
  gap: 6px;
}

.terminal-dots span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ff5f56;
}

.terminal-dots span:nth-child(2) {
  background: #ffbd2e;
}

.terminal-dots span:nth-child(3) {
  background: #27c93f;
}

.terminal-title {
  margin-left: 15px;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.6);
  font-family: monospace;
}

.terminal-content {
  flex: 1;
  padding: 15px;
  overflow-y: auto;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 14px;
  color: #a9b7c6;
  white-space: pre-wrap;
  word-wrap: break-word;
}

@media (max-width: 991px) {
  .terminal-content {
    min-height: 250px;
    max-height: 400px;
  }
}

.terminal-content .log-message {
  margin-bottom: 6px;
}

.terminal-content .log-error {
  color: #ff5f56;
}

.terminal-content .log-system {
  color: #27c93f;
  font-style: italic;
}

.terminal-content .cursor {
  display: inline-block;
  width: 8px;
  height: 15px;
  background: #a9b7c6;
  animation: blink 1s step-end infinite;
  vertical-align: middle;
}

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

/* Loading Overlay */
.pyodide-loading {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(30, 30, 30, 0.8);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 10;
  color: var(--heading-color);
  font-weight: 600;
  transition: opacity 0.5s ease;
}

.pyodide-loading .spinner-border {
  margin-bottom: 15px;
}

.py-hidden {
  opacity: 0;
  pointer-events: none;
}
