html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
}

.template-page {
  margin-bottom: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.template-page main.container {
  flex: 1;
}

.template-page--fixed {
  overflow: hidden;
}

.template-page--fixed main.container {
  overflow: hidden;
}

.thin-menu {
  border-bottom: 1px solid #e6e6e6;
  background: #fafafa;
  padding: 6px 0;
  font-size: 13px;
}

.thin-menu__brand {
  font-weight: 600;
  letter-spacing: 0.3px;
}

.thin-menu__links a {
  color: #2b2b2b;
  text-decoration: none;
  margin-left: 14px;
}

.thin-menu__links {
  color: #2b2b2b;
  font-size: 13px;
}

.thin-menu__links a:hover {
  text-decoration: underline;
}

.thin-menu__right {
  display: inline-flex;
  align-items: center;
  gap: 14px;
}

.admin-menu {
  position: relative;
  font-size: 13px;
  color: #2b2b2b;
}

.admin-menu__label {
  cursor: pointer;
}

.admin-menu__dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: 18px;
  background: #ffffff;
  border: 1px solid #e2e2e2;
  border-radius: 6px;
  padding: 6px 0;
  min-width: 180px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
  z-index: 20;
}

.admin-menu:hover .admin-menu__dropdown {
  display: block;
}

.admin-menu__item {
  display: block;
  padding: 6px 12px;
  color: #2b2b2b;
  text-decoration: none;
  font-size: 13px;
}

.admin-menu__item:hover {
  background: #f1f1f1;
}

.python-run-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 280px;
  gap: 16px;
  height: 100%;
}

.panel {
  background: #ffffff;
  border: 1px solid #e4e4e4;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.panel__header {
  padding: 10px 12px;
  border-bottom: 1px solid #ededed;
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #424242;
  background: #f7f7f7;
}

.panel__header--editor {
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-transform: none;
  letter-spacing: 0.03em;
}

.panel__header--files {
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-transform: none;
  letter-spacing: 0.03em;
}

.editor-actions {
  display: flex;
  gap: 8px;
}

.panel__body {
  padding: 12px;
  overflow: auto;
  flex: 1;
}

.panel__body--editor {
  padding: 0;
  min-height: 360px;
  overflow: hidden;
}

.panel__body--chat {
  display: flex;
  flex-direction: column;
}

.panel__footer {
  border-top: 1px solid #ededed;
  padding: 12px;
  background: #fcfcfc;
}

.panel__footer-title {
  font-size: 12px;
  font-weight: 600;
  color: #4a4a4a;
  margin-bottom: 8px;
}

.io-status {
  font-size: 12px;
  color: #6a6a6a;
  margin-bottom: 8px;
}

.file-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.file-list__item {
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 14px;
  color: #2f2f2f;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.file-list__item:hover {
  background: #f1f1f1;
}

.file-list__item.is-active {
  background: #e9f1ff;
  color: #1b4e9b;
  font-weight: 600;
}

.file-list__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-list__select {
  flex: 1;
  margin: 0;
}

.file-list__name-btn {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  width: 100%;
}

.file-list__actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.file-list__empty {
  padding: 8px 10px;
  color: #7a7a7a;
  font-size: 13px;
}

.file-history {
  margin-top: 16px;
  border-top: 1px solid #ededed;
  padding-top: 12px;
}

.file-history__title {
  font-size: 11px;
  font-weight: 600;
  color: #4a4a4a;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.file-history__chevron {
  display: inline-block;
  font-size: 11px;
  transition: transform 0.15s ease;
  color: #7a7a7a;
}

.file-history__title.is-open .file-history__chevron {
  transform: rotate(90deg);
}

.admin-menu .dropdown-menu {
  display: none;
  margin-top: 0;
}

.admin-menu:hover .dropdown-menu {
  display: block;
}

.file-history__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.file-history__list.is-hidden {
  display: none;
}

.file-history__item {
  margin-bottom: 6px;
}

.file-history__item.is-active .file-history__btn {
  background: #eef4ff;
  color: #1b4e9b;
}

.file-history__form {
  margin: 0;
}

.file-history__btn {
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: #f6f6f6;
  color: #2f2f2f;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
}

.file-history__btn:hover {
  background: #ececec;
}

.file-history__empty {
  font-size: 12px;
  color: #7a7a7a;
  padding: 6px 4px;
}

.code-editor {
  width: 100%;
  height: 100%;
  min-height: 0;
}

.io-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.terminal {
  display: flex;
  flex-direction: column;
  border: 1px solid #1f232b;
  border-radius: 8px;
  background: #0f1115;
  min-height: 180px;
  max-height: 320px;
  overflow: hidden;
  font-family: "SFMono-Regular", "Consolas", "Liberation Mono", "Menlo", monospace;
  font-size: 13px;
}

.terminal-output {
  flex: 1;
  margin: 0;
  padding: 12px;
  color: #d7dce2;
  white-space: pre-wrap;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: #3a3f4b #12151c;
}

.terminal-output::-webkit-scrollbar {
  width: 8px;
}

.terminal-output::-webkit-scrollbar-track {
  background: #12151c;
}

.terminal-output::-webkit-scrollbar-thumb {
  background: #3a3f4b;
  border-radius: 6px;
}

.terminal-input-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-top: 1px solid #1f232b;
  background: #12151c;
  color: #d7dce2;
}

.terminal-prompt {
  color: #6ea8ff;
  font-weight: 600;
}

.terminal-input {
  flex: 1;
  background: transparent;
  border: none;
  color: #d7dce2;
  outline: none;
  font-family: inherit;
  font-size: inherit;
}

.terminal-input::placeholder {
  color: #7b8496;
}

.login-page {
  min-height: calc(100vh - 140px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 12px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: #ffffff;
  border: 1px solid #e2e2e2;
  border-radius: 12px;
  padding: 28px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
}

.chat-log {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 13px;
  color: #3a3a3a;
}

.chat-log__item {
  padding: 10px 12px;
  border-radius: 10px;
  background: #f1f4f8;
}

.chat-log__item--system {
  background: #fff3cd;
  color: #6b4e00;
}

.chat-input {
  width: 100%;
  border: 1px solid #dcdcdc;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
}

.chat-timestamp {
  font-size: 11px;
  margin-top: 2px;
}

@media (max-width: 991px) {
  .python-run-layout {
    grid-template-columns: 1fr;
  }
}
.question-panel-clickable {
  cursor: pointer;
  border-radius: 8px;
  padding: 8px;
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.question-panel-clickable:hover {
  background: #f5f7ff;
  box-shadow: 0 0 0 1px #d7defa inset;
}

.question-panel-active {
  background: #e9f1ff;
  color: #1b4e9b;
  font-weight: 600;
  box-shadow: 0 0 0 1px #c2d3ff inset;
}

.theme-toggle {
  background: transparent;
  border: 1px solid #ccc;
  color: inherit;
  border-radius: 999px;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
}

.theme-toggle:hover {
  background: rgba(0, 0, 0, 0.05);
}

html[data-theme="dark"] {
  color-scheme: dark;
}

html[data-theme="dark"] body {
  background: #121418;
  color: #d7dce2;
}

html[data-theme="dark"] .thin-menu {
  background: #1a1d23;
  border-bottom-color: #2a2e36;
}

html[data-theme="dark"] .thin-menu__links,
html[data-theme="dark"] .thin-menu__links a,
html[data-theme="dark"] .admin-menu,
html[data-theme="dark"] .admin-menu__item {
  color: #d7dce2;
}

html[data-theme="dark"] .admin-menu__dropdown {
  background: #1f2229;
  border-color: #2a2e36;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
}

html[data-theme="dark"] .admin-menu__item:hover {
  background: #2a2e36;
}

html[data-theme="dark"] .theme-toggle {
  border-color: #3a3f4b;
}

html[data-theme="dark"] .theme-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .panel,
html[data-theme="dark"] .login-card,
html[data-theme="dark"] .chat-log__item {
  background: #1a1d23;
  border-color: #2a2e36;
  color: #d7dce2;
}

html[data-theme="dark"] .panel__header,
html[data-theme="dark"] .panel__footer {
  background: #1f2229;
  border-color: #2a2e36;
  color: #c4c9d1;
}

html[data-theme="dark"] .file-list__item {
  color: #d7dce2;
}

html[data-theme="dark"] .file-list__item:hover {
  background: #2a2e36;
}

html[data-theme="dark"] .file-list__item.is-active,
html[data-theme="dark"] .file-history__item.is-active .file-history__btn,
html[data-theme="dark"] .question-panel-active {
  background: #1d3a6b;
  color: #dce7ff;
}

html[data-theme="dark"] .file-history__btn {
  background: #22262d;
  color: #d7dce2;
}

html[data-theme="dark"] .file-history__btn:hover {
  background: #2a2e36;
}

html[data-theme="dark"] .question-panel-clickable:hover {
  background: #1f2229;
  box-shadow: 0 0 0 1px #2f3644 inset;
}

html[data-theme="dark"] .table {
  --bs-table-bg: #1a1d23;
  --bs-table-color: #d7dce2;
  --bs-table-striped-bg: #1f2229;
  --bs-table-striped-color: #d7dce2;
  --bs-table-border-color: #2a2e36;
  color: #d7dce2;
}

html[data-theme="dark"] .list-group-item {
  background: #1a1d23;
  color: #d7dce2;
  border-color: #2a2e36;
}

html[data-theme="dark"] .list-group-item-action:hover,
html[data-theme="dark"] .list-group-item.active {
  background: #2a2e36;
  color: #fff;
}

html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select {
  background: #1f2229;
  color: #d7dce2;
  border-color: #2a2e36;
}

html[data-theme="dark"] .form-control::placeholder {
  color: #7b8496;
}

html[data-theme="dark"] .chat-input {
  background: #1f2229;
  color: #d7dce2;
  border-color: #2a2e36;
}

html[data-theme="dark"] .chat-log {
  color: #d7dce2;
}

html[data-theme="dark"] .chat-log__item--system {
  background: #3d3416;
  color: #f1d78a;
}

html[data-theme="dark"] .text-muted {
  color: #8a93a3 !important;
}

html[data-theme="dark"] .btn-outline-primary {
  color: #6ea8ff;
  border-color: #3a5fa5;
}

html[data-theme="dark"] .btn-outline-primary:hover {
  background: #1d3a6b;
  color: #fff;
}

html[data-theme="dark"] a {
  color: #6ea8ff;
}

/* PythonRun: AI Destek paneli */
.ai-panel {
  border-top: 1px solid #ededed;
  padding: 10px 12px;
  background: #f7fbfd;
}

.ai-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  margin-bottom: 8px;
}

.ai-panel__log {
  max-height: 280px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}

.ai-msg {
  border-radius: 8px;
  padding: 8px 10px;
  max-width: 92%;
  font-size: 0.9rem;
}

.ai-msg__meta {
  font-size: 0.75rem;
  opacity: 0.7;
  margin-bottom: 2px;
}

.ai-msg__body {
  white-space: pre-wrap;
  word-break: break-word;
}

.ai-msg--student {
  align-self: flex-end;
  background: #e9f1ff;
}

.ai-msg--ai {
  align-self: flex-start;
  background: #ffffff;
  border: 1px solid #d8e6ee;
}

.ai-msg--pending {
  opacity: 0.6;
  font-style: italic;
}

.ai-msg--error {
  align-self: stretch;
  background: #fdecec;
  color: #9b1c1c;
}

.ai-panel__form {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.ai-panel__hint {
  font-size: 0.75rem;
  color: #6c757d;
  margin-top: 4px;
}

html[data-theme="dark"] .ai-panel {
  background: #171a20;
  border-color: #2a2e36;
}

html[data-theme="dark"] .ai-msg--student {
  background: #1d3a6b;
  color: #dce7ff;
}

html[data-theme="dark"] .ai-msg--ai {
  background: #1a1d23;
  border-color: #2a2e36;
  color: #d7dce2;
}

html[data-theme="dark"] .ai-msg--error {
  background: #4a1d1d;
  color: #ffd6d6;
}

html[data-theme="dark"] .ai-panel__hint {
  color: #8b949e;
}
