/* =====================================================================
   F5 AI Guardrails Efficacy Test Portal - Base Stylesheet
   Offline-capable styles for Login and Application Shell
   ===================================================================== */

:root {
  --bg-dark: #0b0f1a;
  --surface-dark: #111827;
  --surface-dark-2: #1a2236;
  --border-dark: #1f2937;
  --accent-cyan: #00d4ff;
  --accent-blue: #3b52c4;
  --accent-blue-hover: #3044a8;
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --color-danger: #ef4444;
  --color-success: #10b981;
  --color-warning: #f59e0b;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Light Login Page Styles (Visual match for 1-login-page.png) */
body.login-page {
  background-color: #f3f4f6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.login-card {
  background-color: #ffffff;
  border-radius: 0.75rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  border: 1px solid #e5e7eb;
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 440px;
}

.f5-logo-badge {
  width: 4rem;
  height: 4rem;
  border-radius: 9999px;
  background-color: #e02424;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.25rem auto;
}

.f5-logo-svg {
  width: 2.75rem;
  height: 2.75rem;
}

.login-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: #111827;
  text-align: center;
  margin-bottom: 0.25rem;
  letter-spacing: -0.015em;
}

.login-subtitle {
  font-size: 0.875rem;
  color: #6b7280;
  text-align: center;
  margin-bottom: 1.5rem;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
  margin-bottom: 0.375rem;
}

.form-input {
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  color: #111827;
  background-color: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  outline: none;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-input:focus {
  border-color: #3b52c4;
  box-shadow: 0 0 0 3px rgba(59, 82, 196, 0.15);
}

.form-input.error {
  border-color: #ef4444;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.15);
}

.error-text {
  font-size: 0.75rem;
  color: #ef4444;
  margin-top: 0.25rem;
  display: none;
}

.error-text.visible {
  display: block;
}

.login-card .btn-primary {
  width: 100%;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  background-color: var(--accent-blue);
  color: #ffffff;
  font-size: 0.875rem;
  font-weight: 500;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s ease-in-out;
}

.btn-primary:hover {
  background-color: var(--accent-blue-hover);
}

.version-footer {
  margin-top: 1.5rem;
  font-size: 0.75rem;
  color: #9ca3af;
  text-align: center;
  font-weight: 500;
}

.alert-danger {
  background-color: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  padding: 0.625rem 0.75rem;
  border-radius: 0.375rem;
  font-size: 0.8125rem;
  margin-bottom: 1.25rem;
  text-align: center;
}

/* Dark Application Shell Styles */
body.app-shell {
  background-color: var(--bg-dark);
  color: var(--text-main);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.top-bar {
  background-color: var(--surface-dark);
  border-bottom: 1px solid var(--border-dark);
  height: 4rem;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 30;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.brand-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.01em;
}

.brand-accent {
  color: var(--accent-cyan);
  font-weight: 600;
}

.user-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.75rem;
  background-color: var(--surface-dark-2);
  border: 1px solid var(--border-dark);
  border-radius: 0.375rem;
  font-size: 0.8125rem;
}

.btn-signout {
  padding: 0.375rem 0.875rem;
  background-color: transparent;
  border: 1px solid var(--border-dark);
  color: var(--text-muted);
  font-size: 0.8125rem;
  border-radius: 0.375rem;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease-in-out;
}

.btn-signout:hover {
  background-color: var(--surface-dark-2);
  color: #ffffff;
  border-color: #374151;
}

.main-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  height: calc(100vh - 4rem);
}

.sidebar {
  width: 16rem;
  flex-shrink: 0;
  background-color: var(--surface-dark);
  border-right: 1px solid var(--border-dark);
  padding: 1.25rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  overflow-y: auto;
  height: 100%;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.875rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 0.5rem;
  transition: all 0.15s ease;
}

.nav-link:hover {
  background-color: var(--surface-dark-2);
  color: #ffffff;
}

.nav-link.active {
  background-color: var(--surface-dark-2);
  color: var(--accent-cyan);
  border-left: 3px solid var(--accent-cyan);
  padding-left: calc(0.875rem - 3px);
  font-weight: 600;
}

.content-area {
  flex: 1;
  min-width: 0;
  min-height: 0;
  padding: 1.25rem 1.75rem;
  overflow-y: auto;
}

.placeholder-card {
  background-color: var(--surface-dark);
  border: 1px solid var(--border-dark);
  border-radius: 0.75rem;
  padding: 2.5rem;
  text-align: center;
  max-width: 48rem;
  margin: 1.5rem 0;
}

.placeholder-tag {
  display: inline-block;
  background-color: rgba(0, 212, 255, 0.1);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 212, 255, 0.25);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  margin-bottom: 1rem;
}

/* UI Components for Dataset Management & Tables */
.btn-cyan {
  background-color: #00d4ff;
  color: #0b0f1a;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  text-decoration: none;
  transition: all 0.15s ease;
}
.btn-cyan:hover {
  background-color: #38e1ff;
  box-shadow: 0 0 12px rgba(0, 212, 255, 0.4);
}

.btn-secondary {
  background-color: var(--surface-dark-2);
  color: var(--text-main);
  border: 1px solid var(--border-dark);
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  cursor: pointer;
  font-size: 0.875rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.15s ease;
}
.btn-secondary:hover {
  background-color: #242f48;
  border-color: #374151;
}

.btn-danger {
  background-color: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 0.375rem 0.75rem;
  border-radius: 0.375rem;
  cursor: pointer;
  font-size: 0.8125rem;
  text-decoration: none;
  transition: all 0.15s ease;
}
.btn-danger:hover {
  background-color: rgba(239, 68, 68, 0.25);
  border-color: #ef4444;
}

.data-table-card {
  background-color: var(--surface-dark);
  border: 1px solid var(--border-dark);
  border-radius: 0.75rem;
  overflow-x: auto;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
  -webkit-overflow-scrolling: touch;
}

/* Custom dark scrollbars for table cards and scrollable areas */
.data-table-card::-webkit-scrollbar,
.activity-stream::-webkit-scrollbar,
.content-area::-webkit-scrollbar,
.sidebar::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.data-table-card::-webkit-scrollbar-track,
.activity-stream::-webkit-scrollbar-track,
.content-area::-webkit-scrollbar-track,
.sidebar::-webkit-scrollbar-track {
  background: rgba(17, 24, 39, 0.5);
  border-radius: 3px;
}

.data-table-card::-webkit-scrollbar-thumb,
.activity-stream::-webkit-scrollbar-thumb,
.content-area::-webkit-scrollbar-thumb,
.sidebar::-webkit-scrollbar-thumb {
  background: rgba(75, 85, 99, 0.6);
  border-radius: 3px;
}

.data-table-card::-webkit-scrollbar-thumb:hover,
.activity-stream::-webkit-scrollbar-thumb:hover,
.content-area::-webkit-scrollbar-thumb:hover,
.sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(107, 114, 128, 0.9);
}

.data-table-card,
.activity-stream,
.content-area,
.sidebar {
  scrollbar-width: thin;
  scrollbar-color: rgba(75, 85, 99, 0.6) rgba(17, 24, 39, 0.5);
}

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

.data-table th {
  background-color: var(--surface-dark-2);
  color: var(--text-muted);
  font-weight: 600;
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border-dark);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.data-table td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid rgba(31, 41, 55, 0.6);
  color: var(--text-main);
  vertical-align: middle;
}

.data-table tr:hover {
  background-color: rgba(26, 34, 54, 0.5);
}

.badge-tag {
  display: inline-block;
  background-color: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e5e7eb;
  padding: 0.125rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  margin: 0.125rem;
}

.badge-blocked {
  background-color: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  padding: 0.15rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-allowed {
  background-color: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #34d399;
  padding: 0.15rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
}

/* Modal styles */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 1rem;
}

.modal-content {
  background-color: var(--surface-dark);
  border: 1px solid var(--border-dark);
  border-radius: 0.75rem;
  width: 100%;
  max-width: 56rem;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
}

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

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

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

.drop-zone {
  border: 2px dashed #374151;
  border-radius: 0.5rem;
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  background-color: rgba(17, 24, 39, 0.6);
  transition: all 0.2s ease;
}

.drop-zone.dragover {
  border-color: var(--accent-cyan);
  background-color: rgba(0, 212, 255, 0.05);
}

.form-select-dark {
  background-color: var(--surface-dark-2);
  color: var(--text-main);
  border: 1px solid var(--border-dark);
  border-radius: 0.375rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  width: 100%;
  outline: none;
}
.form-select-dark:focus {
  border-color: var(--accent-cyan);
}

.form-input-dark {
  background-color: var(--surface-dark-2);
  color: var(--text-main);
  border: 1px solid var(--border-dark);
  border-radius: 0.375rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  width: 100%;
  outline: none;
}
.form-input-dark:focus {
  border-color: var(--accent-cyan);
}

/* =====================================================================
   Phase 6 Styles: Evaluations, Live Progress & Status Badges
   ===================================================================== */

.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-queued {
  background-color: rgba(156, 163, 175, 0.15);
  border: 1px solid rgba(156, 163, 175, 0.3);
  color: #9ca3af;
}

.badge-running {
  background-color: rgba(0, 212, 255, 0.15);
  border: 1px solid rgba(0, 212, 255, 0.4);
  color: #00d4ff;
}

.badge-completed {
  background-color: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #34d399;
}

.badge-completed-errors {
  background-color: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #fbbf24;
}

.badge-failed {
  background-color: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #f87171;
}

.badge-cancelled {
  background-color: rgba(107, 114, 128, 0.2);
  border: 1px solid rgba(107, 114, 128, 0.4);
  color: #9ca3af;
}

.pulse-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 9999px;
  background-color: currentColor;
  display: inline-block;
  animation: pulse-animation 1.5s infinite;
}

@keyframes pulse-animation {
  0% { transform: scale(0.95); opacity: 0.7; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.7; }
}

/* Progress bar container */
.progress-bar-container {
  width: 100%;
  height: 0.75rem;
  background-color: var(--surface-dark-2);
  border-radius: 9999px;
  overflow: hidden;
  border: 1px solid var(--border-dark);
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b52c4 0%, #00d4ff 100%);
  border-radius: 9999px;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-bar-fill.striped {
  background-image: linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.15) 25%,
    transparent 25%,
    transparent 50%,
    rgba(255, 255, 255, 0.15) 50%,
    rgba(255, 255, 255, 0.15) 75%,
    transparent 75%,
    transparent
  );
  background-size: 1rem 1rem;
  animation: progress-stripe 1s linear infinite;
}

@keyframes progress-stripe {
  0% { background-position: 1rem 0; }
  100% { background-position: 0 0; }
}

/* Stat cards grid */
.stat-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.875rem;
  margin-bottom: 1.5rem;
}

.activity-prompt-text {
  word-break: break-word;
  overflow-wrap: break-word;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.stat-card-sm {
  background-color: var(--surface-dark);
  border: 1px solid var(--border-dark);
  border-radius: 0.5rem;
  padding: 1rem;
  display: flex;
  flex-direction: column;
}

.stat-card-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.35rem;
}

.stat-card-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
}

.stat-card-value.success { color: #34d399; }
.stat-card-value.danger { color: #f87171; }
.stat-card-value.warning { color: #fbbf24; }
.stat-card-value.accent { color: #00d4ff; }

/* Stream feed items */
.activity-stream {
  max-height: 420px;
  overflow-y: auto;
  overflow-x: hidden;
}

.activity-stream table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background-color: var(--surface-dark-2);
}

.activity-row {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.825rem;
  animation: fadeIn 0.25s ease-in-out;
}

.activity-row td {
  padding: 0.65rem 1rem;
  vertical-align: middle;
}

.activity-row:nth-child(even) {
  background-color: rgba(255, 255, 255, 0.02);
}

.activity-row:hover {
  background-color: rgba(26, 34, 54, 0.5);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* =====================================================================
   Phase 7 & 8: Dropdown Menus and Results History UI Components
   ===================================================================== */

/* Dropdown component */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 220px;
  background-color: var(--surface-dark);
  border: 1px solid var(--border-dark);
  border-radius: 0.5rem;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.7), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
  padding: 0.4rem 0;
  z-index: 1000;
  list-style: none;
  margin: 0;
  text-align: left;
}

.dropdown-menu.dropdown-menu-left {
  right: auto;
  left: 0;
}

.dropdown-menu.show {
  display: block !important;
}

.dropdown-header {
  padding: 0.4rem 1rem 0.25rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.dropdown-divider {
  border: none;
  border-top: 1px solid var(--border-dark);
  margin: 0.35rem 0;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 1rem;
  font-size: 0.8125rem;
  color: var(--text-main);
  text-decoration: none;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.dropdown-item:hover {
  background-color: var(--surface-dark-2);
  color: var(--accent-cyan);
}

.dropdown-item svg {
  flex-shrink: 0;
}

/* Results History page custom layout */
.results-history-page {
  max-width: 88rem;
  margin: 0 auto;
}

.results-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 900px) {
  .results-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 500px) {
  .results-stats-grid {
    grid-template-columns: 1fr;
  }
}

.results-stat-card {
  background-color: var(--surface-dark);
  border: 1px solid var(--border-dark);
  border-radius: 0.625rem;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
}

.results-stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.results-stat-row {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.results-stat-val {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.1;
}

.results-stat-badge {
  font-size: 0.75rem;
  padding: 0.125rem 0.45rem;
  border-radius: 0.25rem;
  font-weight: 500;
}

/* Results Filter Card */
.results-filter-card {
  background-color: var(--surface-dark);
  border: 1px solid var(--border-dark);
  border-radius: 0.625rem;
  padding: 0.875rem 1.25rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.results-search-wrapper {
  position: relative;
  flex: 1;
  min-width: 280px;
}

.results-search-wrapper svg {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.results-search-input {
  width: 100%;
  background-color: var(--surface-dark-2);
  color: var(--text-main);
  border: 1px solid var(--border-dark);
  border-radius: 0.375rem;
  padding: 0.5rem 0.75rem 0.5rem 2.25rem;
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.15s ease;
}

.results-search-input:focus {
  border-color: var(--accent-cyan);
}

.results-filter-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* Table Actions & Dropdowns */
.table-actions-cell {
  white-space: nowrap;
  text-align: right;
}

.table-actions-cell .dropdown-menu {
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 4px;
}

/* Clickable Error Badges & Diagnostic Alerts */
.cursor-pointer {
  cursor: pointer !important;
}

.badge-error-clickable {
  cursor: pointer !important;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease-in-out;
  user-select: none;
}

.badge-error-clickable:hover {
  filter: brightness(1.25);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.45);
}

.badge-error-clickable:active {
  transform: translateY(0);
}

