/* ===== PLAYGROUND LAYOUT ===== */
.playground-layout {
  display: flex;
  height: 100dvh;
  height: 100vh;
  overflow: hidden;
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: #0d0d0d;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
  z-index: 50;
}

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

.sidebar-logo { font-size: 0.82rem; }
.sidebar-version {
  display: block;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-top: 0.35rem;
}

.sidebar-close-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.2s, color 0.2s;
  flex-shrink: 0;
}
.sidebar-close-btn:hover { background: rgba(255,255,255,0.06); color: var(--text); }

.sidebar-search { padding: 0.75rem; }
.search-input {
  width: 100%;
  background: #111;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.78rem;
  font-family: var(--font);
  outline: none;
}
.search-input::placeholder { color: var(--text-dim); }
.search-input:focus { border-color: var(--border-light); }

.sidebar-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--border);
}
.sidebar-stat {
  padding: 0.5rem 0.25rem;
  text-align: center;
  border-right: 1px solid var(--border);
}
.sidebar-stat:last-child { border-right: none; }
.sidebar-stat-val { font-size: 0.82rem; font-weight: 700; font-family: var(--mono); color: var(--text); }
.sidebar-stat-label { font-size: 0.55rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-dim); }

.sidebar-section-label {
  padding: 0.75rem 1rem 0.25rem;
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  font-weight: 600;
}

.endpoint-list { flex: 1; overflow-y: auto; }
.endpoint-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.65rem 1rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font);
  text-align: left;
  transition: background 0.2s;
  border-left: 2px solid transparent;
}
.endpoint-item:hover { background: rgba(255,255,255,0.03); color: var(--text); }
.endpoint-item.active { background: rgba(249,115,22,0.08); border-left-color: var(--orange); color: var(--text); }
.endpoint-name { font-size: 0.75rem; font-weight: 600; font-family: var(--mono); }

.method-badge {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  flex-shrink: 0;
  font-family: var(--mono);
}
.method-get { background: rgba(34,197,94,0.15); color: #4ade80; }
.method-post { background: rgba(249,115,22,0.15); color: #fb923c; }

.sidebar-user {
  margin-top: auto;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.sidebar-user-avatar { width: 28px; height: 28px; border-radius: 4px; object-fit: cover; border: 1px solid var(--border-light); }
.sidebar-user-name { font-size: 0.78rem; font-weight: 600; }
.sidebar-user-plan { font-size: 0.62rem; color: var(--orange); text-transform: uppercase; letter-spacing: 0.05em; }

/* ===== SIDEBAR BACKDROP (mobile) ===== */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 49;
  backdrop-filter: blur(2px);
}
.sidebar-backdrop.active { display: block; }

/* ===== MAIN AREA ===== */
.playground-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.playground-topbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border);
  background: #0d0d0d;
  justify-content: flex-end;
  flex-shrink: 0;
}

/* Hamburger button - hidden on desktop */
.hamburger-btn {
  display: none;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 16px;
  line-height: 1;
  margin-right: auto;
  transition: all 0.2s;
  font-family: var(--font);
}
.hamburger-btn:hover { border-color: var(--border-light); color: var(--text); }

.playground-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.empty-state { text-align: center; padding: 24px; }
.empty-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}
.empty-desc { font-size: 0.82rem; color: var(--text-dim); }

/* ===== ENDPOINT PANEL ===== */
.playground-endpoint {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.endpoint-header {
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.endpoint-header-info { display: flex; align-items: center; gap: 0.75rem; }
.endpoint-title {
  font-size: 0.95rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  font-family: var(--mono);
}
.endpoint-path { font-size: 0.72rem; font-family: var(--mono); color: var(--text-dim); }

.endpoint-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  flex: 1;
  overflow: hidden;
}

.request-panel { border-right: 1px solid var(--border); display: flex; flex-direction: column; overflow: hidden; }
.response-panel-area { display: flex; flex-direction: column; overflow: hidden; }

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.panel-label { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-dim); font-weight: 600; }
.panel-body {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  overflow-y: auto;
  flex: 1;
}

.field-group { display: flex; flex-direction: column; gap: 0.35rem; }
.field-label { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-dim); font-weight: 600; }
.field-input {
  background: #0a0a0a;
  border: 1px solid var(--border-light);
  color: var(--text);
  padding: 0.6rem 0.75rem;
  border-radius: 4px;
  font-size: 0.82rem;
  font-family: var(--mono);
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
}
.field-input:focus { border-color: var(--orange); }
.field-input::placeholder { color: var(--text-dim); }
.field-textarea { resize: vertical; min-height: 80px; }
.execute-btn { margin-top: 0.5rem; }

/* ===== RESPONSE TABS ===== */
/* Mobile panel toggle tabs (request/response) */
.mobile-panel-tabs {
  display: none;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: #0d0d0d;
}
.mobile-panel-tab {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.65rem 0;
  cursor: pointer;
  font-family: var(--font);
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}
.mobile-panel-tab.active { color: var(--orange); border-bottom-color: var(--orange); }

.resp-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.resp-tab {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.6rem 1rem;
  cursor: pointer;
  font-family: var(--font);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.2s;
}
.resp-tab.active { color: var(--orange); border-bottom-color: var(--orange); }
.media-count {
  background: var(--orange);
  color: #000;
  font-size: 0.6rem;
  font-weight: 800;
  padding: 0.1rem 0.35rem;
  border-radius: 2px;
  margin-left: 0.25rem;
}
.response-time-badge { font-size: 0.7rem; font-family: var(--mono); color: var(--green); }

.resp-content {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.7;
  background: #0a0a0a;
}
.resp-placeholder { color: var(--text-dim); }

/* JSON syntax */
.resp-json-key { color: #93c5fd; }
.resp-json-str { color: #86efac; }
.resp-json-num { color: #fb923c; }
.resp-json-bool { color: #c084fc; }

/* Media */
.media-grid { display: flex; flex-direction: column; gap: 0.75rem; }
.media-section-label { font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-dim); font-weight: 600; margin-top: 0.25rem; }
.media-thumb { width: 100%; border-radius: 4px; border: 1px solid var(--border); display: block; }
.media-audio-wrap { border: 1px solid var(--border); padding: 0.75rem; border-radius: 4px; background: #0d0d0d; }
.media-audio-label { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-dim); margin-bottom: 0.5rem; font-weight: 600; }
.media-audio { width: 100%; }
.media-video-wrap { border: 1px solid var(--border); border-radius: 4px; overflow: hidden; background: #000; }
.media-video-label { font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-dim); font-weight: 600; padding: 0.4rem 0.75rem; border-bottom: 1px solid var(--border); background: #0d0d0d; }
.media-video { width: 100%; max-height: 260px; display: block; background: #000; }
.media-url-row { display: flex; gap: 0.5rem; padding: 0.4rem 0.5rem; align-items: center; font-size: 0.7rem; color: var(--text-dim); overflow: hidden; background: #0d0d0d; border-top: 1px solid var(--border); }
.media-url-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); font-size: 0.68rem; }
.media-dl-btn { flex-shrink: 0; }
.media-info-block { padding: 0.5rem 0; border-top: 1px solid var(--border); }
.media-info-block strong { display: block; font-size: 0.82rem; color: var(--text); margin-bottom: 0.2rem; }
.media-info-block span { font-size: 0.75rem; color: var(--text-muted); }
.media-ai-response { font-size: 0.85rem; line-height: 1.8; color: var(--text); white-space: pre-wrap; padding: 0.5rem 0; }

/* ===== FOOTER ===== */
.playground-footer {
  padding: 0.5rem 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 1rem;
  background: #0d0d0d;
  flex-shrink: 0;
  font-size: 0.72rem;
}
.footer-sep { font-size: 0.7rem; color: var(--text-dim); }

/* ===== AUTH OVERLAY ===== */
.auth-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(6px);
}
.auth-overlay.hidden { display: none; }

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 768px) {
  /* Sidebar becomes a slide-in drawer */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    max-width: 85vw;
    transform: translateX(-100%);
    z-index: 50;
    box-shadow: 4px 0 24px rgba(0,0,0,0.5);
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    z-index: 49;
    backdrop-filter: blur(2px);
    animation: backdropIn 0.2s ease;
  }
  .sidebar-backdrop.active { display: block; }

  @keyframes backdropIn {
    from { opacity: 0; }
    to { opacity: 1; }
  }

  .sidebar-close-btn { display: flex; }

  /* Show hamburger in topbar */
  .hamburger-btn { display: flex; align-items: center; }

  /* Playground main takes full width */
  .playground-main { width: 100%; }

  /* Endpoint body stacks vertically */
  .endpoint-body {
    display: flex;
    flex-direction: column;
    grid-template-columns: unset;
    overflow-y: auto;
  }

  /* Mobile panel tabs: REQUEST / RESPONSE toggle */
  .mobile-panel-tabs { display: flex; }

  /* Hide/show panels via JS on mobile */
  .request-panel {
    border-right: none;
    border-bottom: 1px solid var(--border);
    overflow: visible;
    max-height: none;
    flex-shrink: 0;
  }
  .request-panel.mobile-hidden { display: none; }

  .response-panel-area {
    flex: 1;
    min-height: 300px;
  }
  .response-panel-area.mobile-hidden { display: none; }

  /* Stats grid 2x2 on mobile */
  .sidebar-stats { grid-template-columns: repeat(2, 1fr); }
  .sidebar-stat { border-bottom: 1px solid var(--border); }
  .sidebar-stat:nth-child(2) { border-right: none; }
  .sidebar-stat:nth-child(3) { border-bottom: none; }
  .sidebar-stat:nth-child(4) { border-right: none; border-bottom: none; }

  /* Topbar compact on mobile */
  .playground-topbar { padding: 0.5rem 0.75rem; gap: 0.4rem; }
  .playground-topbar .btn { padding: 0.3rem 0.6rem; font-size: 0.68rem; }

  /* Endpoint header wraps nicely */
  .endpoint-header { padding: 0.65rem 1rem; }
  .endpoint-path { font-size: 0.68rem; }

  /* Panel body less padding */
  .panel-body { padding: 0.75rem; gap: 0.6rem; }
  .field-input { font-size: 0.82rem; padding: 0.55rem 0.75rem; }

  /* Resp content */
  .resp-content { padding: 0.75rem; font-size: 0.76rem; }

  /* Footer compact */
  .playground-footer { padding: 0.4rem 0.75rem; font-size: 0.68rem; gap: 0.75rem; }

  /* Empty state */
  .empty-title { font-size: 1.1rem; }
}

@media (max-width: 480px) {
  .sidebar { width: 100%; max-width: 100%; }
  .resp-tab { padding: 0.55rem 0.65rem; font-size: 0.68rem; }
}
