/*
 * Codebender
 * Custom Styles
 */

:root {
  --arduino-teal: #00979D;
  --arduino-teal-light: #62AEB2;
  --arduino-teal-dark: #006468;
  --arduino-orange: #E47128;
  --arduino-orange-light: #F29C68;
  --arduino-orange-dark: #B04300;
}

/* General Styles */
:root {
    --editor-height: calc(100vh - 150px);
    --output-height: 200px;
}

body {
  font-family: 'Roboto', sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.main-content {
  flex: 1;
}

.btn-arduino {
  background-color: var(--arduino-teal);
  border-color: var(--arduino-teal);
  color: white;
}

.btn-arduino:hover, .btn-arduino:focus {
  background-color: var(--arduino-teal-dark);
  border-color: var(--arduino-teal-dark);
  color: white;
}

.btn-arduino-secondary {
  background-color: var(--arduino-orange);
  border-color: var(--arduino-orange);
  color: white;
}

.btn-arduino-secondary:hover, .btn-arduino-secondary:focus {
  background-color: var(--arduino-orange-dark);
  border-color: var(--arduino-orange-dark);
  color: white;
}

.text-arduino {
  color: var(--arduino-teal);
}

.text-arduino-secondary {
  color: var(--arduino-orange);
}

.bg-arduino {
  background-color: var(--arduino-teal);
  color: white;
}

.bg-arduino-light {
  background-color: var(--arduino-teal-light);
  color: white;
}

footer {
    margin-top: auto;
}

/* Header & Navigation */
.navbar {
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.navbar-brand img {
  height: 30px;
}

/* Hero Section */
.hero {
  background: linear-gradient(135deg, var(--arduino-teal) 0%, var(--arduino-teal-dark) 100%);
  color: white;
  padding: 4rem 0;
}

.hero h1 {
  font-weight: 700;
  margin-bottom: 1rem;
}

.hero p {
  opacity: 0.9;
  font-size: 1.15rem;
}

/* Editor Page */
.editor-container {
    height: var(--editor-height);
    display: flex;
    flex-direction: column;
    border-right: 1px solid #dee2e6;
}

.editor-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 56px);
}

.editor-toolbar {
  padding: 0.5rem 1rem;
  border-bottom: 1px solid #dee2e6;
  background-color: #f8f9fa;
}

.editor-toolbar .btn-group {
  margin-right: 1rem;
}

.editor-main {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.editor-sidebar {
  width: 280px;
  border-right: 1px solid #dee2e6;
  overflow-y: auto;
  background-color: #f8f9fa;
}

.editor-content {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.editor-tabs {
  background-color: #ffffff;
  border-bottom: 1px solid #dee2e6;
}

.editor-area {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.code-editor {
    height: 100%;
    overflow: hidden;
}

.code-editor {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
}

.CodeMirror {
    height: 100%;
    font-size: 14px;
    font-family: 'Fira Mono', monospace;
}

.CodeMirror {
  height: 100%;
  font-family: 'Source Code Pro', monospace;
  font-size: 14px;
}

/* File tabs styling */
#fileTabs {
    padding: 0.5rem 0.5rem 0 0.5rem;
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.close-tab {
    font-size: 1.2rem;
    margin-left: 5px;
    cursor: pointer;
}

.close-tab:hover {
    color: #dc3545;
}

/* Right panel styling */
.panel-container {
    height: var(--editor-height);
    display: flex;
    flex-direction: column;
}

#panelTabs {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.output-container {
    flex-grow: 1;
    overflow-y: auto;
    background-color: #2c2c2c;
    color: #f0f0f0;
}

.output-container {
  height: 200px;
  border-top: 1px solid #dee2e6;
  background-color: #f8f9fa;
  overflow: hidden;
  position: relative;
}

.output-tabs {
  background-color: #f8f9fa;
  border-bottom: 1px solid #dee2e6;
}

.output-content {
  position: absolute;
  top: 36px;
  right: 0;
  bottom: 0;
  left: 0;
  overflow-y: auto;
}

#compileOutput {
    font-family: 'Fira Mono', monospace;
    font-size: 13px;
    white-space: pre-wrap;
    height: 100%;
    overflow-y: auto;
    margin: 0;
}

.output-status {
    font-size: 14px;
}

/* Serial Monitor */
.serial-container {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.serial-container {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.serial-output {
    flex-grow: 1;
    overflow-y: auto;
    background-color: #2c2c2c;
    color: #f0f0f0;
}

.serial-output {
  flex: 1;
  background-color: #1e1e1e;
  color: #f8f8f8;
  font-family: 'Source Code Pro', monospace;
  padding: 0.5rem;
  overflow-y: auto;
  white-space: pre;
  font-size: 14px;
  line-height: 1.4;
}

.serial-input-group {
  padding: 0.5rem;
  background-color: #f8f9fa;
  border-top: 1px solid #dee2e6;
}

.serial-header {
  padding: 0.5rem;
  background-color: #f8f9fa;
  border-bottom: 1px solid #dee2e6;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#serialOutput {
    font-family: 'Fira Mono', monospace;
    font-size: 13px;
    white-space: pre-wrap;
    height: 100%;
    margin: 0;
}

/* Serial Data Visualization */
.serial-content-container {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.serial-output-with-visual {
  width: 50%;
  border-right: 1px solid #dee2e6;
}

.serial-visualization {
  flex: 1;
  padding: 10px;
  background-color: #f8f9fa;
  overflow-y: auto;
}

.visualizer-container {
  background-color: white;
  border-radius: 6px;
  border: 1px solid #dee2e6;
  overflow: hidden;
}

.visualizer-header {
  padding: 8px 12px;
  background-color: #f1f1f1;
  border-bottom: 1px solid #dee2e6;
}

.visualizer-body {
  padding: 10px;
  height: 220px;
}

.visualizer-body canvas {
  width: 100%;
  height: 100%;
}

.visual-panel-header {
  padding: 10px;
  border-bottom: 1px solid #dee2e6;
}

.visual-panel-content {
  padding: 10px;
}

/* Adjustments for smaller screens */
@media (max-width: 768px) {
  .serial-content-container {
    flex-direction: column;
  }

  .serial-output-with-visual {
    width: 100%;
    height: 200px;
    border-right: none;
    border-bottom: 1px solid #dee2e6;
  }
}

/* Project cards on home page */
.project-card {
    cursor: pointer;
    transition: transform 0.2s;
}

.project-card {
  cursor: pointer;
  transition: all 0.2s ease;
}

.project-card:hover {
    transform: translateY(-5px);
}

.project-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.project-card .card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Account page styles */
.tab-content > .tab-pane {
    padding: 1rem 0;
}

/* Subscription Card */
.subscription-card {
  border-radius: 8px;
  border: 1px solid #dee2e6;
  overflow: hidden;
}

.subscription-header {
  background: linear-gradient(135deg, var(--arduino-teal) 0%, var(--arduino-teal-dark) 100%);
  color: white;
  padding: 1rem;
}

.subscription-badge {
  position: absolute;
  top: -10px;
  right: 10px;
  padding: 0.25rem 1rem;
  background-color: var(--arduino-orange);
  color: white;
  border-radius: 20px;
  font-weight: 600;
}

/* Footer */
footer {
  background-color: #f8f9fa;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  padding: 2rem 0;
  margin-top: auto;
}

footer .footer-logo {
  max-width: 120px;
  margin-bottom: 1rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .editor-container, .panel-container {
        height: auto;
    }

    .editor-container {
        border-right: none;
        border-bottom: 1px solid #dee2e6;
    }

    .code-editor {
        height: 400px;
    }

    .serial-output, .output-container {
        height: 300px;
    }
}

/* Responsive Adjustments */
@media (max-width: 768px) {
  .editor-sidebar {
    display: none;
  }

  .editor-toolbar {
    overflow-x: auto;
    white-space: nowrap;
  }

  .output-container {
    height: 150px;
  }
}

/* Bootstrap Icons */
@import url("https://cdn.jsdelivr.net/npm/bootstrap-icons@1.8.0/font/bootstrap-icons.css");

/* Dashboard Features */
.stat-card {
  border-radius: 8px;
  border: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
}

.stat-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  transform: translateY(-2px);
}

.stat-icon {
  font-size: 2rem;
  opacity: 0.8;
}

/* Examples and Templates */
.example-category {
  border-left: 4px solid var(--arduino-teal);
  padding-left: 1rem;
  margin-bottom: 1.5rem;
}

.example-list {
  max-height: 300px;
  overflow-y: auto;
}

/* Loading Animation */
.loading-container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 200px;
}

.loader {
  border: 5px solid #f3f3f3;
  border-top: 5px solid var(--arduino-teal);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* File Explorer */
.file-explorer {
  list-style-type: none;
  padding-left: 0;
}

.file-explorer li {
  padding: 0.25rem 0.5rem;
  cursor: pointer;
}

.file-explorer li:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.file-explorer .folder {
  font-weight: 600;
}

.file-explorer .file {
  padding-left: 1.5rem;
}

.file-explorer .file.active {
  background-color: rgba(0, 151, 157, 0.1);
  color: var(--arduino-teal);
}

/* Close Tab Button */
.close-tab {
  display: inline-block;
  width: 16px;
  height: 16px;
  text-align: center;
  line-height: 14px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  font-weight: bold;
  opacity: 0.5;
  vertical-align: middle;
}

.close-tab:hover {
  opacity: 1;
  background-color: rgba(0, 0, 0, 0.1);
}

/* Compilation Output */
.compile-output {
  font-family: 'Source Code Pro', monospace;
  background-color: #1e1e1e;
  color: #f8f8f8;
  padding: 10px;
  height: 100%;
  overflow-y: auto;
  white-space: pre-wrap;
  font-size: 12px;
}

/* Tab Button for Adding New File */
#addFileTab {
  font-size: 20px;
  line-height: 1;
  padding: 0 10px;
}

/* Tooltips */
.tooltip-inner {
  max-width: 200px;
  padding: 4px 8px;
  color: #fff;
  text-align: center;
  background-color: var(--arduino-teal-dark);
  border-radius: 4px;
}

/* Library Manager Styles */
.library-list .list-group-item {
  border-left: none;
  border-right: none;
  padding: 15px;
}

.library-list .list-group-item:first-child {
  border-top: none;
}

.library-list .list-group-item:last-child {
  border-bottom: none;
}

/* Board Manager Styles */
.board-info-card {
  padding: 12px;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  background-color: white;
}

.board-image {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}

.board-selector {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 15px;
}

.board-card {
  border: 2px solid #dee2e6;
  border-radius: 8px;
  padding: 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
}

.board-card:hover {
  border-color: var(--arduino-teal);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

.board-card.selected {
  border-color: var(--arduino-teal);
  background-color: rgba(0, 151, 157, 0.05);
}

.board-card img {
  max-height: 120px;
  margin-bottom: 10px;
}

/* Example sketches styles */
.example-card {
  height: 100%;
  transition: all 0.2s ease;
  cursor: pointer;
  overflow: hidden;
}

.example-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.example-card .card-img-top {
  height: 140px;
  object-fit: cover;
}

.example-card .badge {
  position: absolute;
  top: 10px;
  right: 10px;
}

.example-difficulty-beginner {
  background-color: #28a745;
}

.example-difficulty-intermediate {
  background-color: #fd7e14;
}

.example-difficulty-advanced {
  background-color: #dc3545;
}

.example-category-tag {
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: 12px;
  background-color: #e9ecef;
  color: #495057;
  display: inline-block;
  margin-right: 5px;
  margin-bottom: 5px;
}
