:root {
  --accent: #B8906B;
  --rust: #A8440A;
  --border: rgba(255, 255, 255, 0.08);
  --surface: #1E2736;
  --surface2: #252F40;
  --text: rgba(255, 255, 255, 0.85);
  --text-dim: rgba(255, 255, 255, 0.45);
  --green: #4EC9A0;
  --bg: #151C28;
  --sidebar-bg: #1A2235;
  --ink: #1C2330;
}

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

html,
body {
  height: 100%;
  font-family: 'Josefin Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

/* ── TOPBAR ── */
.topbar {
  height: 48px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  flex-shrink: 0;
  user-select: none;
}

.tb-left,
.tb-right {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 250px;
}

.tb-right {
  justify-content: flex-end;
}

.tb-logo {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  color: white;
  text-decoration: none;
}

.tb-logo span {
  color: var(--accent);
}

.tb-sep {
  color: var(--border);
  font-size: 16px;
  margin: 0 4px;
}

.tb-filename {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 500;
}

.tb-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #FFD580;
  display: none;
}

.tb-dot.visible {
  display: block;
}

/* Mode Switcher (Editor Style) */
.tb-center {
  flex: 1;
  display: flex;
  justify-content: center;
}

.mode-switcher {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  padding: 3px;
  display: flex;
  gap: 2px;
}

.mode-btn {
  font-family: inherit;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  padding: 6px 16px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  transition: 0.2s;
}

.mode-btn:hover {
  color: var(--text);
}

.mode-btn.active {
  background: var(--accent);
  color: var(--ink);
}

.tb-btn {
  font-family: inherit;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 7px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
  transition: 0.18s;
}

.tb-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.tb-primary {
  background: var(--rust);
  border-color: var(--rust);
  color: white;
}

.tb-primary:hover {
  background: #C05510;
}

/* Dropdown System (Editor Style) */
.dropdown-container {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  min-width: 200px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  padding: 6px;
  display: none;
  flex-direction: column;
  z-index: 1000;
  animation: dropdownIn 0.2s ease-out;
}

.dropdown-menu.show {
  display: flex;
}

@keyframes dropdownIn {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dropdown-item {
  background: transparent;
  border: none;
  padding: 10px 12px;
  text-align: left;
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.15s;
}

.dropdown-item span.icon {
  font-size: 14px;
  opacity: 0.7;
}

.dropdown-item:hover {
  background: #F4EDE4;
  color: var(--ink);
}

.dropdown-item.danger {
  color: #C0392B;
}

.dropdown-item.danger:hover {
  background: rgba(192, 57, 43, 0.05);
}

.dropdown-sep {
  height: 1px;
  background: rgba(0, 0, 0, 0.06);
  margin: 4px 6px;
}

.action-btn {
  font-family: inherit;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  height: 32px;
  padding: 0 16px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: 0.15s;
  background: var(--rust);
  color: white;
}

.action-btn:hover {
  background: #C05510;
  transform: translateY(-1px);
}

/* ── ANA ALAN ── */
.app-workspace {
  display: grid;
  grid-template-columns: 240px 1fr;
  height: calc(100vh - 48px - 22px);
  overflow: hidden;
}

.sidebar-v2 {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  overflow: hidden;
}

.activity-bar {
  width: 48px;
  background: var(--bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 12px;
  gap: 8px;
  flex-shrink: 0;
}

.ab-item {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: var(--text-dim);
  cursor: pointer;
  transition: 0.15s;
  font-size: 14px;
}

.ab-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: white;
}

.ab-item.active {
  background: var(--accent);
  color: var(--ink);
}

.ab-spacer {
  flex: 1;
}

.sb-content {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
}

.sb-pane {
  display: none;
}

.sb-pane.active {
  display: block;
  animation: slideIn 0.2s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-5px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.pane-header {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent);
  margin-bottom: 20px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.info-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  padding: 12px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.6;
  margin-bottom: 16px;
}

.tool-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.tool-field label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-dim);
}

.main-area {
  position: relative;
  overflow: hidden;
}

.mode-panel {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
}

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

/* KOD MODU */
#monacoContainer {
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

/* ÖNİZLEME MODU */
.preview-bar {
  height: 40px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  flex-shrink: 0;
}

.pb-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-dim);
}

.pb-spacer {
  flex: 1;
}

.pb-btn {
  font-family: inherit;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  padding: 5px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
  transition: 0.15s;
}

.pb-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.pb-back {
  background: transparent;
  border-color: transparent;
  color: var(--accent);
}

.pb-back:hover {
  background: rgba(184, 144, 107, 0.1);
  border-color: rgba(184, 144, 107, 0.2);
}

.pb-open {
  background: rgba(78, 201, 160, 0.1);
  border-color: rgba(78, 201, 160, 0.25);
  color: var(--green);
}

.pb-open:hover {
  background: rgba(78, 201, 160, 0.2);
  color: var(--green);
}

.pb-sync {
  background: rgba(184, 144, 107, 0.12);
  border-color: rgba(184, 144, 107, 0.3);
  color: var(--accent);
}

.pb-sync:hover {
  background: rgba(184, 144, 107, 0.22);
}

.pb-sync.hidden {
  display: none;
}

.preview-wrap {
  flex: 1;
  position: relative;
  background: white;
}

#previewFrame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.visual-edit-banner {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: #FFD580;
  color: #1C2330;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  text-align: center;
  padding: 5px;
  z-index: 10;
}

.visual-edit-banner.hidden {
  display: none;
}

/* ── STATUS BAR ── */
.statusbar {
  height: 22px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 16px;
  flex-shrink: 0;
}

.sb-item {
  font-size: 10px;
  color: var(--text-dim);
  cursor: default;
}

.sb-spacer {
  flex: 1;
}

.sb-lang {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent);
}

/* ── TOAST ── */
#toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface2);
  color: var(--text);
  font-family: 'Josefin Sans', sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.8px;
  padding: 9px 18px;
  z-index: 9999;
  border-left: 3px solid var(--accent);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
  white-space: nowrap;
}

/* Monaco scrollbar */
.monaco-scrollable-element>.scrollbar {
  opacity: 0.3 !important;
}

.preview-tip-banner {
  background: var(--bg);
  border-top: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 10px;
  padding: 8px 16px;
  text-align: center;
  letter-spacing: 0.5px;
}

.preview-tip-banner b {
  color: var(--accent);
}

.pane-sep {
  height: 1px;
  background: var(--border);
  margin: 12px 0;
}

/* ── MODALS ── */
.modal-ov {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
}

.modal-ov.hidden {
  display: none;
}

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 30px;
  border-radius: 16px;
  width: 100%;
  position: relative;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.modal-close {
  position: absolute;
  top: 15px;
  right: 15px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 20px;
  cursor: pointer;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: 0.2s;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.05);
  color: white;
}

.modal-eyebrow {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--accent);
  margin-bottom: 8px;
}

.modal-title {
  font-size: 20px;
  font-weight: 600;
  color: white;
  margin-bottom: 12px;
}

.modal-sub {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.6;
}