@import "pj-design-tokens.css";

/* --- P&J ATACADISTA - DESIGN SYSTEM & STYLES --- */

/* CSS Variables & Tokens (Light Mode - Default) */
:root {
  --color-primary: #B02A45; /* P&J Accent */
  --color-primary-hover: #C73654; /* P&J Accent Light */
  --color-primary-light: #FDF2F4;
  --color-secondary: #081F33; /* P&J Deep Blue */
  --color-bg-app: #F4F6F8;
  --color-bg-card: #FFFFFF;
  --color-text-main: #0F172A;
  --color-text-muted: #475569;
  --color-border: #E2E8F0;
  
  /* Status Colors */
  --status-iniciado-bg: #F1F5F9;
  --status-iniciado-text: #475569;
  --status-aguardando-bg: #FEF3C7;
  --status-aguardando-text: #B45309;
  --status-concluido-bg: #D1FAE5;
  --status-concluido-text: #065F46;
  
  /* Typography */
  --font-serif: 'Fraunces', serif;
  --font-sans: 'Inter', sans-serif;
  
  /* Shadows & Radius */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.03);
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-round: 50px;
  
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  /* Toast variables to ensure high readability in both light/dark modes */
  --color-toast-bg: #081F33;
  --color-toast-text: #ffffff;
}

/* CSS Variables & Tokens (Dark Mode - Override) */
[data-theme="dark"] {
  --color-primary: #B02A45; /* P&J Accent */
  --color-primary-hover: #C73654; /* P&J Accent Light */
  --color-primary-light: rgba(176, 42, 69, 0.15);
  --color-secondary: #F1F5F9; /* P&J Text Primary */
  --color-bg-app: #071E2F; /* P&J Background Deep */
  --color-bg-card: #112F46; /* P&J Background Default */
  --color-text-main: #F1F5F9; /* P&J Text Primary */
  --color-text-muted: #94A3B8; /* P&J Text Secondary */
  --color-border: rgba(255, 255, 255, 0.08);
  
  /* Status Colors */
  --status-iniciado-bg: #1E293B;
  --status-iniciado-text: #94A3B8;
  --status-aguardando-bg: rgba(245, 158, 11, 0.15);
  --status-aguardando-text: #F59E0B;
  --status-concluido-bg: rgba(34, 197, 94, 0.15);
  --status-concluido-text: #22C55E;

  /* Toast overrides in Dark Mode - Sleek dark slate to stand out from body */
  --color-toast-bg: #1e293b;
  --color-toast-text: #ffffff;
}

/* Logo Sizing & Responsive Swapping */
.logo-img {
  height: 40px;
  width: auto;
  object-fit: contain;
  transition: var(--transition-smooth);
}

.logo-img.large {
  height: 70px;
  margin-bottom: 8px;
}

/* Theme-specific display of logo images */
.logo-img-dark {
  display: none !important;
}

[data-theme="dark"] .logo-img-light {
  display: none !important;
}

[data-theme="dark"] .logo-img-dark {
  display: block !important;
}

/* Theme Toggle Button Styling */
.theme-toggle-btn {
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-round);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--color-text-main);
  transition: var(--transition-smooth);
  outline: none;
}

.theme-toggle-btn:hover {
  background-color: rgba(255, 255, 255, 0.05);
  border-color: var(--color-primary);
  transform: translateY(-1px);
}

/* Sun/Moon Visibility: default show moon (for light mode) */
.theme-toggle-btn .sun-icon {
  display: none;
}
.theme-toggle-btn .moon-icon {
  display: block;
}

/* Toggle transitions based on active dark state: show sun (for dark mode) */
.theme-toggle-btn.dark .sun-icon {
  display: block;
}
.theme-toggle-btn.dark .moon-icon {
  display: none;
}

/* Reset & Basics */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-sans);
  background-color: var(--color-bg-app);
  color: var(--color-text-main);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body.modal-open {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button, input, textarea {
  font-family: inherit;
}

.hidden {
  display: none !important;
}

/* App Header styling */
header {
  background-color: var(--color-bg-card);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 100;
  height: 80px;
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.logo-icon {
  width: 28px;
  height: 28px;
  stroke: var(--color-primary);
}

.logo-icon.large {
  width: 48px;
  height: 48px;
}

.logo-text {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 600;
  color: var(--color-secondary);
}

.logo-text.large {
  font-size: 32px;
}

.logo-sub {
  font-weight: 300;
  color: var(--color-primary);
}

.main-nav ul {
  display: flex;
  list-style: none;
  gap: 32px;
}

.main-nav a {
  font-size: 15px;
  font-weight: 500;
  color: var(--color-text-muted);
  padding: 8px 0;
  position: relative;
  transition: var(--transition-smooth);
}

.main-nav a:hover,
.main-nav a.active {
  color: var(--color-secondary);
}

.main-nav a.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: var(--color-primary);
  border-radius: 2px;
}

/* User Profile Chip */
.user-profile-area {
  position: relative;
}

.profile-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  border-radius: var(--radius-round);
  border: 1px solid var(--color-border);
  background-color: var(--color-bg-app);
  cursor: pointer;
  transition: var(--transition-smooth);
  user-select: none;
}

.profile-chip:hover {
  border-color: var(--color-primary);
}

.profile-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: var(--color-secondary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.profile-info {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.profile-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-secondary);
}

.profile-role {
  font-size: 11px;
  color: var(--color-text-muted);
}

.profile-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background-color: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 8px;
  box-shadow: var(--shadow-lg);
  min-width: 150px;
  display: none;
}

.profile-dropdown.show {
  display: block;
}

.logout-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: none;
  font-size: 13px;
  color: #ef4444;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: var(--transition-smooth);
}

.logout-btn:hover {
  background-color: #fef2f2;
}

/* View Layout */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 24px;
  min-height: calc(100vh - 80px);
}

.view {
  animation: fadeInUp 0.4s ease-out forwards;
}

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

/* Page Header */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 40px;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 24px;
}

.page-header h1 {
  font-family: var(--font-serif);
  font-size: 42px;
  font-weight: 500;
  color: var(--color-secondary);
  line-height: 1.1;
  margin-top: 4px;
}

.sub-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.description-text {
  color: var(--color-text-muted);
  max-width: 600px;
  margin-top: 8px;
  font-size: 15px;
}

/* Button UI */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
  border: none;
}

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

.btn-primary:hover {
  background-color: var(--color-primary-hover);
  box-shadow: 0 4px 12px rgba(179, 142, 93, 0.2);
}

.btn-outline {
  border: 1px solid var(--color-border);
  background-color: var(--color-bg-card);
  color: var(--color-text-main);
}

.btn-outline:hover {
  border-color: var(--color-primary);
  background-color: var(--color-primary-light);
  color: var(--color-primary-hover);
}

.btn-block {
  display: flex;
  width: 100%;
}

.btn-xs {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

.btn-link {
  background: none;
  border: none;
  color: var(--color-primary);
  padding: 4px 0;
  font-size: 13px;
  text-decoration: underline;
  cursor: pointer;
}

.btn-link:hover {
  color: var(--color-primary-hover);
}

/* Cards & Lists UI */
.list-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.empty-state-card {
  background-color: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 60px 40px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: 600px;
  margin: 40px auto;
  box-shadow: var(--shadow-sm);
}

.empty-icon {
  width: 64px;
  height: 64px;
  stroke: var(--color-text-muted);
  opacity: 0.5;
  margin-bottom: 20px;
}

.empty-state-card h3 {
  font-family: var(--font-serif);
  font-size: 26px;
  color: var(--color-secondary);
  margin-bottom: 12px;
  font-weight: 500;
}

.empty-state-card p {
  color: var(--color-text-muted);
  margin-bottom: 24px;
  font-size: 14px;
}

/* Studies & Interviews Cards */
.item-card {
  background-color: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-smooth);
}

.item-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--color-primary-light);
}

.item-details {
  max-width: 70%;
}

.item-details h3 {
  font-size: 20px;
  color: var(--color-secondary);
  font-weight: 600;
  margin-bottom: 4px;
}

.item-meta {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: 8px;
  align-items: center;
}

.meta-divider {
  width: 4px;
  height: 4px;
  background-color: var(--color-border);
  border-radius: 50%;
}

.item-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* Status Badges */
.status-badge {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: var(--radius-round);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-badge.iniciado {
  background-color: var(--status-iniciado-bg);
  color: var(--status-iniciado-text);
}

.status-badge.aguardando {
  background-color: var(--status-aguardando-bg);
  color: var(--status-aguardando-text);
}

.status-badge.concluido {
  background-color: var(--status-concluido-bg);
  color: var(--status-concluido-text);
}

/* Dashboard KPIs styling */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 32px;
}

.kpi-card {
  background-color: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  position: relative;
}

.kpi-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: 8px;
}

.kpi-value {
  font-family: var(--font-serif);
  font-size: 38px;
  font-weight: 500;
  color: var(--color-secondary);
  line-height: 1;
}

.kpi-meta {
  margin-top: auto;
  font-size: 12px;
  color: var(--color-text-muted);
  padding-top: 12px;
}

/* Columns */
.dashboard-columns {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
}

.dashboard-card {
  background-color: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--color-border);
}

.card-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-secondary);
}

.card-content {
  padding: 24px;
  flex-grow: 1;
}

.centered-flex {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Activity Feed */
.activity-feed {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.activity-item {
  display: flex;
  gap: 12px;
  font-size: 14px;
  padding-bottom: 16px;
  border-bottom: 1px solid #f9fafb;
}

.activity-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.activity-icon-bullet {
  width: 8px;
  height: 8px;
  background-color: var(--color-primary);
  border-radius: 50%;
  margin-top: 7px;
  flex-shrink: 0;
}

.activity-details {
  display: flex;
  flex-direction: column;
}

.activity-time {
  font-size: 11px;
  color: var(--color-text-muted);
}

/* Circular Progress Chart SVG style */
.progress-svg {
  width: 180px;
  height: 180px;
  transform: rotate(-90deg);
}

.progress-track {
  fill: none;
  stroke: #f3f4f6;
  stroke-width: 14;
}

.progress-thumb {
  fill: none;
  stroke: var(--color-primary);
  stroke-width: 14;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.6s ease-in-out;
}

.chart-center-label {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.chart-center-val {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 600;
  color: var(--color-secondary);
}

.chart-center-sub {
  font-size: 10px;
  color: var(--color-text-muted);
  text-transform: uppercase;
  margin-top: 4px;
}

/* Forms and Inputs */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 20px;
}

.input-group label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-muted);
}

.input-group input,
.input-group textarea,
.input-group select {
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  font-size: 14px;
  transition: var(--transition-smooth);
  width: 100%;
}

.input-group input:focus,
.input-group textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

/* Auth Card Wrapper */
.auth-card-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 180px);
}

.auth-card {
  background-color: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 460px;
  box-shadow: var(--shadow-lg);
}

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

.logo-area.center {
  justify-content: center;
  margin-bottom: 20px;
}

.auth-header h2 {
  font-family: var(--font-serif);
  font-size: 24px;
  color: var(--color-secondary);
  font-weight: 500;
  margin-bottom: 8px;
}

.auth-header p {
  color: var(--color-text-muted);
  font-size: 13px;
}

.tabs-auth {
  display: flex;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 24px;
}

.tabs-auth .tab-btn {
  flex: 1;
  padding: 10px 0;
  background: none;
  border: none;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-muted);
  cursor: pointer;
  position: relative;
  transition: var(--transition-smooth);
}

.tabs-auth .tab-btn.active {
  color: var(--color-secondary);
}

.tabs-auth .tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: var(--color-primary);
}

.quick-switcher {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px dashed var(--color-border);
  text-align: center;
}

.quick-switcher p {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: 10px;
}

.switcher-buttons {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.btn-quick {
  background-color: #f3f4f6;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-quick:hover {
  background-color: var(--color-primary-light);
  border-color: var(--color-primary);
  color: var(--color-primary-hover);
}

/* Modals styling */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(13, 27, 42, 0.4);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-card {
  background-color: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 580px;
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  overflow: hidden;
  animation: modalPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.modal-card form {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  overflow: hidden;
  min-height: 0;
}

.modal-card.large {
  max-width: 900px;
}

@keyframes modalPop {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

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

.modal-header h2 {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 500;
  color: var(--color-secondary);
}

.close-modal-btn {
  background: none;
  border: none;
  font-size: 28px;
  color: var(--color-text-muted);
  cursor: pointer;
  line-height: 1;
  transition: var(--transition-smooth);
}

.close-modal-btn:hover {
  color: var(--color-secondary);
}

.settings-tab-btn {
  padding: 12px 20px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s ease;
}

.settings-tab-btn:hover {
  color: var(--color-text-main);
}

.settings-tab-btn.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.settings-tab-content {
  display: block;
}

.settings-tab-content.hidden {
  display: none;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex-grow: 1;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.modal-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px dashed var(--color-border);
}

.modal-section h4 {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--color-secondary);
  margin-bottom: 12px;
}

/* Rows Inside Modal (Dynamic Inputs) */
.participant-row, .question-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.participant-row input, .question-row input {
  padding: 10px;
  font-size: 13px;
}

.part-name { flex: 2; }
.part-email { flex: 3; }
.question-input-val { flex: 1; }

.btn-remove-row {
  background-color: #fee2e2;
  color: #ef4444;
  border: none;
  font-size: 18px;
  font-weight: bold;
  border-radius: var(--radius-sm);
  width: 38px;
  height: 38px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
}

.btn-remove-row:hover {
  background-color: #fca5a5;
}

/* Toast System */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background-color: var(--color-toast-bg);
  color: var(--color-toast-text) !important;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 280px;
  max-width: 400px;
  animation: toastSlide 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.toast *, .toast span, .toast div, .toast button, .toast svg {
  color: var(--color-toast-text) !important;
}

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

.toast.success { 
  border-left: 4px solid #10b981; 
}
.toast.error { 
  border-left: 4px solid #ef4444; 
}
.toast.info { 
  border-left: 4px solid var(--color-primary); 
}

/* Specific Dark Mode toast color enrichments for maximum visibility */
[data-theme="dark"] .toast.success {
  background-color: #064e3b !important;
  border-left: 4px solid #10b981 !important;
}
[data-theme="dark"] .toast.error {
  background-color: #7f1d1d !important;
  border-left: 4px solid #ef4444 !important;
}
[data-theme="dark"] .toast.info {
  background-color: #1e3a8a !important;
  border-left: 4px solid #3b82f6 !important;
}

.toast-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.6) !important;
  cursor: pointer;
  font-size: 18px;
}

.toast-close:hover {
  color: white !important;
}

/* Biblioteca Section styling */
.library-hero {
  background-color: #081F33; /* Explicit deep blue in light mode */
  color: white;
  border-radius: var(--radius-lg);
  padding: 60px 48px;
  position: relative;
  overflow: hidden;
  margin-bottom: 48px;
  box-shadow: var(--shadow-lg);
}

[data-theme="dark"] .library-hero {
  background-color: var(--color-bg-card); /* Distinct card background in dark mode */
  color: var(--color-text-main);
  border: 1px solid var(--color-border);
}

[data-theme="dark"] .library-hero p {
  color: var(--color-text-muted);
}

.library-hero::before {
  content: '';
  position: absolute;
  top: -50px;
  right: -50px;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(179, 142, 93, 0.15) 0%, transparent 70%);
}

.library-tag {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--color-primary);
  display: inline-block;
  margin-bottom: 12px;
}

.serif-title {
  font-family: var(--font-serif);
  font-size: 48px;
  font-weight: 300;
  line-height: 1.1;
  margin-bottom: 16px;
}

.serif-title em {
  font-style: italic;
  font-weight: 400;
  color: var(--color-primary);
}

.library-hero p {
  color: rgba(255, 255, 255, 0.7);
  max-width: 600px;
  margin-bottom: 32px;
  font-size: 15px;
}

.search-box {
  background-color: white;
  border-radius: var(--radius-md);
  padding: 4px 8px 4px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 500px;
  margin-bottom: 20px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

[data-theme="dark"] .search-box {
  background-color: var(--color-bg-app);
  border: 1px solid var(--color-border);
  box-shadow: none;
}

.search-icon {
  stroke: var(--color-text-muted);
}

.search-box input {
  border: none;
  padding: 12px 0;
  font-size: 14px;
  width: 100%;
  color: var(--color-text-main);
  background-color: transparent;
}

.search-box input:focus {
  outline: none;
}

.library-section h3 {
  font-family: var(--font-serif);
  font-size: 24px;
  margin-bottom: 24px;
  color: var(--color-text-main);
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.library-card {
  background-color: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: var(--transition-smooth);
  cursor: pointer;
}

.library-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--color-primary);
}

.library-card h4 {
  font-size: 18px;
  color: var(--color-secondary);
  font-weight: 600;
  margin-bottom: 8px;
}

.library-card p {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-bottom: 16px;
  flex-grow: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.library-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--color-text-muted);
  border-top: 1px solid var(--color-border);
  padding-top: 12px;
  margin-top: auto;
}

/* Interview Filling screen styling */
.interview-form-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 180px);
  padding: 20px;
}

.interview-form-card {
  background-color: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 40px;
  width: 100%;
  max-width: 680px;
}

.interview-step h2 {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 500;
  color: var(--color-secondary);
  margin-bottom: 8px;
}

.interview-step p {
  color: var(--color-text-muted);
  font-size: 14px;
  margin-bottom: 24px;
}

.interview-progress-bar {
  background-color: #f3f4f6;
  height: 6px;
  border-radius: var(--radius-round);
  margin-bottom: 12px;
  overflow: hidden;
}

.progress-bar-fill {
  background-color: var(--color-primary);
  height: 100%;
  border-radius: var(--radius-round);
  transition: width 0.3s ease;
}

.step-counter {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--color-primary);
  margin-bottom: 20px;
}

.question-text-display {
  font-family: var(--font-serif);
  font-size: 18px;
  color: var(--color-secondary);
  margin-bottom: 20px;
  font-weight: 500;
}

.step-nav-buttons {
  display: flex;
  justify-content: space-between;
  margin-top: 24px;
}

.success-icon-check {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background-color: #d1fae5;
  color: #059669;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px auto;
}

.success-icon-check svg {
  width: 32px;
  height: 32px;
}

/* Playbook details inside modal */
.playbook-doc {
  background-color: var(--color-bg-card);
}

.playbook-doc h2 {
  font-family: var(--font-serif);
  color: var(--color-secondary);
  font-size: 24px;
  margin: 32px 0 16px 0;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 8px;
}

.playbook-doc h2:first-of-type {
  margin-top: 0;
}

.playbook-doc h3 {
  font-size: 16px;
  color: var(--color-secondary);
  margin: 20px 0 10px 0;
}

.playbook-doc p {
  color: var(--color-text-main);
  margin-bottom: 16px;
  font-size: 14px;
}

.playbook-doc ul {
  margin-bottom: 16px;
  padding-left: 20px;
}

.playbook-doc li {
  color: var(--color-text-main);
  margin-bottom: 8px;
  font-size: 14px;
}

.playbook-doc blockquote {
  border-left: 4px solid var(--color-primary);
  background-color: var(--color-primary-light);
  padding: 16px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 20px;
  font-family: monospace;
  font-size: 13px;
  color: var(--color-text-main);
  white-space: pre-wrap;
}

.persona-profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.persona-profile-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 16px;
  background-color: var(--color-bg-app);
}

.persona-profile-card h4 {
  font-size: 14px;
  color: var(--color-secondary);
  font-weight: bold;
  margin-bottom: 8px;
}

.persona-profile-card p {
  font-size: 13px;
  margin-bottom: 8px;
  line-height: 1.4;
}

.pop-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 24px;
}

.pop-table th, .pop-table td {
  border: 1px solid var(--color-border);
  padding: 12px;
  font-size: 13px;
  text-align: left;
}

.pop-table th {
  background-color: #f9fafb;
  font-weight: 600;
  color: var(--color-secondary);
}

/* AI generating overlay with custom glowing pulse animation */
.loading-overlay {
  z-index: 300;
  background-color: rgba(13, 27, 42, 0.8);
}

.ai-loading-card {
  background-color: var(--color-secondary);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  padding: 48px;
  width: 100%;
  max-width: 480px;
  color: white;
  text-align: center;
}

.ai-loading-card h2 {
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 400;
  color: white;
  margin-bottom: 8px;
}

.ai-loading-card p {
  color: rgba(255, 255, 255, 0.6);
  font-size: 13px;
  margin-bottom: 32px;
}

.ai-orb-animation {
  width: 100px;
  height: 100px;
  margin: 0 auto 32px auto;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.orb-core {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: var(--color-primary);
  box-shadow: 0 0 30px 10px rgba(176, 42, 69, 0.6);
  animation: orbPulse 2s infinite ease-in-out;
}

.orb-ring {
  position: absolute;
  border: 1px solid rgba(176, 42, 69, 0.3);
  border-radius: 50%;
  animation: ringSpin 6s infinite linear;
}

.ring-1 {
  width: 64px;
  height: 64px;
  border-left-color: var(--color-primary);
  animation-duration: 3s;
}

.ring-2 {
  width: 90px;
  height: 90px;
  border-right-color: var(--color-primary);
  animation-duration: 5s;
  animation-direction: reverse;
}

@keyframes orbPulse {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 1; box-shadow: 0 0 40px 20px rgba(176, 42, 69, 0.8); }
}

@keyframes ringSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.ai-progress-steps {
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
  max-width: 300px;
  margin: 0 auto;
}

.ai-step-indicator {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.4);
  display: flex;
  align-items: center;
  gap: 10px;
  transition: var(--transition-smooth);
}

.ai-step-indicator::before {
  content: '';
  width: 6px;
  height: 6px;
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
}

.ai-step-indicator.active {
  color: white;
  font-weight: 600;
}

.ai-step-indicator.active::before {
  background-color: var(--color-primary);
  box-shadow: 0 0 10px var(--color-primary);
}

.ai-step-indicator.done {
  color: var(--color-primary);
}

.ai-step-indicator.done::before {
  background-color: var(--color-primary);
}

/* Scrollbar tweaks */
.dark-scrollbar::-webkit-scrollbar {
  width: 8px;
}
.dark-scrollbar::-webkit-scrollbar-track {
  background: transparent;
}
.dark-scrollbar::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 4px;
}
.dark-scrollbar::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-muted);
}

/* --- DARK THEME OVERRIDES FOR SPECIFIC COMPONENTS --- */

[data-theme="dark"] .input-group input,
[data-theme="dark"] .input-group textarea,
[data-theme="dark"] .input-group select,
[data-theme="dark"] .participant-row input,
[data-theme="dark"] .question-row input {
  background-color: var(--color-primary-deep);
  color: var(--color-text-primary);
  border-color: var(--color-border);
}

[data-theme="dark"] .input-group input::placeholder,
[data-theme="dark"] .input-group textarea::placeholder,
[data-theme="dark"] .participant-row input::placeholder,
[data-theme="dark"] .question-row input::placeholder {
  color: rgba(255, 255, 255, 0.35);
}

[data-theme="dark"] .btn-quick {
  background-color: var(--color-bg-light);
  color: var(--color-text-primary);
  border-color: var(--color-border);
}

[data-theme="dark"] .btn-quick:hover {
  background-color: rgba(176, 42, 69, 0.15);
  border-color: var(--color-primary);
  color: var(--color-text-primary);
}

[data-theme="dark"] .logout-btn:hover {
  background-color: rgba(239, 68, 68, 0.12);
}

[data-theme="dark"] .pop-table th {
  background-color: var(--color-bg-light);
  color: var(--color-text-primary);
}

[data-theme="dark"] .pop-table th, 
[data-theme="dark"] .pop-table td {
  border-color: var(--color-border);
}

[data-theme="dark"] .activity-item {
  border-bottom-color: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .progress-track {
  stroke: var(--color-bg-light);
}

[data-theme="dark"] .profile-avatar {
  background-color: var(--color-primary);
}

[data-theme="dark"] .profile-chip {
  background-color: var(--color-bg-light);
}

[data-theme="dark"] .btn-remove-row {
  background-color: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

[data-theme="dark"] .btn-remove-row:hover {
  background-color: rgba(239, 68, 68, 0.3);
}

