/* ══════════════════════════════════════════════════════════════════
   Staff Profiles — Module-specific styles
   ══════════════════════════════════════════════════════════════════ */

/* ── Clickable table rows ───────────────────────────────────── */
#staffTable tr { cursor: pointer; }
#staffTable tr:hover td { background: var(--primary-xlight); }

/* ── Wide modal ─────────────────────────────────────────────── */
.modal-wide { max-width: 800px; }

/* ── Three-column form row ──────────────────────────────────── */
.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

/* ── Profile section headers ────────────────────────────────── */
.profile-section-header {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 24px 0 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--primary-xlight);
}
.profile-section-header:first-child { margin-top: 0; }

/* ── Staff status badges ────────────────────────────────────── */
.staff-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}
.staff-probationary { background: #fef3c7; color: #b45309; }
.staff-regular  { background: #dbeafe; color: #1d4ed8; }
.staff-active   { background: #dcfce7; color: #15803d; }
.staff-inactive { background: #f1f5f9; color: #64748b; }
.staff-on-leave { background: #fef3c7; color: #b45309; }

/* ── Branch tags ────────────────────────────────────────────── */
.branch-tag {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 4px;
}
.branch-tag-sandbox-east      { background: #dbeafe; color: #1d4ed8; }
.branch-tag-sandbox-greenhills { background: #dcfce7; color: #15803d; }
.branch-tag-verdana-store     { background: #fef3c7; color: #b45309; }

/* ── View modal detail grid ─────────────────────────────────── */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
.detail-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.detail-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
}
.detail-value {
  font-size: 14px;
  color: var(--text);
}
.detail-full { grid-column: 1 / -1; }

/* ── Unit type tags ─────────────────────────────────────────── */
.unit-type-tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  background: var(--primary-xlight);
  color: var(--primary);
  margin: 2px;
}

/* ── 201 Files section ──────────────────────────────────────── */
.files-201-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.files-201-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.file-201-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
}
.file-201-item .file-icon { font-size: 18px; flex-shrink: 0; }
.file-201-item .file-info { flex: 1; min-width: 0; }
.file-201-item .file-name { font-weight: 500; word-break: break-all; }
.file-201-item .file-meta { color: var(--text-light); font-size: 11px; margin-top: 2px; }
.file-201-item .file-actions { display: flex; gap: 6px; flex-shrink: 0; }
.file-201-item .file-actions a,
.file-201-item .file-actions button {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  transition: border-color .15s;
}
.file-201-item .file-actions a:hover,
.file-201-item .file-actions button:hover { border-color: var(--primary); color: var(--primary); }
.file-201-item .file-actions .delete-file-btn {
  color: var(--danger);
  border-color: transparent;
  background: none;
}
.file-201-item .file-actions .delete-file-btn:hover {
  color: #dc2626;
}

/* ── Settings sub-tabs ──────────────────────────────────────── */
.settings-subtabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  overflow-x: auto;
}
.settings-subtab {
  background: none;
  border: none;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-light);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
  white-space: nowrap;
}
.settings-subtab:hover { color: var(--text); }
.settings-subtab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ── Settings table ─────────────────────────────────────────── */
.settings-table {
  width: 100%;
  border-collapse: collapse;
}
.settings-table th,
.settings-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.settings-table th {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  background: var(--bg);
}
.settings-table td .actions-cell { white-space: nowrap; }

/* ── Settings action buttons ────────────────────────────────── */
.settings-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

/* ── Assignment badges in unit types ────────────────────────── */
.assign-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
}
.assign-all         { background: #dcfce7; color: #15803d; }
.assign-departments { background: #dbeafe; color: #1d4ed8; }
.assign-individuals { background: #fef3c7; color: #b45309; }

/* ── Settings item modal form ─────────────────────────────────── */
.settings-form-group {
  margin-bottom: 16px;
}
.settings-form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 6px;
}
.settings-form-group input,
.settings-form-group select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
}
.settings-form-group input:focus,
.settings-form-group select:focus {
  outline: none;
  border-color: var(--primary);
}

/* ── Checkbox list for assignment ───────────────────────────── */
.checkbox-list {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
}
.checkbox-list label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 13px;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  color: var(--text);
  cursor: pointer;
}
.checkbox-list label:hover { color: var(--primary); }
.checkbox-list input[type="checkbox"] { width: auto; }

/* ── Actions column ─────────────────────────────────────────── */
.actions-cell { white-space: nowrap; }
.actions-cell .btn { margin-right: 4px; }

/* ── Card header actions ───────────────────────────────────── */
.card-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── 201 upload label in table ─────────────────────────────── */
.upload-201-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--primary);
  transition: border-color .15s, background .15s;
}
.upload-201-label:hover {
  border-color: var(--primary);
  background: var(--primary-xlight);
}
.file-count-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  background: var(--primary-xlight);
  color: var(--primary);
  cursor: pointer;
  transition: background .15s;
}
.file-count-badge:hover {
  background: var(--primary-light, #b3e0e6);
}

/* ── CSV Import styles ─────────────────────────────────────── */
.csv-instructions {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 20px;
  font-size: 13px;
}
.csv-instructions p { margin: 0 0 8px; }
.csv-instructions ol {
  margin: 0;
  padding-left: 20px;
}
.csv-instructions li {
  margin-bottom: 4px;
  line-height: 1.5;
}
.csv-instructions code {
  background: #f1f5f9;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 12px;
  color: var(--primary);
}

.csv-upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px 20px;
  text-align: center;
  transition: border-color .2s, background .2s;
  margin-bottom: 16px;
}
.csv-upload-zone.dragover {
  border-color: var(--primary);
  background: var(--primary-xlight);
}
.csv-upload-icon { font-size: 32px; margin-bottom: 8px; }
.csv-upload-zone p {
  margin: 0 0 12px;
  color: var(--text-light);
  font-size: 13px;
}
.csv-file-name {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-light);
}

.csv-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.csv-preview-header h4 { margin: 0; font-size: 14px; }

.csv-preview-table-wrap {
  max-height: 300px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
}
.csv-preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.csv-preview-table th,
.csv-preview-table td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}
.csv-preview-table th {
  background: var(--bg);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: .5px;
  color: var(--text-muted);
  position: sticky;
  top: 0;
}
.csv-preview-table tr.csv-row-error td {
  background: #fef2f2;
  color: #dc2626;
}
.csv-preview-table tr.csv-row-ok td {
  background: #f0fdf4;
}

/* ── CSV Checkbox column ───────────────────────────────────── */
.csv-preview-table th:first-child,
.csv-preview-table td:first-child {
  width: 36px;
  text-align: center;
}
.csv-preview-table input[type="checkbox"] {
  width: 15px;
  height: 15px;
  cursor: pointer;
}

#csvErrors {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 12px;
  color: #dc2626;
}
#csvErrors ul {
  margin: 4px 0 0;
  padding-left: 18px;
}
#csvErrors li { margin-bottom: 2px; }

/* ── Sortable column headers ──────────────────────────────── */
.sortable {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 20px !important;
}
.sortable:hover {
  background: var(--primary-xlight);
}
.sort-icon {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  color: var(--text-muted);
  opacity: 0.4;
}
.sort-icon::after {
  content: "▲▼";
  font-size: 8px;
  letter-spacing: -2px;
}
.sortable.sort-asc .sort-icon {
  opacity: 1;
  color: var(--primary);
}
.sortable.sort-asc .sort-icon::after {
  content: "▲";
  letter-spacing: 0;
  font-size: 10px;
}
.sortable.sort-desc .sort-icon {
  opacity: 1;
  color: var(--primary);
}
.sortable.sort-desc .sort-icon::after {
  content: "▼";
  letter-spacing: 0;
  font-size: 10px;
}

/* ── Staff Photo Section (in create/edit modal) ───────────── */
.staff-photo-section {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.staff-photo-preview {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px dashed var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.staff-photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.staff-photo-preview .photo-placeholder-icon {
  font-size: 32px;
  opacity: 0.4;
}
.staff-photo-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ── Staff Photo in View Modal ────────────────────────────── */
.view-photo-section {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}
.view-photo {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--primary-xlight);
}
.view-photo-placeholder {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px dashed var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  opacity: 0.4;
}
.view-photo-info {
  flex: 1;
}
.view-photo-info h2 {
  margin: 0 0 4px;
  font-size: 20px;
  color: var(--text);
}
.view-photo-info .view-photo-subtitle {
  font-size: 13px;
  color: var(--text-light);
}

/* ── 201 Files Modal ──────────────────────────────────────── */
.files-201-modal-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 400px;
  overflow-y: auto;
}
.files-201-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-light);
  font-size: 13px;
}

/* ── Inline Profile (Staff Role) ──────────────────────────────── */
.inline-profile-hero {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 8px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.inline-profile-hero .view-photo {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid #ED6823;
  box-shadow: 0 4px 12px rgba(237, 104, 35, 0.15);
}
.inline-profile-hero .view-photo-placeholder {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: linear-gradient(135deg, #FFA235, #ED6823);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 44px;
  opacity: 1;
  color: #fff;
}
.inline-profile-hero-info {
  flex: 1;
}
.inline-profile-name {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}
.inline-profile-subtitle {
  font-size: 14px;
  color: var(--text-light);
  margin-bottom: 6px;
}
.inline-profile-status {
  margin-top: 4px;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .detail-grid { grid-template-columns: 1fr; }
  .form-row-3 { grid-template-columns: 1fr; }
  .modal-wide { max-width: 100%; }
  .settings-subtabs { gap: 0; }
  .card-header-actions { flex-wrap: wrap; }
  .staff-photo-section { flex-direction: column; text-align: center; }
  .inline-profile-hero { flex-direction: column; text-align: center; }
}

/* ── Missing 201 file indicators ───────────────────────────── */
.file-201-missing { opacity: 0.75; }
.file-missing-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  color: #b45309;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  border-radius: 3px;
  padding: 1px 5px;
  vertical-align: middle;
  margin-left: 4px;
}
.file-missing-note {
  font-size: 11px;
  color: #b45309;
  font-style: italic;
}
