/* =====================================================
   RH Futura - Sistema de Gestão de RH
   Editora Futura - Identidade Visual Roxo
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@300;400;500;600;700;800&family=Poppins:wght@400;500;600;700&display=swap');

:root {
  --roxo-50:  #f5f3ff;
  --roxo-100: #ede9fe;
  --roxo-200: #ddd6fe;
  --roxo-300: #c4b5fd;
  --roxo-400: #a78bfa;
  --roxo-500: #8b5cf6;
  --roxo-600: #7c3aed;
  --roxo-700: #6d28d9;
  --roxo-800: #5b21b6;
  --roxo-900: #4c1d95;
  --roxo-dark: #2e1065;

  --primary:       #7c3aed;
  --primary-light: #a78bfa;
  --primary-dark:  #5b21b6;
  --primary-bg:    #f5f3ff;

  --white:   #ffffff;
  --gray-50: #f9fafb;
  --gray-100:#f3f4f6;
  --gray-200:#e5e7eb;
  --gray-300:#d1d5db;
  --gray-400:#9ca3af;
  --gray-500:#6b7280;
  --gray-600:#4b5563;
  --gray-700:#374151;
  --gray-800:#1f2937;
  --gray-900:#111827;

  --success: #059669;
  --success-bg: #d1fae5;
  --warning: #d97706;
  --warning-bg: #fef3c7;
  --danger:  #dc2626;
  --danger-bg: #fee2e2;
  --info:    #2563eb;
  --info-bg: #dbeafe;

  --sidebar-width: 260px;
  --header-height: 64px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,.06), 0 4px 6px rgba(0,0,0,.05);
  --shadow-purple: 0 4px 20px rgba(124,58,237,.2);

  --font-main: 'Nunito', sans-serif;
  --font-head: 'Poppins', sans-serif;
}

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

body {
  font-family: var(--font-main);
  background: var(--gray-50);
  color: var(--gray-800);
  font-size: 14px;
  line-height: 1.6;
}

/* ===== SIDEBAR ===== */
.sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: var(--sidebar-width);
  background: linear-gradient(180deg, #2e1065 0%, #4c1d95 40%, #5b21b6 100%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.1);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo img { width: 42px; height: 42px; object-fit: contain; }

.sidebar-logo-text {
  font-family: var(--font-head);
  color: white;
}

.sidebar-logo-text .editora { font-size: 10px; letter-spacing: 2px; opacity: .7; text-transform: uppercase; }
.sidebar-logo-text .futura  { font-size: 18px; font-weight: 700; line-height: 1; }
.sidebar-logo-text .rh-tag  { font-size: 10px; background: var(--roxo-500); padding: 1px 6px; border-radius: 4px; color: white; }

.sidebar-mascot {
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,.05);
  margin: 12px;
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,.1);
}

.sidebar-mascot img { width: 44px; height: 44px; object-fit: contain; }

.mascot-msg {
  font-size: 11.5px;
  color: rgba(255,255,255,.85);
  line-height: 1.4;
}

.mascot-msg strong { color: white; font-size: 12px; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 0; }

.nav-section-title {
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: rgba(255,255,255,.4);
  padding: 12px 20px 6px;
  font-weight: 600;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: rgba(255,255,255,.75);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: all .2s;
  position: relative;
  border-radius: 0;
}

.nav-item:hover {
  background: rgba(255,255,255,.08);
  color: white;
}

.nav-item.active {
  background: rgba(255,255,255,.12);
  color: white;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--roxo-300);
  border-radius: 0 2px 2px 0;
}

.nav-item i { font-size: 18px; width: 22px; flex-shrink: 0; }

.nav-badge {
  margin-left: auto;
  background: var(--roxo-500);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,.1);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-sm);
  transition: background .2s;
  cursor: pointer;
}

.sidebar-user:hover { background: rgba(255,255,255,.08); }

.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--roxo-500);
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 13px;
  flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }
.user-info .name { color: white; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-info .role { color: rgba(255,255,255,.5); font-size: 11px; }
.user-info a { color: rgba(255,255,255,.5); font-size: 11px; text-decoration: none; }
.user-info a:hover { color: white; }

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

.topbar {
  height: var(--header-height);
  background: white;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow);
}

.topbar-title {
  font-family: var(--font-head);
  font-size: 17px;
  font-weight: 600;
  color: var(--gray-800);
  flex: 1;
}

.topbar-title span { color: var(--primary); }

.topbar-actions { display: flex; align-items: center; gap: 10px; }

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

/* ===== CARDS ===== */
.card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-100);
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-header h3 {
  font-family: var(--font-head);
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-800);
  flex: 1;
}

.card-header i { color: var(--primary); font-size: 18px; }

.card-body { padding: 20px; }
.card-footer { padding: 14px 20px; border-top: 1px solid var(--gray-100); background: var(--gray-50); }

/* ===== STAT CARDS ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: white;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform .2s, box-shadow .2s;
}

.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.stat-icon {
  width: 52px; height: 52px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.stat-icon i { font-size: 24px; }
.stat-icon.purple { background: var(--primary-bg); }
.stat-icon.purple i { color: var(--primary); }
.stat-icon.green  { background: #d1fae5; }
.stat-icon.green i  { color: var(--success); }
.stat-icon.amber  { background: #fef3c7; }
.stat-icon.amber i  { color: var(--warning); }
.stat-icon.red    { background: #fee2e2; }
.stat-icon.red i    { color: var(--danger); }
.stat-icon.blue   { background: #dbeafe; }
.stat-icon.blue i   { color: var(--info); }

.stat-info .value {
  font-family: var(--font-head);
  font-size: 26px;
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1;
}

.stat-info .label {
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 3px;
}

.stat-info .sub {
  font-size: 11.5px;
  color: var(--success);
  font-weight: 600;
  margin-top: 2px;
}

/* ===== TABELAS ===== */
.table-wrapper { overflow-x: auto; }

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.data-table thead th {
  background: var(--primary-bg);
  color: var(--primary-dark);
  font-family: var(--font-head);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: 11px 16px;
  text-align: left;
  border-bottom: 2px solid var(--roxo-200);
  white-space: nowrap;
}

.data-table tbody tr { transition: background .15s; }
.data-table tbody tr:hover { background: var(--primary-bg); }
.data-table tbody tr + tr td { border-top: 1px solid var(--gray-100); }
.data-table tbody td { padding: 12px 16px; color: var(--gray-700); }

/* ===== BOTÕES ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-family: var(--font-main);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all .2s;
  text-decoration: none;
  white-space: nowrap;
}

.btn i { font-size: 16px; }

.btn-primary { background: var(--primary); color: white; box-shadow: var(--shadow-purple); }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); }

.btn-secondary { background: var(--gray-100); color: var(--gray-700); }
.btn-secondary:hover { background: var(--gray-200); }

.btn-success { background: var(--success); color: white; }
.btn-success:hover { filter: brightness(1.05); }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { filter: brightness(1.05); }

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--primary);
  color: var(--primary);
}
.btn-outline:hover { background: var(--primary-bg); }

.btn-sm { padding: 5px 12px; font-size: 12.5px; }
.btn-icon { padding: 7px; }

/* ===== BADGES ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
}

.badge-success  { background: var(--success-bg); color: #065f46; }
.badge-warning  { background: var(--warning-bg); color: #92400e; }
.badge-danger   { background: var(--danger-bg);  color: #991b1b; }
.badge-info     { background: var(--info-bg);    color: #1e40af; }
.badge-secondary{ background: var(--gray-100);   color: var(--gray-600); }
.badge-purple   { background: var(--roxo-100);   color: var(--roxo-800); }

/* ===== FORMULÁRIOS ===== */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 5px;
}

.form-label .req { color: var(--danger); }

.form-control {
  width: 100%;
  padding: 9px 13px;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-family: var(--font-main);
  font-size: 13.5px;
  color: var(--gray-800);
  background: white;
  transition: border-color .2s, box-shadow .2s;
  outline: none;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(124,58,237,.12);
}

.form-control:disabled { background: var(--gray-50); color: var(--gray-500); }

select.form-control { cursor: pointer; }

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.form-section {
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 20px;
}

.form-section-title {
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  background: white;
  padding: 0 8px;
  margin: -28px 0 16px 8px;
  display: inline-block;
}

/* ===== ALERTAS ===== */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.alert-success { background: var(--success-bg); color: #065f46; border-left: 3px solid var(--success); }
.alert-danger   { background: var(--danger-bg);  color: #991b1b; border-left: 3px solid var(--danger); }
.alert-warning  { background: var(--warning-bg); color: #92400e; border-left: 3px solid var(--warning); }
.alert-info     { background: var(--info-bg);    color: #1e40af; border-left: 3px solid var(--info); }

/* ===== AVATAR ===== */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 700;
  background: var(--primary-bg);
  color: var(--primary);
  font-family: var(--font-head);
  flex-shrink: 0;
}

.avatar-sm  { width: 32px; height: 32px; font-size: 12px; }
.avatar-md  { width: 44px; height: 44px; font-size: 15px; }
.avatar-lg  { width: 64px; height: 64px; font-size: 22px; }
.avatar-xl  { width: 80px; height: 80px; font-size: 28px; }

.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

/* ===== PESQUISA ===== */
.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-box i {
  position: absolute;
  left: 11px;
  color: var(--gray-400);
  font-size: 16px;
  pointer-events: none;
}

.search-box input {
  padding-left: 36px;
  width: 280px;
  height: 36px;
  border: 1.5px solid var(--gray-200);
  border-radius: 20px;
  font-family: var(--font-main);
  font-size: 13px;
  outline: none;
  transition: all .2s;
  background: var(--gray-50);
}

.search-box input:focus {
  background: white;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(124,58,237,.1);
  width: 320px;
}

/* ===== PAGINAÇÃO ===== */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 16px;
}

.page-btn {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1.5px solid var(--gray-200);
  background: white;
  color: var(--gray-600);
  text-decoration: none;
  transition: all .15s;
}

.page-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); border-color: var(--primary); color: white; }
.page-btn.disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }

/* ===== MODAL ===== */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
}

.modal-backdrop.open { display: flex; }

.modal {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 50px rgba(0,0,0,.15);
  max-width: 580px;
  width: 95%;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp .25s ease;
}

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

.modal-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-header h4 {
  font-family: var(--font-head);
  font-size: 16px;
  font-weight: 600;
  flex: 1;
}

.modal-header i { color: var(--primary); font-size: 20px; }
.modal-body { padding: 20px; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--gray-100); display: flex; gap: 10px; justify-content: flex-end; }

/* ===== PERFIL FUNCIONÁRIO ===== */
.profile-header {
  background: linear-gradient(135deg, #4c1d95 0%, #7c3aed 100%);
  border-radius: var(--radius-lg);
  padding: 28px;
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
  color: white;
}

.profile-header .avatar { border: 3px solid rgba(255,255,255,.3); }
.profile-header .func-nome { font-family: var(--font-head); font-size: 20px; font-weight: 700; }
.profile-header .func-cargo { opacity: .8; font-size: 14px; }
.profile-header .func-meta { display: flex; gap: 20px; margin-top: 8px; }
.profile-header .func-meta span { font-size: 12px; opacity: .75; display: flex; align-items: center; gap: 4px; }

/* ===== TABS ===== */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--gray-200); margin-bottom: 20px; }

.tab-btn {
  padding: 10px 18px;
  font-family: var(--font-main);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--gray-500);
  cursor: pointer;
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color .2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ===== DASHBOARD CHARTS ===== */
.chart-container { position: relative; height: 280px; }

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 48px 24px;
}

.empty-state i { font-size: 48px; color: var(--gray-300); }
.empty-state p { color: var(--gray-500); margin-top: 8px; font-size: 14px; }

/* ===== LOGIN PAGE ===== */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #1a0640 0%, #2e1065 35%, #4c1d95 70%, #7c3aed 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  background: white;
  border-radius: 20px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 25px 60px rgba(0,0,0,.3);
}

.login-header { text-align: center; margin-bottom: 28px; }
.login-header img.logo { height: 60px; margin-bottom: 12px; }
.login-header h2 { font-family: var(--font-head); font-size: 22px; font-weight: 700; color: var(--primary-dark); }
.login-header p { color: var(--gray-500); font-size: 13.5px; }

.login-mascot {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--primary-bg);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 24px;
  border: 1.5px solid var(--roxo-200);
}

.login-mascot img { width: 56px; height: 56px; object-fit: contain; }
.login-mascot p { font-size: 12.5px; color: var(--primary-dark); line-height: 1.4; }
.login-mascot strong { color: var(--primary); }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--roxo-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ===== UTILITIES ===== */
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.text-muted { color: var(--gray-500); }
.text-small { font-size: 12px; }
.fw-600 { font-weight: 600; }
.text-purple { color: var(--primary); }
.text-right { text-align: right; }

/* ===== RESPONSIVO ===== */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform .3s; }
  .sidebar.open { transform: translateX(0); }
  .main-wrapper { margin-left: 0; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }
  .page-content { padding: 16px; }
}

/* ===== TOOLTIPS ===== */
[data-tooltip] { position: relative; cursor: help; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--gray-900);
  color: white;
  font-size: 11.5px;
  padding: 5px 9px;
  border-radius: 5px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s;
  z-index: 1000;
}

[data-tooltip]:hover::after { opacity: 1; }

/* ===== MR BRAIN NOTIF ===== */
.brain-tip {
  background: linear-gradient(135deg, var(--roxo-50), var(--roxo-100));
  border: 1.5px solid var(--roxo-200);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 20px;
}

.brain-tip img { width: 40px; height: 40px; object-fit: contain; flex-shrink: 0; }
.brain-tip p { font-size: 13px; color: var(--primary-dark); line-height: 1.5; }
.brain-tip strong { color: var(--primary); }
