/* ============================================================
   NOTION CLOUD MCP BRIDGE — ULTRA PREMIUM DARK GLASS DESIGN
   ============================================================ */

:root {
  --bg-primary: #07090e;
  --bg-secondary: #0d121f;
  --card-bg: rgba(16, 23, 38, 0.75);
  --card-border: rgba(255, 255, 255, 0.08);
  --card-hover-border: rgba(56, 189, 248, 0.25);
  
  --primary: #38bdf8;
  --primary-glow: rgba(56, 189, 248, 0.35);
  --emerald: #10b981;
  --emerald-glow: rgba(16, 185, 129, 0.35);
  --indigo: #6366f1;
  --rose: #f43f5e;
  --amber: #f59e0b;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', Consolas, Monaco, monospace;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  
  --transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
}

/* Ambient Ambient Glow Circles */
.bg-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
}
.bg-glow-1 {
  width: 450px;
  height: 450px;
  top: -100px;
  left: 10%;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.12), transparent 70%);
}
.bg-glow-2 {
  width: 500px;
  height: 500px;
  bottom: 5%;
  right: 5%;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.1), transparent 70%);
}

.app-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 20px 60px;
  position: relative;
  z-index: 1;
}

/* Glass panel utility */
.glass-panel {
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  transition: var(--transition);
}

.glass-panel:hover {
  border-color: var(--card-hover-border);
}

/* -------------------------------------------------------------
   NAVBAR
   ------------------------------------------------------------- */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: rgba(13, 18, 31, 0.8);
  backdrop-filter: blur(20px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  margin-bottom: 28px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo {
  width: 44px;
  height: 44px;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-subtitle {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.gradient-text {
  background: linear-gradient(135deg, #38bdf8 0%, #10b981 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.server-status-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--card-border);
  border-radius: 999px;
  font-size: 0.82rem;
  font-family: var(--font-mono);
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-dim);
  position: relative;
}

.status-indicator.live {
  background: var(--emerald);
  box-shadow: 0 0 10px var(--emerald);
}

.status-indicator.live::after {
  content: '';
  position: absolute;
  top: -3px;
  left: -3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid var(--emerald);
  opacity: 0.8;
  animation: pulse-ring 2s infinite cubic-bezier(0.215, 0.61, 0.355, 1);
}

.status-indicator.warning {
  background: var(--amber);
  box-shadow: 0 0 10px var(--amber);
}

.status-indicator.error {
  background: var(--rose);
}

@keyframes pulse-ring {
  0% { transform: scale(0.7); opacity: 0.8; }
  100% { transform: scale(1.8); opacity: 0; }
}

.status-divider {
  color: var(--card-border);
}

.user-nav-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar-ring {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #38bdf8, #6366f1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: #fff;
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 0.88rem;
  font-weight: 600;
}

.user-tag {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* -------------------------------------------------------------
   BUTTONS & FORM CONTROLS
   ------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-main);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, #38bdf8 0%, #0ea5e9 100%);
  color: #07090e;
  box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--primary-glow);
  filter: brightness(1.08);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border: 1px solid var(--card-border);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}

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

.btn-sm {
  padding: 7px 12px;
  font-size: 0.8rem;
}

.btn-lg {
  padding: 14px 24px;
  font-size: 1rem;
}

.btn-block {
  width: 100%;
}

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: 6px;
  transition: var(--transition);
}

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

.btn-icon-round {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  padding: 0;
}

/* -------------------------------------------------------------
   AUTH VIEW
   ------------------------------------------------------------- */
.auth-view {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 40px;
}

.auth-card {
  width: 100%;
  max-width: 460px;
  padding: 40px 36px;
}

.auth-card-header {
  text-align: center;
  margin-bottom: 28px;
}

.hero-icon-badge {
  font-size: 2rem;
  margin-bottom: 12px;
  display: inline-block;
}

.auth-card-header h2 {
  font-size: 1.65rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.auth-card-header p {
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.auth-tabs {
  display: flex;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 24px;
}

.auth-tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-main);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
}

.auth-tab-btn.active {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
}

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

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

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrapper svg {
  position: absolute;
  left: 14px;
  color: var(--text-dim);
  pointer-events: none;
}

.input-wrapper input,
textarea {
  width: 100%;
  background: rgba(9, 13, 24, 0.6);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 12px 14px 12px 42px;
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 0.92rem;
  transition: var(--transition);
}

textarea {
  padding: 14px;
  font-family: var(--font-mono);
  font-size: 0.84rem;
  resize: vertical;
}

.input-wrapper input:focus,
textarea:focus {
  outline: none;
  border-color: #38bdf8;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.25);
  background: rgba(9, 13, 24, 0.85);
}

/* -------------------------------------------------------------
   DASHBOARD TABS NAVIGATION
   ------------------------------------------------------------- */
.dash-tabs-nav {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.dash-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(17, 24, 39, 0.6);
  border: 1px solid var(--card-border);
  color: var(--text-muted);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-family: var(--font-main);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

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

.dash-tab.active {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.4);
  color: #38bdf8;
  box-shadow: 0 4px 16px rgba(56, 189, 248, 0.15);
}

.highlight-pill {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}

/* -------------------------------------------------------------
   CARDS & GRIDS
   ------------------------------------------------------------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.stat-card {
  padding: 24px;
}

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

.stat-title {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.stat-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}
.stat-badge.success { background: rgba(16, 185, 129, 0.2); color: #10b981; }
.stat-badge.info { background: rgba(56, 189, 248, 0.2); color: #38bdf8; }

.stat-value {
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.stat-footer {
  font-size: 0.78rem;
  color: var(--text-dim);
}

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

.card {
  padding: 30px;
  margin-bottom: 24px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  gap: 16px;
}

.card-header h2, .card-header h3 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.card-header p {
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

/* Key Box */
.key-box {
  display: flex;
  gap: 12px;
  margin-top: 14px;
}

.key-input-container {
  flex: 1;
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 4px 12px;
}

.key-input-container input {
  flex: 1;
  background: transparent;
  border: none;
  color: #38bdf8;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  letter-spacing: 0.05em;
  padding: 8px 0;
}

.key-input-container input:focus {
  outline: none;
}

.inline-code {
  font-family: var(--font-mono);
  background: rgba(0, 0, 0, 0.4);
  padding: 2px 6px;
  border-radius: 4px;
  color: #38bdf8;
  font-size: 0.85em;
}

/* Endpoints List */
.endpoints-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.endpoint-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(0, 0, 0, 0.25);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--card-border);
  font-family: var(--font-mono);
  font-size: 0.86rem;
}

.http-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
}

.http-badge.post { background: rgba(16, 185, 129, 0.2); color: #10b981; }
.http-badge.get { background: rgba(56, 189, 248, 0.2); color: #38bdf8; }

.endpoint-path {
  font-weight: 600;
  color: var(--text-main);
}

.endpoint-desc {
  color: var(--text-dim);
  margin-left: auto;
  font-family: var(--font-main);
  font-size: 0.84rem;
}

/* -------------------------------------------------------------
   TAB 2: AI MARKDOWN PREVIEW
   ------------------------------------------------------------- */
.badge-featured {
  display: inline-block;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
}

.markdown-preview-box {
  background: #060911;
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.box-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(17, 24, 39, 0.9);
  padding: 10px 16px;
  border-bottom: 1px solid var(--card-border);
  font-size: 0.8rem;
}

.toolbar-filename {
  font-family: var(--font-mono);
  font-weight: 600;
  color: #38bdf8;
}

.toolbar-hint {
  color: var(--text-dim);
}

.code-block {
  display: block;
  padding: 18px 20px;
  font-family: var(--font-mono);
  font-size: 0.84rem;
  line-height: 1.6;
  color: #e2e8f0;
  max-height: 420px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.integration-guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.guide-step {
  padding: 20px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--card-border);
}

.step-num {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #38bdf8, #10b981);
  color: #000;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  font-size: 0.85rem;
}

.guide-step h4 {
  font-size: 1rem;
  margin-bottom: 6px;
}

.guide-step p {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.45;
}

/* -------------------------------------------------------------
   TAB 3: NOTION SESSION & COOKIES
   ------------------------------------------------------------- */
.session-status-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  margin-bottom: 24px;
}

.status-icon {
  font-size: 1.8rem;
}

.status-details h4 {
  font-size: 1rem;
  margin-bottom: 4px;
}

.status-details p {
  font-size: 0.84rem;
  color: var(--text-muted);
}

.highlight-text {
  color: #10b981;
  font-weight: 700;
}

.cookie-import-form textarea {
  margin-bottom: 16px;
}

.form-instructions {
  background: rgba(56, 189, 248, 0.05);
  border: 1px solid rgba(56, 189, 248, 0.15);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  margin-bottom: 20px;
  font-size: 0.85rem;
}

.form-instructions h5 {
  font-size: 0.9rem;
  margin-bottom: 8px;
  color: #38bdf8;
}

.form-instructions ol {
  padding-left: 20px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* -------------------------------------------------------------
   TAB 4: LIVE CHAT PLAYGROUND
   ------------------------------------------------------------- */
.chat-container-card {
  display: flex;
  flex-direction: column;
  min-height: 580px;
}

.chat-controls-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.select-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.select-wrapper select {
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--card-border);
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: 6px;
  font-family: var(--font-main);
  font-size: 0.85rem;
  outline: none;
}

.chat-messages-box {
  flex: 1;
  min-height: 340px;
  max-height: 480px;
  overflow-y: auto;
  background: rgba(6, 9, 17, 0.7);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-message {
  display: flex;
  gap: 14px;
  max-width: 88%;
}

.chat-message.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.msg-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.chat-message.assistant .msg-avatar {
  background: linear-gradient(135deg, #38bdf8, #10b981);
  color: #000;
}

.chat-message.user .msg-avatar {
  background: linear-gradient(135deg, #6366f1, #a855f7);
  color: #fff;
}

.msg-body {
  background: rgba(17, 24, 39, 0.85);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  font-size: 0.9rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-message.user .msg-body {
  background: rgba(99, 102, 241, 0.2);
  border-color: rgba(99, 102, 241, 0.35);
}

.chat-input-bar {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.chat-input-bar textarea {
  flex: 1;
  min-height: 52px;
  max-height: 120px;
  padding: 14px 16px;
  font-family: var(--font-main);
  resize: none;
}

/* -------------------------------------------------------------
   MODAL & TOAST
   ------------------------------------------------------------- */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
}

.modal-content {
  position: relative;
  z-index: 2;
  width: 90%;
  max-width: 900px;
  padding: 24px;
}

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

.modal-body img {
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--card-border);
}

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 2000;
}

.toast {
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  background: rgba(17, 24, 39, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid var(--card-border);
  color: var(--text-main);
  font-size: 0.88rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slide-in 0.3s ease forwards;
}

.toast.success { border-color: #10b981; }
.toast.error { border-color: #f43f5e; }

@keyframes slide-in {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.hidden {
  display: none !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .navbar {
    flex-direction: column;
    gap: 16px;
    align-items: flex-start;
  }
  .server-status-pill {
    width: 100%;
    justify-content: space-between;
  }
  .key-box {
    flex-direction: column;
  }
  .card-header {
    flex-direction: column;
  }
}
