/* INSURA VAULT — Admin Portal CSS */

/* =================== ADMIN SHELL =================== */
#admin-portal { display: flex; min-height: 100vh; background: var(--admin-bg); }

/* =================== SIDEBAR =================== */
.admin-sidebar {
  position: fixed; left: 0; top: 0; bottom: 0;
  width: var(--sidebar-width); 
  background: linear-gradient(180deg, var(--admin-sidebar-bg) 0%, #141a32 100%);
  color: var(--admin-sidebar-text); display: flex; flex-direction: column;
  z-index: 900; overflow-y: auto; overflow-x: hidden;
  transition: transform 0.3s ease;
  box-shadow: 2px 0 20px rgba(0,0,0,0.15);
}
.sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 16px; border-bottom: 1px solid rgba(255,255,255,0.08);
}
/* Read-only (view_only) staff: hide the "+ Add / Send" create buttons and the
   Customer-360 Edit button. Row "Update" actions still show but the server
   returns a clear 403. */
body.role-view-only .page-actions .btn-primary,
body.role-view-only #section-customer-detail .page-actions .btn-outline { display: none; }

.sidebar-logo { display: flex; align-items: center; gap: 10px; }
.sidebar-shield { font-size: 26px; }
.sidebar-brand { line-height: 1.2; }
.brand-insura { color: #fff; font-weight: 700; font-size: 16px; }
.brand-vault { color: var(--brand-gold); font-weight: 800; font-size: 16px; }
.brand-sub { display: block; font-size: 10px; color: rgba(255,255,255,0.5); text-transform: uppercase; letter-spacing: 1px; }
.sidebar-toggle { display: none; background: none; border: none; color: #fff; font-size: 20px; cursor: pointer; }

.sidebar-user {
  padding: 14px 16px; border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex; align-items: center; gap: 10px;
}
.sidebar-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--brand-accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: var(--text-sm); font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 11px; color: rgba(255,255,255,0.5); text-transform: capitalize; }

.sidebar-nav { flex: 1; padding: 8px 8px; }
.nav-group { margin-bottom: 12px; }
.nav-group-label {
  padding: 8px 12px 4px; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em; color: rgba(255,255,255,0.3);
}
.sidebar-nav-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 10px 12px; border-radius: 8px;
  color: rgba(255,255,255,0.65); font-size: var(--text-sm); font-weight: 500;
  background: none; border: none; cursor: pointer;
  transition: all 0.2s; text-align: left;
}
.sidebar-nav-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.sidebar-nav-item.active { background: linear-gradient(135deg, var(--admin-sidebar-active), #6366f1); color: #fff; font-weight: 600; box-shadow: 0 2px 12px rgba(79,110,247,0.35); }
.nav-item-icon { font-size: 18px; width: 22px; text-align: center; }
.nav-item-label { flex: 1; }
.nav-badge {
  min-width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;
  border-radius: 10px; font-size: 11px; font-weight: 700;
  background: var(--color-danger); color: #fff; padding: 0 5px;
}

.sidebar-footer { padding: 12px 16px; border-top: 1px solid rgba(255,255,255,0.06); }
.sidebar-logout {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 10px 12px; border-radius: 8px; background: rgba(255,255,255,0.04);
  border: none; color: rgba(255,255,255,0.6); font-size: var(--text-sm);
  font-weight: 500; cursor: pointer; transition: all 0.2s;
}
.sidebar-logout:hover { background: rgba(239,68,68,0.15); color: #ef4444; }

/* =================== ADMIN HEADER =================== */
.admin-content {
  margin-left: var(--sidebar-width); flex: 1; min-height: 100vh;
  display: flex; flex-direction: column;
}
.admin-header {
  position: sticky; top: 0; z-index: 800;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; height: var(--header-height);
  background: var(--admin-header-bg); border-bottom: 1px solid var(--admin-border);
  box-shadow: 0 1px 6px rgba(0,0,0,0.05);
}
.admin-header-left { display: flex; align-items: center; gap: 16px; }
.hamburger { display: none; background: none; border: none; font-size: 22px; cursor: pointer; color: var(--admin-text); }
.admin-breadcrumb { font-size: var(--text-lg); font-weight: 700; color: var(--admin-text); }
.admin-header-right { display: flex; align-items: center; gap: 16px; }
.admin-search-wrap { position: relative; }
.admin-global-search {
  width: 280px; padding: 9px 14px; border: 1.5px solid var(--admin-border);
  border-radius: 10px; font-size: var(--text-sm); background: var(--neutral-50);
  outline: none; transition: all 0.2s;
}
.admin-global-search:focus { border-color: var(--brand-accent); background: #fff; }
.search-results {
  position: absolute; top: 100%; left: 0; right: 0;
  background: #fff; border: 1px solid var(--admin-border);
  border-radius: 10px; box-shadow: var(--shadow-lg);
  max-height: 300px; overflow-y: auto; margin-top: 4px; z-index: 100;
}
.search-results-item {
  padding: 10px 14px; cursor: pointer; font-size: var(--text-sm);
  border-bottom: 1px solid var(--neutral-100); transition: background 0.15s;
}
.search-results-item:hover { background: var(--neutral-50); }
.admin-notif-btn {
  position: relative; background: none; border: 1.5px solid var(--admin-border);
  border-radius: 10px; padding: 7px 12px; cursor: pointer; font-size: 16px;
  transition: all 0.2s;
}
.admin-notif-btn:hover { border-color: var(--brand-accent); }
.notif-count {
  font-size: 11px; font-weight: 700; background: var(--color-danger);
  color: #fff; border-radius: 8px; padding: 0 5px; margin-left: 4px;
}
.admin-user-chip {
  display: flex; align-items: center; gap: 8px; padding: 5px 12px 5px 5px;
  border: 1.5px solid var(--admin-border); border-radius: 10px;
  cursor: pointer; transition: border-color 0.2s;
}
.admin-user-chip:hover { border-color: var(--brand-accent); }
.chip-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--brand-accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
}
.chip-name { font-size: var(--text-sm); font-weight: 600; color: var(--admin-text); }
.chip-dropdown { font-size: 12px; color: var(--neutral-400); }

/* =================== ADMIN SECTIONS =================== */
.admin-sections { flex: 1; padding: 24px; }
.admin-section { display: none; animation: fadeIn 0.3s ease; }
.admin-section.active { display: block; }

.section-page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  flex-wrap: wrap; gap: 16px; margin-bottom: 24px;
}
.page-title { font-size: var(--text-2xl); font-weight: 800; color: var(--admin-text); }
.page-subtitle { font-size: var(--text-sm); color: var(--admin-text-muted); margin-top: 2px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* =================== KPI CARDS =================== */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 24px; }
.kpi-card {
  background: #fff; border-radius: var(--border-radius); padding: 20px;
  display: flex; align-items: center; gap: 16px;
  border: 1px solid var(--admin-border);
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative; overflow: hidden;
}
.kpi-card::after {
  content: ''; position: absolute; top: 0; right: 0;
  width: 80px; height: 80px; border-radius: 50%;
  background: radial-gradient(circle, rgba(79,110,247,0.06) 0%, transparent 70%);
  transform: translate(30%, -30%);
}
.kpi-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.kpi-card--alert { border-left: 4px solid var(--color-danger); }
.kpi-icon {
  width: 52px; height: 52px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center; font-size: 24px;
  flex-shrink: 0;
  background: var(--neutral-50);
}
.kpi-info { flex: 1; position: relative; z-index: 1; }
.kpi-value { font-size: var(--text-2xl); font-weight: 800; color: var(--admin-text); line-height: 1.2; }
.kpi-label { font-size: var(--text-sm); color: var(--admin-text-muted); margin-top: 2px; }
.kpi-sub { font-size: 12px; color: var(--neutral-400); margin-top: 4px; display: flex; align-items: center; gap: 4px; }

/* =================== CHARTS =================== */
.charts-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; margin-bottom: 24px; }
.chart-card { background: #fff; border-radius: var(--border-radius); border: 1px solid var(--admin-border); overflow: hidden; box-shadow: var(--shadow-sm); transition: box-shadow 0.2s; }
.chart-card:hover { box-shadow: var(--shadow-md); }
.chart-card--wide { }
.chart-card-header { padding: 16px 20px; border-bottom: 1px solid var(--admin-border); }
.chart-card-header h3 { font-size: var(--text-base); font-weight: 700; color: var(--admin-text); }
.chart-wrap { padding: 16px; height: 280px; }

/* =================== DATA CARDS =================== */
.dashboard-bottom-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.data-card { background: #fff; border-radius: var(--border-radius); border: 1px solid var(--admin-border); box-shadow: var(--shadow-sm); transition: box-shadow 0.2s; }
.data-card:hover { box-shadow: var(--shadow-md); }
.data-card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--admin-border);
}
.data-card-header h3 { font-size: var(--text-base); font-weight: 700; color: var(--admin-text); }

/* Critical renewal items, task items */
.critical-renewal-item, .pending-task-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 18px;
  border-bottom: 1px solid var(--neutral-100);
}
.critical-renewal-item:last-child, .pending-task-item:last-child { border-bottom: none; }

/* =================== RENEWAL TABS =================== */
.renewal-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.renewal-tab {
  padding: 8px 16px; border-radius: var(--border-radius-full);
  font-size: var(--text-sm); font-weight: 500;
  background: #fff; border: 1px solid var(--neutral-200);
  color: var(--neutral-600); cursor: pointer; transition: all 0.2s;
}
.renewal-tab.active { background: var(--brand-accent); color: #fff; border-color: var(--brand-accent); }

/* Pipeline Grid */
.pipeline-grid { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.pipeline-column { flex: 1; min-width: 200px; }
.pipeline-column-header {
  padding: 10px 12px; border-radius: 8px 8px 0 0;
  font-size: var(--text-sm); font-weight: 600;
  display: flex; align-items: center; justify-content: space-between;
}
.pipeline-column-body { background: var(--neutral-50); border-radius: 0 0 8px 8px; padding: 6px; min-height: 150px; }
.pipeline-card {
  background: #fff; border-radius: 8px; padding: 10px; margin-bottom: 6px;
  border: 1px solid var(--neutral-200); font-size: 13px;
  cursor: pointer; transition: all 0.2s;
}
.pipeline-card:hover { box-shadow: var(--shadow-sm); }

/* =================== KANBAN BOARD =================== */
.kanban-board { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 12px; }
.kanban-column { flex: 1; min-width: 240px; }
.kanban-column-header {
  padding: 10px 14px; border-radius: 10px 10px 0 0;
  font-size: var(--text-sm); font-weight: 600;
  display: flex; align-items: center; justify-content: space-between;
}
.kanban-column-body { background: var(--neutral-50); border-radius: 0 0 10px 10px; padding: 8px; min-height: 200px; }
.kanban-card {
  background: #fff; border-radius: 10px; padding: 12px;
  margin-bottom: 8px; border: 1px solid var(--neutral-200);
  cursor: pointer; transition: all 0.2s;
}
.kanban-card:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); }

/* =================== EMPLOYEE CARDS =================== */
.employee-cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.employee-card {
  background: #fff; border-radius: var(--border-radius); padding: 18px;
  border: 1px solid var(--admin-border); display: flex; gap: 14px; align-items: flex-start;
  transition: all 0.2s;
}
.employee-card:hover { box-shadow: var(--shadow-md); }
.employee-card-avatar {
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--brand-accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 18px; flex-shrink: 0;
}
.employee-card-info { flex: 1; }
.employee-card-name { font-weight: 600; color: var(--admin-text); }
.employee-card-role { font-size: 12px; color: var(--neutral-500); text-transform: capitalize; margin-top: 2px; }
.employee-card-meta { font-size: 12px; color: var(--neutral-400); margin-top: 6px; }

/* =================== NOTIFICATION TABS =================== */
.notif-tabs { display: flex; gap: 4px; background: var(--neutral-100); border-radius: 10px; padding: 4px; margin-bottom: 16px; }
.notif-section-tab {
  flex: 1; padding: 9px 16px; border-radius: 8px;
  font-size: var(--text-sm); font-weight: 500; text-align: center;
  color: var(--neutral-500); background: transparent; border: none;
  cursor: pointer; transition: all 0.2s;
}
.notif-section-tab.active { background: #fff; color: var(--brand-accent); font-weight: 600; box-shadow: var(--shadow-sm); }

/* =================== SETTINGS TABS =================== */
.settings-tabs { display: flex; gap: 4px; background: var(--neutral-100); border-radius: 10px; padding: 4px; margin-bottom: 20px; }
.settings-tab {
  padding: 9px 18px; border-radius: 8px;
  font-size: var(--text-sm); font-weight: 500;
  color: var(--neutral-500); background: transparent; border: none;
  cursor: pointer; transition: all 0.2s;
}
.settings-tab.active { background: #fff; color: var(--brand-accent); font-weight: 600; box-shadow: var(--shadow-sm); }
.settings-card {
  background: #fff; border-radius: var(--border-radius); padding: 24px;
  border: 1px solid var(--admin-border); max-width: 500px;
}
.settings-card h3 { font-size: var(--text-lg); font-weight: 700; margin-bottom: 16px; color: var(--admin-text); }

/* =================== BULK SEND FORM =================== */
.bulk-send-form {
  background: #fff; border-radius: var(--border-radius); padding: 24px;
  border: 1px solid var(--admin-border); max-width: 600px;
}

/* =================== SIDEBAR OVERLAY =================== */
.sidebar-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 899; }

/* =================== RESPONSIVE =================== */
@media (max-width: 1024px) {
  .admin-sidebar { transform: translateX(-100%); }
  .admin-sidebar.open { transform: translateX(0); box-shadow: var(--shadow-xl); }
  .admin-content { margin-left: 0; }
  .hamburger { display: block !important; }
  .sidebar-toggle { display: block !important; }
}

@media (max-width: 768px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .charts-grid { grid-template-columns: 1fr; }
  .dashboard-bottom-grid { grid-template-columns: 1fr; }
  .admin-global-search { display: none; }
  .admin-sections { padding: 16px; }
  .employee-cards-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .admin-header { padding: 0 12px; }
  .page-title { font-size: var(--text-xl); }
}
