/* =====================================================
   Recrutta — Global Styles
   Bootstrap 5.3.2 + Bootstrap Icons 1.11.3
   ===================================================== */

:root {
  --primary:        #0f62fe;
  --primary-dark:   #0043ce;
  --primary-light:  #eaf1ff;
  --accent:         #6ea6ff;
  --sidebar-bg:     #13141a;
  --sidebar-width:  240px;
  --radius-card:    0.875rem;
  --radius-btn:     0.5rem;
  --shadow-card:    0 2px 8px rgba(0,0,0,0.06);
  --shadow-hover:   0 6px 20px rgba(15,98,254,0.12);

  /* score colors */
  --score-excellent: #10b981;
  --score-good:      #0f62fe;
  --score-mid:       #f59e0b;
  --score-weak:      #ef4444;

  /* Bootstrap overrides */
  --bs-primary:       #0f62fe;
  --bs-border-radius: 0.5rem;
}

/* ── Base ─────────────────────────────────────────── */
html {
  /* Cor de fundo igual à sidebar para cobrir a barra do SO */
  background-color: #13141a;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: #f4f6fb;
  color: #1a1d23;
}

a { text-decoration: none; }

/* ── Sidebar ──────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1040;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.3s ease;
}

.sidebar-brand {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  color: #fff;
  font-weight: 700;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  letter-spacing: -0.01em;
}

.sidebar-brand i { font-size: 1.3rem; color: var(--accent); }
.sidebar-logo { height: 110px; width: auto; object-fit: contain; filter: invert(1) hue-rotate(180deg); }
.sidebar-brand { justify-content: center; }

.sidebar-nav { padding: 1rem 0.75rem; flex: 1; overflow-y: auto; }

.sidebar-nav .nav-link {
  color: rgba(255,255,255,0.55);
  padding: 0.55rem 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  border-radius: 0.6rem;
  transition: all 0.18s;
  font-size: 0.88rem;
  margin-bottom: 0.15rem;
}

.sidebar-nav .nav-link:hover {
  color: #fff;
  background: rgba(255,255,255,0.07);
}

.sidebar-nav .nav-link.active {
  color: #fff;
  background: var(--primary);
}

.sidebar-nav .nav-link i { font-size: 1rem; width: 1.1rem; }

.sidebar-section-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.25);
  font-weight: 600;
  padding: 0.75rem 0.85rem 0.25rem;
}

/* Sidebar user block */
.sidebar-user {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,0.07);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sidebar-user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(110,166,255,0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: 1rem;
  flex-shrink: 0;
}

.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name {
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-role { color: rgba(255,255,255,0.4); font-size: 0.7rem; }

.sidebar-logout {
  color: rgba(255,255,255,0.35);
  font-size: 0.78rem;
  padding: 0.35rem 0.5rem;
  border-radius: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.18s;
  flex-shrink: 0;
}
.sidebar-logout:hover { color: #ef4444; background: rgba(239,68,68,0.08); }

/* ── Overlay (mobile) ─────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1039;
}

/* ── Main content ─────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  transition: margin-left 0.3s ease;
}

/* ── Topbar ───────────────────────────────────────── */
.topbar {
  background: #fff;
  border-bottom: 1px solid #e8eaf0;
  padding: 0.7rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1030;
}

.topbar-title {
  font-size: 1rem;
  font-weight: 600;
  color: #1a1d23;
}

.hamburger-btn {
  display: none;
  background: none;
  border: none;
  font-size: 1.4rem;
  color: #495057;
  padding: 0.25rem;
  cursor: pointer;
}

/* ── Page content ─────────────────────────────────── */
.page-content { padding: 1.5rem; }

/* ── Cards ────────────────────────────────────────── */
.card {
  border: 1px solid #e8eaf0;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  background: #fff;
}

.card-stat {
  border-left: 3px solid var(--primary);
}

.card-stat .stat-number {
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
}

.card-stat .stat-label {
  font-size: 0.75rem;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
}

/* ── Score colors ─────────────────────────────────── */
.badge-excellent { background: #d1fae5; color: #065f46; }
.badge-muito-bom { background: #dbeafe; color: #1e40af; }
.badge-bom       { background: #e0e7ff; color: #3730a3; }
.badge-regular   { background: #fef3c7; color: #92400e; }
.badge-fraco     { background: #fee2e2; color: #991b1b; }

/* ── Differentiator tags (quebra de linha automática) ── */
.diff-tag {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.4;
  padding: 0.3rem 0.65rem;
  border-radius: 0.4rem;
  word-break: break-word;
  margin-bottom: 0.35rem;
}
.diff-tag-success { background: #d1fae5; color: #065f46; }
.diff-tag-warning { background: #fef3c7; color: #92400e; }

/* ── Score gauge ──────────────────────────────────── */
.score-gauge {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  border: 2.5px solid currentColor;
  flex-shrink: 0;
}

/* ── Score bars ───────────────────────────────────── */
.score-bar-label {
  font-size: 0.78rem;
  color: #495057;
  min-width: 120px;
}

.score-bar-value {
  font-size: 0.78rem;
  font-weight: 600;
  min-width: 32px;
  text-align: right;
}

/* ── Job cards ────────────────────────────────────── */
.job-card {
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid #e8eaf0;
  border-radius: var(--radius-card);
}

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

.job-card .job-status-badge {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

/* ── Candidate cards ──────────────────────────────── */
.candidate-cards-list { padding: 0.5rem; }

.cand-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 0.65rem;
  border: 1px solid transparent;
  margin-bottom: 0.35rem;
  background: #fff;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.cand-card:nth-child(even) {
  background: linear-gradient(135deg, #fafbff 0%, #f4f7ff 100%);
}

.cand-card:nth-child(odd) {
  background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
}

.cand-card:hover {
  background: linear-gradient(135deg, #eef3ff 0%, #e8efff 100%) !important;
  border-color: #c7d7f5;
  box-shadow: 0 2px 8px rgba(15,98,254,0.08);
}

.cand-card.selected {
  background: linear-gradient(135deg, #eaf1ff 0%, #ddeaff 100%) !important;
  border-color: #bfcff7;
}

.cand-card-check { flex-shrink: 0; }
.cand-card-score { flex-shrink: 0; }

.cand-card-info { flex: 1; min-width: 0; }
.cand-card-info .fw-semibold {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cand-card-actions {
  display: flex;
  align-items: center;
  gap: 0.1rem;
  flex-shrink: 0;
}

.cand-action-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.45rem;
  border: none;
  background: transparent;
  font-size: 0.95rem;
  transition: background 0.15s, color 0.15s;
  cursor: pointer;
}

.cand-action-btn:hover         { background: #f0f4ff; color: var(--primary) !important; }
.cand-action-btn.text-danger:hover { background: #fee2e2; color: #dc2626 !important; }
.cand-action-btn.text-success:hover { background: #d1fae5; color: #065f46 !important; }

/* ── Upload dropzone ──────────────────────────────── */
.dropzone {
  border: 2px dashed #c7d2fe;
  border-radius: var(--radius-card);
  padding: 2rem;
  text-align: center;
  background: #f5f8ff;
  cursor: pointer;
  transition: all 0.2s;
}

.dropzone.dragover {
  background: #eaf1ff;
  border-color: var(--primary);
}

.dropzone i { font-size: 2.5rem; color: var(--accent); }

/* ── Upload queue ─────────────────────────────────── */
.upload-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: 0.5rem;
  background: #f8f9fc;
  margin-bottom: 0.4rem;
  font-size: 0.85rem;
}

.upload-item .status-icon { font-size: 1rem; width: 1.2rem; text-align: center; }

/* ── Floating comparison bar ──────────────────────── */
.compare-bar {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: #13141a;
  color: #fff;
  border-radius: 2rem;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
  z-index: 1050;
  white-space: nowrap;
}

.compare-bar.d-none { display: none !important; }

/* ── Loading spinner ──────────────────────────────── */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

/* ── Auth page ────────────────────────────────────── */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #13141a 0%, #1c2333 100%);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  border-radius: 1.25rem;
  box-shadow: 0 24px 64px rgba(0,0,0,0.35);
}

.auth-logo { color: var(--primary); font-size: 2.5rem; }
.auth-logo-img { height: 240px; width: auto; object-fit: contain; margin-bottom: -20px; }

.default-creds {
  font-size: 0.8rem;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 0.5rem;
  padding: 0.6rem 0.75rem;
  color: #166534;
}

/* ── Voice modal ──────────────────────────────────── */
.waveform-container {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: #f8f9fc;
  border-radius: 0.75rem;
  overflow: hidden;
}

.waveform-bar {
  width: 4px;
  background: var(--accent);
  border-radius: 2px;
  animation: wave 1s ease-in-out infinite;
}

.waveform-bar:nth-child(2)  { animation-delay: 0.1s; }
.waveform-bar:nth-child(3)  { animation-delay: 0.2s; }
.waveform-bar:nth-child(4)  { animation-delay: 0.3s; }
.waveform-bar:nth-child(5)  { animation-delay: 0.4s; }
.waveform-bar:nth-child(6)  { animation-delay: 0.5s; }
.waveform-bar:nth-child(7)  { animation-delay: 0.6s; }
.waveform-bar:nth-child(8)  { animation-delay: 0.7s; }

@keyframes wave {
  0%, 100% { height: 8px; }
  50%       { height: 40px; }
}

.waveform-container.paused .waveform-bar {
  animation-play-state: paused;
  height: 8px;
}

/* ── Deep analysis modal ──────────────────────────── */
.deep-section {
  border-left: 3px solid #c7d2fe;
  padding-left: 0.75rem;
  margin-bottom: 1rem;
}

.deep-section h6 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6b7280;
  margin-bottom: 0.3rem;
}

.veredicto-badge {
  font-size: 0.85rem;
  padding: 0.4rem 1rem;
  border-radius: 2rem;
  font-weight: 600;
}

/* ── Comparison modal ─────────────────────────────── */
.compare-col {
  border-right: 1px solid #e8eaf0;
}

.compare-col:last-child { border-right: none; }

.compare-label {
  font-size: 0.75rem;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── Empty state ──────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: #9ca3af;
}

.empty-state i { font-size: 3rem; margin-bottom: 1rem; opacity: 0.35; }

/* ── Toast ────────────────────────────────────────── */
.toast-container { z-index: 11000; }

/* ── Buttons ──────────────────────────────────────── */
.btn { border-radius: var(--radius-btn); font-weight: 500; }

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

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

/* ── Form ─────────────────────────────────────────── */
.form-label { font-size: 0.875rem; font-weight: 500; color: #374151; }

.form-control, .form-select {
  border-radius: 0.5rem;
  border-color: #dde1ea;
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15,98,254,0.1);
}

/* ── Job description modal ────────────────────────── */
.job-desc-header {
  background: linear-gradient(135deg, #0f62fe 0%, #0043ce 100%);
  border-radius: var(--radius-card) var(--radius-card) 0 0;
  padding: 1.5rem;
  color: #fff;
}

.job-desc-meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(255,255,255,0.15);
  border-radius: 2rem;
  padding: 0.3rem 0.75rem;
  font-size: 0.78rem;
  color: rgba(255,255,255,0.92);
  backdrop-filter: blur(4px);
}

.job-desc-section {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #f0f2f7;
}
.job-desc-section:last-child { border-bottom: none; }

.job-desc-section-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #9ca3af;
  font-weight: 600;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.job-desc-content {
  font-size: 0.88rem;
  color: #374151;
  line-height: 1.75;
  white-space: pre-wrap;
}

/* ── Responsive ───────────────────────────────────── */
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.show { transform: translateX(0); }
  .sidebar-overlay.show { display: block; }
  .main-content { margin-left: 0; }
  .hamburger-btn { display: block; }
  .topbar { padding: 0.6rem 1rem; }
  .compare-bar {
    left: 1rem;
    right: 1rem;
    transform: none;
    border-radius: 1rem;
    flex-wrap: wrap;
    justify-content: center;
  }

  /* Sidebar mobile: logout destacado no topo da lista de nav */
  .sidebar-logout-mobile {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: calc(100% - 2.5rem);
    margin: 0.5rem 1.25rem 0.25rem;
    padding: 0.55rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: #ef4444;
    background: rgba(239,68,68,0.1);
    border: 1px solid rgba(239,68,68,0.25);
    border-radius: 0.5rem;
    text-decoration: none;
    transition: background 0.18s;
  }
  .sidebar-logout-mobile:hover { background: rgba(239,68,68,0.2); color: #ef4444; }
  .sidebar-logout { display: none; }
}

@media (max-width: 767.98px) {
  .score-bar-label { min-width: 80px; font-size: 0.72rem; }
  .cand-card { padding: 0.6rem 0.75rem; }
}

@media (max-width: 575.98px) {
  .sidebar-logo { height: 113px; }
  .auth-logo-img { height: 144px; }
  .page-content { padding: 0.75rem; }

  /* Current plan banner — empilha em mobile */
  .current-plan-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
  }
  .current-plan-banner .d-flex.justify-content-between {
    flex-wrap: wrap;
    gap: 0.25rem;
  }
  .current-plan-banner #banner-period {
    width: 100%;
  }
  .current-plan-banner .row.g-2 .col-6 {
    flex: 0 0 100%;
    max-width: 100%;
  }

  .card-stat .stat-number { font-size: 1.4rem; }
  .card-stat { padding: 0.75rem !important; }

  .topbar { padding: 0.5rem 0.75rem; }
  .topbar-title { font-size: 0.95rem; }

  #job-header .d-flex.align-items-start { flex-direction: column; }
  #job-status-badge { align-self: flex-start; margin: 0 !important; }

  .score-gauge { width: 44px; height: 44px; font-size: 0.82rem; }

  .compare-bar {
    font-size: 0.8rem;
    padding: 0.5rem 0.75rem;
    gap: 0.6rem;
    bottom: 1rem;
  }

  .dropzone { padding: 1.25rem 1rem; }

  .btn-group[role="group"] { width: 100%; }
  .btn-group[role="group"] .btn { flex: 1; font-size: 0.78rem; padding: 0.3rem 0.25rem; }

  .auth-card { margin: 0.75rem; }

  .col-12.d-flex.justify-content-end { flex-direction: column-reverse; }
  .col-12.d-flex.justify-content-end .btn { width: 100%; }

  .modal-dialog { margin: 0.5rem; }
  .modal-content { border-radius: var(--radius-card); }

  .compare-col { border-right: none; border-bottom: 1px solid #e8eaf0; padding-bottom: 1rem; margin-bottom: 0.5rem; }
  .compare-col:last-child { border-bottom: none; }
}

/* ── Admin mobile ─────────────────────────────────── */
@media (max-width: 575.98px) {
  /* User card header — empilha badges abaixo do nome */
  #users-container .card .p-3.d-flex { flex-wrap: wrap; gap: 0.5rem; }
  #users-container .card .flex-grow-1 { min-width: 0; width: 100%; }
  #users-container .card .d-flex.align-items-center.gap-1 {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start !important;
  }

  /* Modal detail — full width */
  #user-detail-modal .modal-dialog { margin: 0; max-width: 100%; height: 100%; }
  #user-detail-modal .modal-content { border-radius: 0; height: 100%; }
  #user-detail-modal .modal-body { padding: 0.75rem; }

  /* Detail section rows — full width em mobile */
  .detail-section .row > [class*="col-"] { flex: 0 0 100%; max-width: 100%; }
  .detail-section .row > .col-6 { flex: 0 0 50%; max-width: 50%; }

  /* Tabela pagamentos — scroll horizontal */
  .detail-section .table-responsive { font-size: 0.75rem; }
  .detail-section table th, .detail-section table td { padding: 0.35rem 0.4rem; white-space: nowrap; }

  /* Plan options grid — 2 por linha */
  #ud-plans-grid .col-6 { flex: 0 0 50%; max-width: 50%; }

  /* Admin tickets table */
  .table th, .table td { font-size: 0.78rem; padding: 0.4rem 0.5rem; }

  /* Admin users action buttons inline */
  #users-container .btn-outline-primary,
  #users-container .btn-outline-secondary { padding: 0.2rem 0.4rem; font-size: 0.75rem; }
}

/* ── Print ────────────────────────────────────────── */
@media print {
  .sidebar, .topbar, .compare-bar, .btn { display: none !important; }
  .main-content { margin-left: 0; }
}
