:root {
  --bg-color: #0d1117;
  --panel-bg: rgba(22, 27, 34, 0.4);
  --panel-border: rgba(255, 255, 255, 0.08);
  --text-main: #c9d1d9;
  --text-muted: #8b949e;
  --accent: #58a6ff;
  --accent-hover: #3182ce;
  --success: #2ea043;
  --danger: #da3633;
  --warning: #d29922;
  --input-bg: rgba(13, 17, 23, 0.6);
  --input-border: rgba(255, 255, 255, 0.12);
  --font-sans: 'Inter', sans-serif;
  --font-mono: 'Fira Code', monospace;
  --tree-indent: 16px;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Global SVG Fixes (Crucial) */
svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.blob {
  position: absolute;
  filter: blur(80px);
  z-index: -1;
  opacity: 0.5;
  border-radius: 50%;
  animation: float 10s infinite alternate;
}

.blob-1 {
  top: -100px;
  left: -100px;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(88, 166, 255, 0.3) 0%, transparent 70%);
}

.blob-2 {
  bottom: -100px;
  right: 20%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(163, 113, 247, 0.2) 0%, transparent 70%);
  animation-duration: 15s;
}

@keyframes float {
  0% {
    transform: translateY(0) scale(1);
  }

  100% {
    transform: translateY(30px) scale(1.05);
  }
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  width: 100%;
  max-width: 500px;
  padding: 30px;
}

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

.modal-header h2 {
  font-size: 18px;
  font-weight: 600;
}

.modal-body {
  font-size: 14px;
  line-height: 1.6;
}

.modal-body p {
  margin-bottom: 8px;
}

.app-container {
  display: block;
}

.app-layout {
  display: flex;
  height: 100vh;
  padding: 20px;
  gap: 20px;
}

.app-footer {
  padding: 12px 20px;
  background: var(--panel-bg);
  border-top: 1px solid var(--panel-border);
  backdrop-filter: blur(16px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  text-align: center;
}

.app-footer [data-ataturk-quote-widget] {
  width: 100% !important;
  max-width: 1200px;
  font-family: var(--font-sans) !important;
  font-size: 13px !important;
  opacity: 0.9;
  transition: opacity 0.3s;
}

.app-footer [data-ataturk-quote-widget]:hover {
  opacity: 1;
}

.glass-panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  backdrop-filter: blur(16px);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.sidebar {
  width: 340px;
  min-width: 340px;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--panel-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.room-share-box {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.03);
}

.room-share-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.room-share-input {
  flex: 1;
  background: transparent;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--text-main);
  font-size: 12px;
  min-width: 0;
}

.btn-copy-room {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 12px;
  transition: opacity 0.2s ease;
}

.btn-copy-room:hover {
  opacity: 0.9;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo svg {
  width: 24px;
  height: 24px;
  color: var(--accent);
}

.logo h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.logo h1 .dot {
  color: var(--accent);
}

.sidebar-actions {
  display: flex;
  gap: 4px;
}

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 5px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

.btn-icon svg {
  width: 22px;
  height: 22px;
}

.text-danger {
  color: var(--danger);
}

.text-danger:hover {
  background: rgba(218, 54, 51, 0.1);
  color: var(--danger);
}

/* TREE UI */
.tree-container {
  padding: 10px;
  overflow-y: auto;
  flex: 1;
}

.loading-state {
  text-align: center;
  padding: 20px;
  color: var(--text-muted);
  font-size: 13px;
}

.tree-node {
  margin-bottom: 2px;
}

.tree-row {
  display: flex;
  align-items: center;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.1s;
  user-select: none;
  font-size: 13px;
  gap: 6px;
  color: var(--text-main);
}

.tree-row:hover {
  background: rgba(255, 255, 255, 0.05);
}

.tree-row.active {
  background: rgba(88, 166, 255, 0.1);
  color: var(--accent);
  border-left: 2px solid var(--accent);
}

.tree-row svg.icon {
  width: 22px;
  height: 22px;
  opacity: 0.8;
  scale: 0.8;
}

.tree-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

.tree-actions {
  display: none;
  gap: 2px;
}

.tree-row:hover .tree-actions {
  display: flex;
}

.tree-children {
  padding-left: var(--tree-indent);
  display: none;
  border-left: 1px solid var(--panel-border);
  margin-left: 12px;
}

.tree-node.expanded > .tree-children {
  display: block;
}

.arrow {
  width: 22px;
  height: 22px;
  transition: transform 0.2s;
  opacity: 0.5;
  scale: 0.5;
}

.expanded > .tree-row .arrow {
  transform: rotate(90deg);
}

.no-arrow {
  width: 12px;
  height: 12px;
}

.method-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 4px;
  border-radius: 4px;
  text-transform: uppercase;
  display: inline-block;
  width: 45px;
  text-align: center;
}

.method-badge.get {
  background: rgba(46, 160, 67, 0.2);
  color: #3fb950;
}

.method-badge.post {
  background: rgba(88, 166, 255, 0.2);
  color: var(--accent);
}

.method-badge.put {
  background: rgba(210, 153, 34, 0.2);
  color: #d29922;
}

.method-badge.patch {
  background: rgba(163, 113, 247, 0.2);
  color: #a371f7;
}

.method-badge.delete {
  background: rgba(218, 54, 51, 0.2);
  color: #ff7b72;
}

/* MAIN PANEL */
.main-content {
  flex: 1;
  position: relative;
}

.welcome-screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px;
}

.editor-screen {
  padding: 30px;
  overflow-y: auto;
  height: 100%;
  display: flex;
  flex-direction: column;
}

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

.editor-header h2 {
  font-size: 20px;
  font-weight: 600;
}

.breadcrumbs {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 20px;
  font-family: var(--font-mono);
}

/* HTTP CLIENTS AREA */
.http-clients-area {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.live-url-box {
  background: rgba(88, 166, 255, 0.08);
  border: 1px dashed var(--accent);
  border-radius: 8px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.url-badge {
  font-weight: 600;
  font-size: 12px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  width: 90px;
}

.live-url-link {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text-main);
  text-decoration: none;
  word-break: break-all;
  transition: color 0.2s;
}

.live-url-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

.prod-url-box {
  background: rgba(46, 160, 67, 0.08);
  border: 1px solid rgba(46, 160, 67, 0.4);
  border-radius: 8px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.prod-url-input {
  border: none;
  background: transparent;
  font-family: var(--font-mono);
  font-size: 14px;
  flex: 1;
  outline: none;
  color: var(--text-main);
}

.btn-send {
  background: rgba(46, 160, 67, 0.2);
  border: 1px solid #2ea043;
  color: #fff;
  padding: 6px 12px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-send:hover {
  background: #2ea043;
}

/* PROD RESPONSE PANEL */
.prod-response-wrapper {
  margin-bottom: 20px;
  animation: fadeIn 0.3s;
}

.prod-resp-header {
  background: rgba(22, 27, 34, 0.8);
  border: 1px solid var(--input-border);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  padding: 10px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.prod-status {
  font-family: var(--font-mono);
  color: var(--accent);
  padding: 2px 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
}

.prod-time {
  font-family: var(--font-mono);
  color: var(--warning);
  padding: 2px 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
}

/* Forms */
.form-row {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
}

.flex-1 {
  flex: 1;
}

.flex-4 {
  flex: 4;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.help-text {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
  margin-bottom: 8px;
  margin-top: 10px;
}

input,
select {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  color: var(--text-main);
  border-radius: 8px;
  padding: 10px 14px;
  font-family: var(--font-sans);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

input:focus,
select:focus {
  border-color: var(--accent);
}

.input-prefix {
  display: flex;
  align-items: center;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 8px;
  overflow: hidden;
}

.input-prefix:focus-within {
  border-color: var(--accent);
}

.input-prefix .prefix {
  padding: 10px 14px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.03);
  border-right: 1px solid var(--input-border);
  font-family: var(--font-mono);
  font-size: 13px;
}

.input-prefix input {
  border: none;
  border-radius: 0;
  flex: 1;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary:hover {
  filter: brightness(1.1);
}

/* Tabs */
.editor-tabs-container {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.editor-tabs {
  display: flex;
  border-bottom: 1px solid var(--panel-border);
  margin-bottom: 16px;
  gap: 2px;
}

.tab-btn {
  background: transparent;
  border: none;
  padding: 10px 20px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  border-radius: 6px 6px 0 0;
}

.tab-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}

.tab-btn.active {
  color: var(--text-main);
  border-bottom: 2px solid var(--accent);
  background: rgba(88, 166, 255, 0.05);
}

.tab-pane {
  display: none;
  flex-direction: column;
  flex: 1;
}

.tab-pane.active {
  display: flex;
  animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.ace-wrapper {
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  margin-top: 1rem;
}

.form-actions {
  margin-top: 20px;
  padding-top: 20px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  position: sticky;
  bottom: -30px; /* Aligns with editor-screen padding */
  background: var(--bg-color); /* Match editor background */
  z-index: 10;
  margin-left: -30px;
  margin-right: -30px;
  padding-left: 30px;
  padding-right: 30px;
  padding-bottom: 20px;
  border-top: 1px solid var(--panel-border);
  box-shadow: 0 -10px 20px rgba(0, 0, 0, 0.2);
}

.form-actions .btn-primary {
  width: auto;
  min-width: 180px;
}

.shortcut-hint {
  font-size: 10px;
  font-family: var(--font-mono);
  background: rgba(0, 0, 0, 0.3);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--accent);
  margin-left: 10px;
  text-transform: uppercase;
}

/* EXTERNAL LINKS OVERLAY */
.github-link {
  position: fixed;
  bottom: 10px;
  left: 10px;
  color: var(--text-muted);
  z-index: 100;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  padding: 8px;
  border-radius: 50%;
  backdrop-filter: blur(8px);
}

.github-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  transform: scale(1.05);
}

.github-link svg {
  width: 24px;
  height: 24px;
}

.coffee-link {
  position: fixed;
  bottom: 10px;
  left: 60px;
  color: var(--text-main);
  background: #ffdd00;
  color: #000;
  padding: 10px 16px;
  border-radius: 30px;
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 100;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(255, 221, 0, 0.3);
  transition: all 0.2s;
}

.coffee-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(255, 221, 0, 0.4);
}

.coffee-link svg {
  width: 18px;
  height: 18px;
}

/* MOBILE MENU BTN */
.mobile-menu-btn {
  display: none;
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 200;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(8px);
  padding: 8px;
  border-radius: 8px;
  color: var(--text-main);
}

/* RESPONSIVE DESIGN */
@media (max-width: 768px) {
  .github-link {
    top: auto;
    bottom: 80px;
    /* Above coffee link */
  }

  .mobile-menu-btn {
    display: flex;
  }

  .app-layout {
    flex-direction: column;
    padding: 0;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: -380px;
    width: 300px;
    height: 100vh;
    z-index: 150;
    transition: left 0.3s ease;
    border-radius: 0;
    border-right: 1px solid var(--panel-border);
    border-left: none;
    border-top: none;
    border-bottom: none;
    background: rgba(13, 17, 23, 0.95);
  }

  .sidebar.mobile-open {
    left: 0;
  }

  .main-content {
    width: 100%;
    margin-top: 60px;
    /* Room for hamburger */
    border-radius: 16px 16px 0 0;
    height: calc(100vh - 60px);
  }

  .form-row {
    flex-direction: column;
    gap: 0;
  }

  .live-url-box {
    flex-direction: column;
    align-items: flex-start;
  }

  #btnCopyCurl,
  #btnCopyFetch {
    margin-left: 0;
    margin-top: 10px;
    width: 100%;
  }

  .live-url-box > div {
    flex-wrap: wrap;
  }
}

/* SPLIT EDITOR LAYOUT */
.split-editor-layout {
  display: flex;
  gap: 20px;
  margin-top: 20px;
}

.split-left,
.split-right {
  flex: 1;
  display: flex;
  flex-direction: column;
}

@media (max-width: 1024px) {
  .split-editor-layout {
    flex-direction: column;
  }
}
