/* ============================================================
   BioMasr HR AI — Custom Dark Theme Stylesheet
   ============================================================ */

:root {
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-card: #1c2128;
  --bg-sidebar: #0d1117;
  --border-color: #30363d;
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --accent-green: #00c853;
  --accent-blue: #1f6feb;
  --accent-yellow: #d29922;
  --accent-red: #f85149;
  --sidebar-width: 240px;
  --topbar-height: 60px;
}

/* Base */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  margin: 0;
  font-size: 0.925rem;
}

/* ============================================================
   APP LAYOUT
   ============================================================ */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 1040;
  transition: transform 0.3s ease;
  overflow-y: auto;
}

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

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #00c853, #00897b);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: #fff;
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.brand-sub {
  font-size: 0.7rem;
  color: #00c853;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

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

.sidebar-nav {
  gap: 2px;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  color: var(--text-secondary);
  border-radius: 8px;
  transition: all 0.15s ease;
  font-size: 0.875rem;
  font-weight: 500;
}

.sidebar-nav .nav-link i {
  font-size: 1rem;
  width: 20px;
  flex-shrink: 0;
}

.sidebar-nav .nav-link:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

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

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  overflow: hidden;
}

.user-avatar {
  width: 32px;
  height: 32px;
  background: var(--accent-blue);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.user-details {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.user-name {
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 0.65rem;
  width: fit-content;
}

.logout-btn {
  flex-shrink: 0;
  padding: 0.3rem 0.5rem;
}

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

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Topbar */
.topbar {
  height: var(--topbar-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-title {
  flex: 1;
}

.page-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
  color: var(--text-primary);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.clock-display {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-family: 'Courier New', monospace;
  background: var(--bg-card);
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  border: 1px solid var(--border-color);
}

/* Content area */
.content-area {
  padding: 1.5rem;
  flex: 1;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
}

.card-header {
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--border-color);
  padding: 0.875rem 1.25rem;
}

.card-body {
  padding: 1.25rem;
}

.card-footer {
  background: rgba(255, 255, 255, 0.02);
  border-top: 1px solid var(--border-color);
  padding: 0.75rem 1.25rem;
}

/* ============================================================
   STATS CARDS
   ============================================================ */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.stat-card.stat-blue { border-left: 3px solid #1f6feb; }
.stat-card.stat-green { border-left: 3px solid #00c853; }
.stat-card.stat-yellow { border-left: 3px solid #d29922; }
.stat-card.stat-red { border-left: 3px solid #f85149; }

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.stat-blue .stat-icon { background: rgba(31, 111, 235, 0.15); color: #1f6feb; }
.stat-green .stat-icon { background: rgba(0, 200, 83, 0.15); color: #00c853; }
.stat-yellow .stat-icon { background: rgba(210, 153, 34, 0.15); color: #d29922; }
.stat-red .stat-icon { background: rgba(248, 81, 73, 0.15); color: #f85149; }

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  color: var(--text-primary);
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

/* Mini stats */
.stat-mini {
  padding: 0.5rem;
}

.stat-mini-value {
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1;
}

.stat-mini-label {
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin-top: 0.2rem;
}

/* ============================================================
   SCORE BADGES
   ============================================================ */
.score-badge {
  display: inline-block;
  padding: 0.3rem 0.6rem;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.85rem;
  min-width: 48px;
  text-align: center;
}

.score-high {
  background: rgba(0, 200, 83, 0.15);
  color: #00c853;
  border: 1px solid rgba(0, 200, 83, 0.3);
}

.score-medium {
  background: rgba(210, 153, 34, 0.15);
  color: #d29922;
  border: 1px solid rgba(210, 153, 34, 0.3);
}

.score-low {
  background: rgba(248, 81, 73, 0.15);
  color: #f85149;
  border: 1px solid rgba(248, 81, 73, 0.3);
}

/* ============================================================
   TABLES
   ============================================================ */
.table {
  color: var(--text-primary);
  --bs-table-bg: transparent;
  --bs-table-hover-bg: rgba(255, 255, 255, 0.03);
  --bs-table-border-color: var(--border-color);
}

.table thead th {
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom-width: 1px;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.02);
}

.table td {
  padding: 0.75rem 1rem;
  vertical-align: middle;
  border-color: var(--border-color);
}

/* ============================================================
   CANDIDATE NAME CELL
   ============================================================ */
.candidate-name-cell {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.avatar-sm {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1f6feb, #00c853);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
  color: #fff;
  flex-shrink: 0;
}

.avatar-lg {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1f6feb, #00c853);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 2rem;
  color: #fff;
}

/* ============================================================
   QUICK ACTION BUTTONS
   ============================================================ */
.quick-action-btn {
  min-height: 90px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 600;
  transition: transform 0.15s ease;
}

.quick-action-btn:hover {
  transform: translateY(-2px);
}

/* ============================================================
   FORMS
   ============================================================ */
.form-control, .form-select {
  background-color: var(--bg-secondary);
  border-color: var(--border-color);
  color: var(--text-primary);
}

.form-control:focus, .form-select:focus {
  background-color: var(--bg-secondary);
  border-color: var(--accent-blue);
  color: var(--text-primary);
  box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.15);
}

.form-control::placeholder { color: var(--text-secondary); }
.input-group-text {
  background-color: var(--bg-secondary);
  border-color: var(--border-color);
  color: var(--text-secondary);
}

/* ============================================================
   CANDIDATE DETAIL
   ============================================================ */
.detail-info-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.875rem;
}

.detail-info-list li:last-child {
  border-bottom: none;
}

.detail-info-list li i {
  margin-top: 0.1rem;
  flex-shrink: 0;
}

.score-criterion {
  margin-bottom: 0.5rem;
}

.overall-score-display {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 1rem;
}

.role-suggestion-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: rgba(31, 111, 235, 0.15);
  color: var(--accent-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.email-body-preview {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem;
  max-height: 300px;
  overflow-y: auto;
}

.email-body-preview pre {
  color: var(--text-secondary);
  font-size: 0.8rem;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
}

/* ============================================================
   JOB CARDS
   ============================================================ */
.job-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.job-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
  min-height: 100vh;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  width: 100%;
  padding: 2rem;
  position: relative;
  z-index: 1;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 2.5rem;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.login-brand {
  text-align: center;
  margin-bottom: 2rem;
}

.login-logo {
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, #00c853, #00897b);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: #fff;
  margin: 0 auto 1rem;
  box-shadow: 0 8px 20px rgba(0, 200, 83, 0.3);
}

.login-title {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  letter-spacing: -0.02em;
}

.login-subtitle {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-bottom: 0.75rem;
}

.login-company-badge {
  display: inline-block;
  background: rgba(0, 200, 83, 0.1);
  border: 1px solid rgba(0, 200, 83, 0.2);
  color: #00c853;
  font-size: 0.75rem;
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
}

.login-footer {
  text-align: center;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
}

/* Background decorations */
.login-bg-decoration {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.decoration-circle {
  position: absolute;
  border-radius: 50%;
  opacity: 0.05;
}

.circle-1 {
  width: 400px; height: 400px;
  background: #00c853;
  top: -100px; right: -100px;
}

.circle-2 {
  width: 300px; height: 300px;
  background: #1f6feb;
  bottom: -50px; left: -100px;
}

.circle-3 {
  width: 200px; height: 200px;
  background: #d29922;
  top: 40%; left: 50%;
  transform: translate(-50%, -50%);
}

/* ============================================================
   UTILITIES
   ============================================================ */
.spin-icon {
  animation: spin 1.5s linear infinite;
}

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

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

/* Bootstrap overrides */
.btn-primary { background-color: var(--accent-blue); border-color: var(--accent-blue); }
.btn-success { background-color: #1a7a3a; border-color: #1a7a3a; }
.badge { font-weight: 500; }

.dropdown-menu {
  background-color: var(--bg-card);
  border-color: var(--border-color);
}

.dropdown-item {
  color: var(--text-primary);
}

.dropdown-item:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.progress {
  background-color: rgba(255, 255, 255, 0.08);
}

.modal-content {
  background-color: var(--bg-card);
  border-color: var(--border-color);
}

.modal-header, .modal-footer {
  border-color: var(--border-color);
}

.popover {
  background-color: var(--bg-card);
  border-color: var(--border-color);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay.active {
    display: block;
  }

  .main-content {
    margin-left: 0;
  }

  .content-area {
    padding: 1rem;
  }

  .topbar {
    padding: 0 1rem;
  }
}

@media (max-width: 576px) {
  .stat-value {
    font-size: 1.5rem;
  }

  .login-card {
    padding: 1.5rem;
  }

  .topbar-actions .clock-display {
    display: none;
  }
}
