/**
 * MetaScreener Custom Styles
 * Modern UI with purple theme
 * Optimized for performance and better UX
 */

/* Page loader */
#page-loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.97);
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

#page-loader.loaded {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.spinner-container {
  text-align: center;
}

.spinner-container .spinner-border {
  width: 2.5rem;
  height: 2.5rem;
  color: var(--primary-color) !important;
}

/* Improve focus styles for accessibility */
:focus {
  outline: 2px solid rgba(107, 70, 193, 0.25) !important;
  outline-offset: 1px;
}

/* Smooth scrolling for better UX */
html {
  scroll-behavior: smooth;
}

:root {
  /* Color palette - Beautiful Purple Theme - 统一浅紫色主题 */
  --primary-color: #8b5cf6;       /* 主紫色 - 统一为较浅紫色 */
  --secondary-color: #a78bfa;     /* 次级紫色 */
  --tertiary-color: #e0e7ff;      /* 极浅紫色 */
  --hover-color: #7c3aed;         /* 悬停紫色 */
  --focus-color: #6b46c1;         /* 焦点/激活紫色 */
  --background-color: #FFFFFF;    /* 纯白背景 */
  --title-color: #1A1A1A;         /* 标题颜色 */
  --text-color: #333333;          /* 文本颜色 */
  --light-bg: #f8fafc;            /* 浅背景 */
  --border-color: #c7d2fe;        /* 边框颜色 */
  --success-color: #059669;       /* 成功绿色 */
  --warning-color: #D97706;       /* 警告橙色 */
  --danger-color: #DC2626;        /* 错误红色 */
  --info-color: #6366f1;          /* 信息蓝色 */
}

/* Base styles */
body {
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  color: var(--text-color);
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  padding-top: 56px; /* Reduced from 70px */
  padding-bottom: 40px; /* Reduced from 60px */
  font-size: 0.85rem;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  color: var(--title-color);
  font-weight: 600;
}

h1, h2 {
  margin-bottom: 0.6em;
}

h1 {
  font-size: 1.8rem;
}

h2 {
  font-size: 1.3rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.3em;
}

/* Navigation bar */
.navbar-custom {
  background: linear-gradient(135deg, #6b46c1 0%, #8b5cf6 100%) !important;
  box-shadow: 0 2px 8px rgba(107, 70, 193, 0.2);
  padding: 0.3rem 1rem;
  min-height: 56px;
}

.navbar-dark .navbar-nav .nav-item.active > .nav-link {
  border-bottom: 2px solid white;
  padding-bottom: calc(0.4rem - 2px);
  color: white;
  font-weight: 500;
}

.navbar-dark .navbar-nav .nav-link {
  color: rgba(255, 255, 255, 0.85);
  padding: 0.4rem 0.7rem;
  font-size: 0.85rem;
}

.navbar-dark .navbar-nav .nav-link:hover {
  color: rgba(255, 255, 255, 1);
}

.navbar-brand {
  font-weight: 600;
  letter-spacing: 0.3px;
  font-size: 1.1rem;
  padding: 0;
}

.navbar-brand img {
  height: 24px;
  margin-right: 6px;
}

/* Cards and sections */
.section-card {
  margin-bottom: 15px;
  padding: 1rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background-color: var(--background-color);
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
  transition: box-shadow 0.2s ease;
}

.section-card:hover {
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.criteria-section {
  margin-bottom: 15px;
  background: linear-gradient(135deg, #faf7ff 0%, #f3f0ff 100%);
  padding: 12px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
}

/* Buttons */
.btn {
  border-radius: 4px;
  transition: all 0.2s ease;
  font-weight: 500;
  letter-spacing: 0.2px;
  font-size: 0.85rem;
  padding: 0.35rem 0.7rem;
}

.btn:focus {
  box-shadow: 0 0 0 0.15rem rgba(107, 70, 193, 0.2);
}

.btn-primary {
  background: white;
  border: 1px solid var(--primary-color);
  color: var(--primary-color);
  box-shadow: 0 1px 3px rgba(139, 92, 246, 0.1);
}

.btn-primary:hover {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.25);
}

.btn-primary:active, .btn-primary:focus {
  background: var(--hover-color) !important;
  border-color: var(--hover-color) !important;
  color: white !important;
  box-shadow: 0 2px 4px rgba(139, 92, 246, 0.4) !important;
}

.btn-secondary {
  background-color: var(--tertiary-color);
  border-color: var(--border-color);
  color: var(--primary-color);
  box-shadow: 0 1px 3px rgba(107, 70, 193, 0.1);
}

.btn-secondary:hover {
  background-color: #c7d2fe;
  border-color: var(--primary-color);
  color: var(--focus-color);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(107, 70, 193, 0.2);
}

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

.btn-success:hover {
  background-color: var(--success-color);
  border-color: var(--success-color);
  transform: translateY(-1px);
}

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

.btn-danger:hover {
  background-color: #b91c1c;
  border-color: #b91c1c;
  transform: translateY(-1px);
}

.btn-group-sm > .btn, .btn-sm {
  padding: .15rem .4rem;
  font-size: .75rem;
  line-height: 1.5;
  border-radius: 3px;
}

/* Outline button styles for consistency */
.btn-outline-success {
  color: var(--success-color);
  border-color: var(--success-color);
  background: white;
}

.btn-outline-success:hover {
  background: var(--success-color);
  border-color: var(--success-color);
  color: white;
  transform: translateY(-1px);
}

.btn-outline-danger {
  color: var(--danger-color);
  border-color: var(--danger-color);
  background: white;
}

.btn-outline-danger:hover {
  background: var(--danger-color);
  border-color: var(--danger-color);
  color: white;
  transform: translateY(-1px);
}

.btn-outline-info {
  color: var(--info-color);
  border-color: var(--info-color);
  background: white;
}

.btn-outline-info:hover {
  background: var(--info-color);
  border-color: var(--info-color);
  color: white;
  transform: translateY(-1px);
}

.btn-outline-secondary {
  color: #6c757d;
  border-color: #6c757d;
  background: white;
}

.btn-outline-secondary:hover {
  background: #6c757d;
  border-color: #6c757d;
  color: white;
  transform: translateY(-1px);
}

/* Form elements */
.form-control {
  border-radius: 4px;
  border-color: var(--border-color);
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
  font-size: 0.85rem;
  padding: 0.3rem 0.6rem;
  height: calc(1.5em + 0.6rem + 2px);
}

.form-control:focus {
  border-color: var(--secondary-color);
  box-shadow: 0 0 0 0.15rem rgba(107, 70, 193, 0.2);
}

textarea {
  min-height: 60px;
  font-size: 0.85rem;
}

.form-group label {
  font-weight: 500;
  color: var(--title-color);
  margin-bottom: 0.25rem;
  font-size: 0.85rem;
}

/* Alerts and notifications */
.alert {
  margin-top: 12px;
  border-radius: 4px;
  border-width: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
}

.alert-success {
  background-color: rgba(5, 150, 105, 0.08);
  color: var(--success-color);
  border-left: 3px solid var(--success-color);
}

.alert-danger {
  background-color: rgba(220, 38, 38, 0.08);
  color: var(--danger-color);
  border-left: 3px solid var(--danger-color);
}

.alert-warning {
  background-color: rgba(217, 119, 6, 0.08);
  color: var(--warning-color);
  border-left: 3px solid var(--warning-color);
}

.alert-info {
  background-color: rgba(59, 130, 246, 0.08);
  color: var(--info-color);
  border-left: 3px solid var(--info-color);
}

/* Progress logs */
#progress_log, #test_progress_log {
  max-height: 150px;
  overflow-y: auto;
  font-size: 0.75em;
  background-color: var(--background-color);
  padding: 10px;
  border: 1px solid var(--border-color);
  margin-top: 8px;
  border-radius: 4px;
  white-space: pre-line;
}

#progress_log div, #test_progress_log div {
  padding: 3px 0;
  border-bottom: 1px dashed var(--border-color);
}

#progress_log div:last-child, #test_progress_log div:last-child {
  border-bottom: none;
}

.log-item-decision {
  font-weight: bold;
  margin-left: 4px;
}

.log-decision-INCLUDE {
  color: var(--success-color);
}

.log-decision-EXCLUDE {
  color: var(--danger-color);
}

.log-decision-MAYBE {
  color: var(--warning-color);
}

.log-decision-ERROR,
.log-decision-CONFIG_ERROR,
.log-decision-PROMPT_ERROR {
  color: var(--danger-color);
}

.log-decision-NO_ABSTRACT {
  color: #666;
}

/* Footer */
.footer {
  padding: 0.5rem 0;
  color: #4a5568;
  text-align: center;
  font-size: 0.9em;
  font-weight: 500;
  border-top: 1px solid var(--border-color);
  position: fixed;
  left: 0;
  bottom: 0;
  width: 100%;
  background-color: var(--background-color);
  height: 40px;
}

.footer a {
  margin-right: 1rem;
  color: #4a5568;
  text-decoration: none;
  font-size: 0.95em;
  font-weight: 500;
}

.footer a:hover {
  color: var(--primary-color);
  text-decoration: none;
}

/* Misc helpers */
.api-key-info {
  font-size: 0.85em;
  color: #555;
  margin-bottom: 12px;
}

/* Tables */
.table {
  border-collapse: collapse;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
  font-size: 0.85rem;
}

.table thead th {
  background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
  color: var(--primary-color);
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
  padding: 0.5rem;
  font-size: 0.8rem;
}

.table td {
  padding: 0.5rem;
  vertical-align: middle;
}

.table-striped tbody tr:nth-of-type(odd) {
  background-color: rgba(249, 250, 251, 0.5);
}

.table-hover tbody tr:hover {
  background-color: rgba(107, 70, 193, 0.05);
}

/* Custom switch */
.custom-switch .custom-control-label::before {
  background-color: #cbd5e0;
  height: 1rem;
  width: 1.75rem;
  border-radius: 0.5rem;
}

.custom-switch .custom-control-label::after {
  width: calc(1rem - 4px);
  height: calc(1rem - 4px);
  border-radius: 0.5rem;
}

.custom-control-input:checked ~ .custom-control-label::before {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}

/* Badges */
.badge {
  font-weight: 500;
  font-size: 75%;
  padding: 0.2em 0.5em;
}

.badge-primary {
  background-color: var(--primary-color);
}

.badge-secondary {
  background-color: var(--tertiary-color);
  color: var(--title-color);
}

.badge-success {
  background-color: var(--success-color);
}

.badge-warning {
  background-color: var(--warning-color);
}

.badge-danger {
  background-color: var(--danger-color);
}

/* Custom fonts for code/monospace */
code, pre, .monospace {
  font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.85em;
}

/* Modal styles */
.modal-header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #e2e8f0;
}

.modal-body {
  padding: 1rem;
}

.modal-footer {
  padding: 0.75rem 1rem;
  border-top: 1px solid #e2e8f0;
}