@font-face {
  font-family: "PP Editorial New";
  src: url("fonts/PPEditorialNew-Regular.otf");
  font-weight: normal;
  font-style: normal;
}

@font-face {
  font-family: "Gellix";
  src: url("fonts/GellixVF-TRIAL.ttf");
  font-weight: normal;
  font-style: normal;
}

:root {
  --primary-color: #ff2936;
  --primary-hover: #d61c27;
  --font-title: "PP Editorial New", Georgia, serif;
  --font-text: "Gellix", Arial, sans-serif;
  --bg-dark: #111;
  --bg-panel: #181818;
  --bg-code: #222222;
  --text-muted: #b3b3b3;
}

html {
  scroll-behavior: smooth;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  font-family: var(--font-text);
  background: var(--bg-dark);
  color: #ffffff;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.app-container {
  display: flex;
  width: 100%;
  height: 100%;
  flex: 1;
}

.panel {
  overflow: auto;
}

#course-panel {
  background: var(--bg-panel);
  padding: 30px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
}

#course-content {
  flex: 1;
  padding-right: 10px;
}

#course-content h2 {
  font-family: var(--font-title);
  color: #ffffff;
  margin-top: 2.5rem;
  margin-bottom: 1.2rem;
  font-size: 2rem;
  letter-spacing: -0.3px;
  line-height: 1.2;
  font-weight: initial;
}

#course-content h2:first-of-type {
  margin-top: 0;
}

#course-content p {
  line-height: 1.7;
  color: var(--text-muted);
  font-size: 1.05rem;
  margin: 0 0 0.85rem 0;
  letter-spacing: 0.1px;
}

#course-content strong {
  color: #ffffff;
  font-weight: 600;
}

#course-content hr {
  border: 0;
  height: 1px;
  background: #2d2d2d;
  margin: 2rem 0;
}

#course-content code {
  background: var(--bg-code);
  border: 1px solid #2d2d2d;
  padding: 3px 8px;
  border-radius: 6px;
  font-family: "Fira Code", "Courier New", monospace;
  font-size: 0.95rem;
  color: var(--primary-color);
  white-space: pre-wrap;
  display: inline-block;
  vertical-align: middle;
}

/* #course-content p > code:only-child {
  display: block;
  padding: 15px;
  line-height: 1.5;
  background: #141414;
  color: #e0e0e0;
  border-left: 3px solid var(--primary-color);
  margin: 1rem 0;
} */

#course-content ul {
  margin: 0 0 1.5rem 0;
  padding-left: 20px;
}

#course-content li {
  color: var(--text-muted);
  font-size: 1.05rem;
  line-height: 1.7;
  margin-bottom: 0.5rem;
}

#course-content li::marker {
  color: var(--primary-color);
}

.navigation {
  margin-top: 25px;
  padding-top: 15px;
  border-top: 1px solid #2d2d2d;
  display: flex;
  gap: 12px;
  background: var(--bg-panel);
}

.navigation button {
  font-family: var(--font-text);
  background: #262626;
  color: #ffffff;
  border: 1px solid #333;
  padding: 12px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

.navigation button:hover:not(:disabled) {
  background: var(--primary-color);
  border-color: var(--primary-color);
  transform: translateY(-1px);
}

.navigation button:disabled {
  opacity: 0.25;
  cursor: not-allowed;
}

#right-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.CodeMirror {
  height: 100% !important;
  font-size: 14px;
  font-family: monospace;
}

#preview-panel {
  background: white;
  overflow: hidden;
}

iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.gutter {
  background-color: #222;
  background-repeat: no-repeat;
  background-position: 50%;
  transition: background-color 0.2s;
}

.gutter:hover {
  background-color: var(--primary-color);
}

.gutter.gutter-horizontal {
  cursor: col-resize;
}

.gutter.gutter-vertical {
  cursor: row-resize;
}

#course-panel::-webkit-scrollbar {
  width: 6px;
}
#course-panel::-webkit-scrollbar-track {
  background: transparent;
}
#course-panel::-webkit-scrollbar-thumb {
  background: #333;
  border-radius: 10px;
}
#course-panel::-webkit-scrollbar-thumb:hover {
  background: var(--primary-color);
}

.mobile-nav {
  display: none;
}

.lesson-selector-container {
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid #2d2d2d;
}

#lesson-select {
  width: 100%;
  padding: 12px;
  background: #222222;
  color: #ffffff;
  border: 1px solid #333;
  border-radius: 8px;
  font-family: var(--font-text);
  font-size: 0.95rem;
  cursor: pointer;
  outline: none;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
  appearance: none;
  -webkit-appearance: none;
  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%3cpolyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 40px;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

#lesson-select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(255, 41, 54, 0.2);
}

#lesson-select option {
  background: #181818;
  color: #ffffff;
  padding: 10px;
}

#editor-panel {
  display: flex;
  flex-direction: column;
}

.file-tabs {
  display: flex;
  background: var(--bg-panel);
  border-bottom: 1px solid #2d2d2d;
  overflow-x: auto;
  flex-shrink: 0;
}

.file-tabs::-webkit-scrollbar {
  height: 4px;
}

.file-tab {
  padding: 10px 20px;
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font-text);
  font-size: 0.9rem;
  border-right: 1px solid #2d2d2d;
  background: var(--bg-panel);
  transition: all 0.2s ease;
  user-select: none;
}

.file-tab:hover {
  background: #222;
}

.file-tab.active {
  color: #ffffff;
  background: var(--bg-code);
  border-bottom: 2px solid var(--primary-color);
}

.CodeMirror {
  flex: 1;
  height: auto !important;
  font-size: 14px;
  font-family: monospace;
}

@media (max-width: 768px) {
  .app-container {
    flex: 1;
    height: auto;
    position: relative;
    overflow: hidden;
  }

  .gutter {
    display: none !important;
  }

  #course-panel,
  #right-panel,
  #editor-panel,
  #preview-panel {
    width: 100% !important;
    height: 100% !important;
    position: absolute;
    top: 0;
    left: 0;
    display: none !important;
  }

  .app-container[data-view="course"] #course-panel {
    display: flex !important;
  }

  .app-container[data-view="editor"] #right-panel {
    display: flex !important;
  }
  .app-container[data-view="editor"] #editor-panel {
    display: block !important;
  }

  .app-container[data-view="preview"] #right-panel {
    display: flex !important;
  }
  .app-container[data-view="preview"] #preview-panel {
    display: block !important;
  }

  #course-panel {
    padding: 20px;
    padding-bottom: 30px;
  }

  #course-content h2 {
    font-size: 1.6rem;
    margin-top: 2rem;
  }

  .CodeMirror-lines {
    padding-bottom: 40px !important;
  }

  .mobile-nav {
    display: flex;
    width: 100%;
    height: 60px;
    background: #141414;
    border-top: 1px solid #2d2d2d;
    z-index: 100;
    flex-shrink: 0;
    padding-bottom: env(safe-area-inset-bottom);
    height: calc(60px + env(safe-area-inset-bottom));
  }

  .tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: #888;
    font-family: var(--font-title);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s;
    padding-bottom: calc(env(safe-area-inset-bottom) / 2);
  }

  .tab-btn.active {
    color: var(--primary-color);
    border-top: 2px solid var(--primary-color);
  }
}
