/* ============================================================
   DigiKey API Portal — Explorer (Auth + Try-It) Stylesheet
   ============================================================ */

/* ── Auth FAB (floating auth button) ───────────────────────────────── */
.auth-fab {
  position: fixed;
  bottom: 1.75rem;
  right: 1.75rem;
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1.1rem 0.55rem 0.85rem;
  background: #1c2b3a;
  color: #c8d8e8;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
  transition: background 0.15s, box-shadow 0.15s;
}
.auth-fab:hover {
  background: #263f58;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
}

.auth-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.auth-dot-none    { background: #667; }
.auth-dot-active  { background: #4caf76; box-shadow: 0 0 5px rgba(76,175,118,0.7); }
.auth-dot-expired { background: #e07030; }

/* ── Auth Modal ──────────────────────────────────────────────────────── */
.auth-modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 300;
}
.auth-modal-backdrop.visible { display: block; }

.auth-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 301;
  align-items: flex-start;
  justify-content: center;
  padding-top: 8vh;
  pointer-events: none;
}
.auth-modal.open {
  display: flex;
  pointer-events: auto;
}

.auth-modal-panel {
  background: #ffffff;
  border-radius: 8px;
  width: 460px;
  max-width: calc(100vw - 2rem);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

.auth-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.2rem 1.5rem;
  border-bottom: 1px solid #e8edf2;
  background: #f4f7fa;
}
.auth-modal-header h3 {
  font-size: 1rem;
  font-weight: 700;
  color: #1c2b3a;
  margin: 0;
}
.auth-modal-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  color: #667;
  padding: 0 0.25rem;
}
.auth-modal-close:hover { color: #1c2b3a; }

.auth-modal-body {
  padding: 1.5rem;
}
.auth-modal-intro {
  font-size: 0.83rem;
  color: #5a7080;
  margin-bottom: 1.25rem;
  line-height: 1.55;
}

.auth-field {
  margin-bottom: 1rem;
}
.auth-field label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: #3a5068;
  margin-bottom: 0.3rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.auth-field input,
.auth-field select,
.auth-field textarea {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid #c8d4de;
  border-radius: 4px;
  font-size: 0.88rem;
  color: #1c2b3a;
  background: #ffffff;
  font-family: inherit;
  transition: border-color 0.15s;
}
.auth-field input:focus,
.auth-field select:focus,
.auth-field textarea:focus {
  outline: none;
  border-color: #1563cc;
  box-shadow: 0 0 0 3px rgba(21, 99, 204, 0.12);
}
.auth-field textarea {
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: 0.8rem;
  resize: vertical;
}

.auth-btn-primary {
  width: 100%;
  padding: 0.7rem 1rem;
  background: #1563cc;
  color: white;
  border: none;
  border-radius: 5px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 0.85rem;
}
.auth-btn-primary:hover  { background: #0e4aa3; }
.auth-btn-primary:disabled { background: #9ab1cc; cursor: not-allowed; }

.auth-keep-label {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: #4a6580;
  line-height: 1.45;
  margin-bottom: 0.75rem;
  cursor: pointer;
}
.auth-keep-label input[type="checkbox"] {
  margin-top: 0.1rem;
  flex-shrink: 0;
  cursor: pointer;
  accent-color: #1563cc;
}

.auth-btn-secondary {
  width: 100%;
  padding: 0.6rem 1rem;
  background: #f4f7fa;
  color: #1c2b3a;
  border: 1px solid #c8d4de;
  border-radius: 5px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 0.5rem;
}
.auth-btn-secondary:hover { background: #e0eaf4; }

.auth-btn-danger {
  width: 100%;
  padding: 0.55rem 1rem;
  background: transparent;
  color: #cc3333;
  border: 1px solid #eebebe;
  border-radius: 5px;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
}
.auth-btn-danger:hover { background: #fff0f0; }

.auth-status-msg {
  min-height: 1.5rem;
  font-size: 0.82rem;
  margin-bottom: 0.85rem;
  line-height: 1.4;
}
.auth-status-ok      { color: #1a7a42; }
.auth-status-err     { color: #cc2222; }
.auth-status-pending { color: #5a7080; }
.auth-status-none    { color: #8a9aaa; }

.auth-divider {
  text-align: center;
  color: #8a9aaa;
  font-size: 0.78rem;
  margin: 1rem 0;
  letter-spacing: 0.04em;
}

/* ── Auth modal scrollability ──────────────────────────────────────── */
.auth-modal-body {
  max-height: calc(90vh - 64px);
  overflow-y: auto;
}

/* ── Auth flow tabs ──────────────────────────────────────────────────── */
.auth-tabs {
  display: flex;
  border-bottom: 1px solid #dde5ed;
  margin: 0.25rem 0 0;
}
.auth-tab {
  background: none;
  border: none;
  color: #7a90a4;
  padding: 0.5rem 1rem;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
  font-family: inherit;
}
.auth-tab:hover { color: #3a5068; }
.auth-tab.active {
  color: #1563cc;
  border-bottom-color: #1563cc;
}
.auth-tab-panel { display: none; padding-top: 1rem; }
.auth-tab-panel.active { display: block; }

/* ── 3-legged OAuth button ───────────────────────────────────────────── */
.auth-btn-oauth {
  width: 100%;
  padding: 0.7rem 1rem;
  background: #cc0000;
  color: #ffffff;
  border: none;
  border-radius: 5px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  margin-bottom: 0.85rem;
  font-family: inherit;
  transition: background 0.15s;
}
.auth-btn-oauth:hover     { background: #a80000; }
.auth-btn-oauth:disabled  { background: #9ab1cc; cursor: not-allowed; }

.auth-redirect-note {
  font-size: 0.75rem;
  color: #7a90a4;
  margin: -0.25rem 0 0.85rem;
  line-height: 1.45;
}
.auth-redirect-note a { color: #1563cc; }
.auth-redirect-note a:hover { text-decoration: underline; }

/* ── Explorer Drawer ─────────────────────────────────────────────────── */
.drawer-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 250;
}
.drawer-backdrop.visible { display: block; }

.explorer-drawer {
  position: fixed;
  top: 0;
  right: -500px;
  width: 460px;
  max-width: 100vw;
  height: 100vh;
  overflow-y: auto;
  background: #0f1923;
  z-index: 251;
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.4);
}
.explorer-drawer.open { right: 0; }

/* Push content when drawer is open on wide screens */
@media (min-width: 1380px) {
  body.drawer-open .content {
    margin-right: 460px;
    transition: margin-right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
}

.drawer-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: #0a1220;
  flex-shrink: 0;
}
.drawer-header .drawer-method {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.55rem;
  border-radius: 3px;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}
.drawer-header .drawer-path {
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: 0.82rem;
  color: #c8d8e8;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.drawer-close-btn {
  background: none;
  border: none;
  color: #6a8098;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.25rem;
  flex-shrink: 0;
}
.drawer-close-btn:hover { color: #c8d8e8; }

.drawer-url-bar {
  padding: 0.6rem 1.25rem;
  background: #111e2b;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: 0.75rem;
  color: #6a8098;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  overflow: hidden;
}
.drawer-env-tag {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 0.15rem 0.4rem;
  border-radius: 2px;
  flex-shrink: 0;
}
.drawer-env-tag.env-prod { background: #1a3a1a; color: #6dbf8a; }
.drawer-env-tag.env-sand { background: #3a2a0a; color: #d4a040; }
#drawer-full-url {
  color: #7a9cb8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
}

/* Section headers inside drawer */
.drawer-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #4a6580;
  margin: 1.25rem 0 0.6rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.drawer-section-title:first-child { margin-top: 0; }

/* Param rows */
.drawer-param-row {
  margin-bottom: 0.75rem;
}
.drawer-param-row label {
  display: block;
  font-size: 0.76rem;
  font-weight: 600;
  color: #7a9cb8;
  margin-bottom: 0.25rem;
  font-family: 'SFMono-Regular', Consolas, monospace;
}
.drawer-param-row label .req { color: #e06060; font-style: normal; }
.drawer-param-row .param-desc {
  font-size: 0.73rem;
  color: #4a6580;
  margin-bottom: 0.3rem;
  font-family: inherit;
}
.drawer-param-input {
  width: 100%;
  padding: 0.45rem 0.65rem;
  background: #111e2b;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  color: #c8d8e8;
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: 0.82rem;
  transition: border-color 0.15s;
}
.drawer-param-input:focus {
  outline: none;
  border-color: #2a6496;
  box-shadow: 0 0 0 2px rgba(42, 100, 150, 0.25);
}

/* Body editor */
.drawer-body-editor {
  width: 100%;
  background: #0a1220;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  color: #c8d8e8;
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: 0.8rem;
  line-height: 1.5;
  padding: 0.75rem;
  resize: vertical;
  min-height: 140px;
  transition: border-color 0.15s;
}
.drawer-body-editor:focus {
  outline: none;
  border-color: #2a6496;
  box-shadow: 0 0 0 2px rgba(42, 100, 150, 0.25);
}

/* Auth warning in drawer */
.drawer-auth-warning {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.85rem;
  background: rgba(204, 170, 0, 0.1);
  border: 1px solid rgba(204, 170, 0, 0.25);
  border-radius: 4px;
  font-size: 0.8rem;
  color: #c8a840;
  margin-bottom: 0.85rem;
}

/* Send button */
.drawer-send-btn {
  width: 100%;
  padding: 0.7rem 1rem;
  background: #1563cc;
  color: white;
  border: none;
  border-radius: 5px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 0.85rem;
  letter-spacing: 0.02em;
  transition: background 0.15s;
}
.drawer-send-btn:hover  { background: #0e4aa3; }
.drawer-send-btn:disabled { background: #1c3650; color: #4a6580; cursor: not-allowed; }

/* Response section */
.drawer-response-section {
  margin-top: 1.25rem;
}
.drawer-response-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}
.drawer-response-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #4a6580;
}
.drawer-copy-btn {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: #6a8098;
  font-size: 0.73rem;
  padding: 0.2rem 0.55rem;
  border-radius: 3px;
  cursor: pointer;
}
.drawer-copy-btn:hover { background: rgba(255,255,255,0.1); color: #c8d8e8; }

.drawer-response-status {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 3px;
  margin-bottom: 0.65rem;
  font-family: 'SFMono-Regular', Consolas, monospace;
}
.status-ok  { background: #1a3a1a; color: #6dbf8a; }
.status-err { background: #3a1a1a; color: #df7070; }

.drawer-response-body {
  background: #0a1220;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 4px;
  padding: 0.85rem;
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: 0.76rem;
  line-height: 1.55;
  color: #c8d8e8;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 380px;
  overflow-y: auto;
  margin: 0;
}
.drawer-response-err {
  color: #df7070;
  font-size: 0.82rem;
  padding: 0.75rem 0;
  line-height: 1.5;
}
.drawer-response-pending { color: #6a8098; font-size: 0.82rem; padding: 0.75rem 0; }

.cors-note {
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  background: rgba(255, 200, 0, 0.07);
  border: 1px solid rgba(255, 200, 0, 0.18);
  border-radius: 4px;
  font-size: 0.78rem;
  color: #b08030;
  line-height: 1.6;
}
.cors-note code {
  background: rgba(255,255,255,0.08);
  padding: 0.1rem 0.3rem;
  border-radius: 2px;
  font-size: 0.75rem;
}

/* Captured example section */
.drawer-captured-section {
  margin-top: 1.25rem;
  border-top: 1px solid rgba(255,255,255,0.06);
  padding-top: 1rem;
}
.drawer-captured-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.drawer-captured-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #4a6580;
}
.drawer-toggle-btn {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: #6a8098;
  font-size: 0.73rem;
  padding: 0.2rem 0.6rem;
  border-radius: 3px;
  cursor: pointer;
}
.drawer-toggle-btn:hover { background: rgba(255,255,255,0.1); color: #c8d8e8; }

.drawer-captured-body {
  display: none;
  margin-top: 0.65rem;
}
.drawer-captured-body.expanded { display: block; }
.drawer-captured-pre {
  background: #0a1220;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 4px;
  padding: 0.85rem;
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: 0.76rem;
  line-height: 1.55;
  color: #c8d8e8;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 340px;
  overflow-y: auto;
  margin: 0;
}
.captured-status-badge {
  display: inline-block;
  font-size: 0.73rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  margin-bottom: 0.5rem;
  font-family: 'SFMono-Regular', Consolas, monospace;
}
.captured-note {
  font-size: 0.76rem;
  color: #4a6580;
  margin-bottom: 0.5rem;
  font-style: italic;
}
.captured-loading { color: #4a6580; font-size: 0.8rem; padding: 0.5rem 0; }
.captured-no-file { color: #3a5060; font-size: 0.8rem; padding: 0.5rem 0; font-style: italic; }

/* ── Try-it button in endpoint tables ────────────────────────────────── */
.col-try-header {
  width: 70px;
  text-align: right;
}
.col-try {
  text-align: right;
  padding-right: 0.75rem !important;
}
.try-btn {
  font-size: 0.73rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  background: rgba(21, 99, 204, 0.1);
  color: #1563cc;
  border: 1px solid rgba(21, 99, 204, 0.25);
  border-radius: 3px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.try-btn:hover {
  background: #1563cc;
  color: white;
  border-color: #1563cc;
}
.try-btn-disabled {
  color: #8a9aaa;
  border-color: #d4dce4;
  background: transparent;
  cursor: not-allowed;
}

/* ── Responsive tweaks ───────────────────────────────────────────────── */
@media (max-width: 860px) {
  .explorer-drawer { width: 100vw; right: -100vw; }
  .explorer-drawer.open { right: 0; }
  .auth-fab { bottom: 1rem; right: 1rem; }
}
