/* ==========================================================================
   Component Stylesheet - SupaTest V2 (Notion Minimalist Theme)
   ========================================================================== */

/* Buttons - Notion Flat & Minimalist */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background-color: transparent;
  color: var(--text-main);
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
  font-family: var(--font-sans);
}

.btn:hover {
  background-color: var(--bg-surface-hover);
  border-color: var(--border-strong);
}

.btn:active {
  background-color: var(--bg-surface-active);
}

.btn-primary {
  background-color: var(--primary);
  border-color: var(--primary);
  color: #042314;
  font-weight: 600;
  box-shadow: 0 1px 3px var(--primary-glow);
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #042314;
}

.btn-primary:active {
  background-color: var(--primary-active);
  border-color: var(--primary-active);
}

.btn-secondary {
  background-color: var(--bg-surface);
  border-color: var(--border-subtle);
  color: var(--text-main);
}

.btn-secondary:hover {
  background-color: var(--bg-surface-hover);
  border-color: var(--border-strong);
}

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

.btn-ghost:hover {
  background-color: var(--bg-surface-hover);
  color: var(--text-main);
  border-color: transparent;
}

.btn-danger {
  background-color: var(--status-danger-bg);
  border-color: rgba(224, 62, 62, 0.25);
  color: var(--status-danger);
}

.btn-danger:hover {
  background-color: rgba(224, 62, 62, 0.3);
  border-color: var(--status-danger);
  color: #ffffff;
}

.btn-icon {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: var(--radius-sm);
}

.btn-sm {
  padding: 0.25rem 0.55rem;
  font-size: 0.72rem;
}

.btn-lg {
  padding: 0.55rem 1.1rem;
  font-size: 0.85rem;
  font-weight: 500;
}

/* Badges - Notion Multi-Select & Property Tags */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  font-weight: 500;
  font-family: var(--font-mono);
}

.badge-success {
  background-color: var(--status-success-bg);
  color: var(--status-success);
  border: 1px solid rgba(15, 123, 108, 0.25);
}

.badge-warning {
  background-color: var(--status-warning-bg);
  color: var(--status-warning);
  border: 1px solid rgba(203, 145, 47, 0.25);
}

.badge-danger {
  background-color: var(--status-danger-bg);
  color: var(--status-danger);
  border: 1px solid rgba(224, 62, 62, 0.25);
}

.badge-info {
  background-color: var(--status-info-bg);
  color: var(--status-info);
  border: 1px solid rgba(51, 126, 169, 0.25);
}

.badge-secondary {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

/* HTTP Method Selector (Notion Tag Style) */
.method-badge {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
}

.method-GET { background: rgba(51, 126, 169, 0.2); color: #6db5e8; border: 1px solid rgba(51, 126, 169, 0.3); }
.method-POST { background: rgba(15, 123, 108, 0.2); color: #4dab9a; border: 1px solid rgba(15, 123, 108, 0.3); }
.method-PATCH { background: rgba(217, 115, 13, 0.2); color: #e9974c; border: 1px solid rgba(217, 115, 13, 0.3); }
.method-DELETE { background: rgba(224, 62, 62, 0.2); color: #eb5757; border: 1px solid rgba(224, 62, 62, 0.3); }

/* Form Controls - Notion Clean Inputs */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
}

.form-label {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.form-hint {
  font-size: 0.7rem;
  color: var(--text-dim);
  font-weight: normal;
  text-transform: none;
}

.form-input, .form-select, .form-textarea {
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.45rem 0.65rem;
  color: #ffffff;
  font-size: 0.82rem;
  font-family: var(--font-sans);
  transition: var(--transition);
  outline: none;
  width: 100%;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: rgba(56, 189, 248, 0.8);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.4);
}

.form-input-mono, .form-textarea-mono {
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.form-textarea {
  min-height: 100px;
  resize: vertical;
  line-height: 1.45;
}

/* Column Selector Pills (POST / PATCH - Notion Multi-Select Tags) */
.column-pills-bar {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.6rem 0.8rem;
  margin-bottom: 0.75rem;
}

.column-pills-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.45rem;
  font-size: 0.74rem;
  color: #ffffff;
  font-weight: 500;
}

.column-pills-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.column-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}

.column-pill-btn:hover {
  background-color: var(--bg-surface-hover);
  border-color: var(--primary);
  color: var(--primary);
}

.column-pill-btn.active {
  background-color: rgba(62, 207, 142, 0.2);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}

/* Endpoint URL Bar (Notion Clean Action Bar) */
.endpoint-bar {
  display: flex;
  align-items: center;
  background-color: var(--bg-sidebar);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.35rem 0.5rem;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.method-select {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-weight: 600;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
  outline: none;
  cursor: pointer;
}

.method-select:focus {
  border-color: var(--border-focus);
}

.endpoint-input-wrapper {
  display: flex;
  align-items: center;
  flex: 1;
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0 0.65rem;
  height: 32px;
  overflow: hidden;
}

.endpoint-prefix {
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  white-space: nowrap;
}

.table-selector-select, .table-selector-input {
  background: transparent;
  border: none;
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  width: 100%;
  outline: none;
  padding: 0.2rem 0;
  cursor: pointer;
}

.table-selector-select option {
  background-color: var(--bg-surface);
  color: var(--text-main);
  font-family: var(--font-mono);
  padding: 0.4rem 0.6rem;
}

/* Query Builder Section */
.builder-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

@media (max-width: 1100px) {
  .builder-grid {
    grid-template-columns: 1fr;
  }
}

.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
}

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

.card-title {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

/* Filter Row Builder */
.filter-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 0.65rem;
}

.filter-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.filter-col-input {
  flex: 1.2;
}

.filter-op-select {
  flex: 0.9;
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.filter-val-input {
  flex: 1.5;
}

/* RLS Verdict Diagnostic Card (Notion Callout Style) */
.rls-verdict-card {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  margin-bottom: 0.85rem;
  border: 1px solid var(--border-subtle);
  background-color: rgba(255, 255, 255, 0.02);
}

.rls-verdict-icon {
  font-size: 1.15rem;
  line-height: 1;
}

.rls-verdict-content {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1;
}

.rls-verdict-title {
  font-size: 0.82rem;
  font-weight: 600;
}

.rls-verdict-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Response Viewer */
.response-container {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  margin-top: 1rem;
}

.response-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.95rem;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
}

.response-meta {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.response-view-toggles {
  display: flex;
  background-color: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 1px;
}

.toggle-btn {
  padding: 0.25rem 0.55rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.toggle-btn.active {
  background-color: var(--bg-surface-active);
  color: var(--text-main);
  font-weight: 500;
}

.code-viewer {
  background-color: var(--bg-code);
  padding: 1rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: #e2e8f0;
  overflow-x: auto;
  max-height: 420px;
  white-space: pre-wrap;
  word-break: break-all;
}

/* Data Table Viewer (Notion Table Grid Style) */
.table-wrapper {
  overflow-x: auto;
  max-height: 420px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.76rem;
}

.data-table th {
  background-color: var(--bg-surface);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  font-family: var(--font-mono);
}

.data-table td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 0.76rem;
}

.data-table tr:hover td {
  background-color: rgba(255, 255, 255, 0.03);
}

/* RLS Multi-Role Matrix Table */
.matrix-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-top: 1rem;
}

.matrix-table {
  width: 100%;
  border-collapse: collapse;
}

.matrix-table th {
  background-color: var(--bg-surface);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border-subtle);
  text-align: left;
}

.matrix-table td {
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
  font-size: 0.78rem;
}

.matrix-table tr:last-child td {
  border-bottom: none;
}

/* Security Alert Box (Notion Warning Callout Style) */
.security-alert-box {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  background: rgba(203, 145, 47, 0.08);
  border: 1px solid rgba(203, 145, 47, 0.25);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.85rem;
  margin-bottom: 1rem;
  font-size: 0.78rem;
  line-height: 1.45;
}

.security-alert-icon {
  font-size: 1.1rem;
  line-height: 1;
}

.security-alert-content {
  color: var(--text-main);
}

.security-alert-content strong {
  color: var(--status-warning);
}

/* Modals - Notion Page Popup Style */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(3px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1.25rem;
}

.modal-backdrop.active {
  display: flex;
}

.modal-dialog {
  background-color: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.15s ease-out;
  overflow: hidden;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.97) translateY(4px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

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

.modal-title {
  font-size: 0.92rem;
  font-weight: 600;
}

.modal-body {
  padding: 1.25rem;
  max-height: 70vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 0.75rem 1.25rem;
  background-color: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* Toasts */
.toast-container {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  z-index: 200;
}

.toast {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.9rem;
  color: var(--text-main);
  box-shadow: var(--shadow-md);
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 240px;
  animation: toastIn 0.2s ease-out;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Favorites List in Sidebar (Notion Page Tree Style) */
.favorites-list {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  max-height: 160px;
  overflow-y: auto;
}

.favorite-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.35rem 0.5rem;
  background-color: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.72rem;
}

.favorite-item:hover {
  background-color: var(--bg-surface-hover);
}

.favorite-item-info {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  overflow: hidden;
}

.favorite-item-title {
  color: var(--text-main);
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 130px;
}

/* Large Modal & SQL Recipes (Notion Document Card Style) */
.modal-dialog-large {
  max-width: 680px;
  width: 90%;
}

.sql-recipe-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  margin-bottom: 0.75rem;
}

.sql-recipe-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.35rem;
}

.sql-recipe-title {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--primary);
}

.sql-recipe-desc {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-bottom: 0.55rem;
  line-height: 1.4;
}

.sql-code-box {
  background-color: var(--bg-code);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.65rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: #3ecf8e;
  overflow-x: auto;
  white-space: pre;
  margin-bottom: 0.4rem;
}


