/* ==========================================================================
   Components — buttons, forms, cards, badges, tables, modal, notes
   ========================================================================== */

/* Buttons ----------------------------------------------------------------- */
button,
.btn {
  cursor: pointer;
}

button.primary {
  background: #6545b4;
  color: white;
  border: 0;
  border-radius: 9px;
  padding: 11px 16px;
  font-weight: 650;
}

button.secondary {
  background: white;
  border: 1px solid #ddd8e9;
  color: #453d60;
  border-radius: 9px;
  padding: 10px 13px;
}

/* Destructive action (e.g. Delete) */
button.danger {
  color: #ae3333;
  border-color: #f0caca;
}

button.danger:hover {
  background: #ffe6e6;
}

/* Form fields ------------------------------------------------------------- */
input,
select,
textarea {
  font: inherit;
  width: 100%;
  border: 1px solid #dedbe6;
  border-radius: 8px;
  padding: 10px;
  background: white;
  color: #282238;
}

/* Same height for text, number, date and dropdown fields side by side */
input,
select {
  min-height: 42px;
}

/* Number fields: no spinner arrows — values are typed (see js/ui/inputs.js) */
input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #777184;
  margin-bottom: 5px;
}

.field {
  margin-bottom: 13px;
}

.formgrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.formactions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 18px;
}

/* Delete button sits on the left, Cancel/Save on the right */
.formactions .danger {
  margin-right: auto;
}

/* Cards & metrics --------------------------------------------------------- */
.card {
  background: white;
  border: 1px solid #e8e5ef;
  border-radius: 15px;
  padding: 19px;
  box-shadow: 0 2px 10px #27184908;
}

.metric {
  font-size: 28px;
  font-weight: 750;
  color: #3a2b68;
  margin-top: 8px;
}

/* Badges (status pills) --------------------------------------------------- */
.badge {
  display: inline-block;
  background: #ece8fa;
  color: #6046a4;
  border-radius: 50px;
  padding: 5px 9px;
  font-size: 11px;
  font-weight: 700;
}

.green {
  background: #e4f6eb;
  color: #238054;
}

.amber {
  background: #fff1d7;
  color: #9c6500;
}

.red {
  background: #ffe6e6;
  color: #ae3333;
}

/* Contractor avatar & name block ------------------------------------------ */
.avatar {
  width: 53px;
  height: 53px;
  background: #eae4fa;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 21px;
  color: #6444aa;
  font-weight: 800;
}

.person {
  display: flex;
  gap: 13px;
  align-items: center;
  margin-bottom: 14px;
}

.person h3 {
  margin: 0 0 4px;
  font-size: 16px;
}

.person p {
  margin: 0;
  font-size: 12px;
}

/* Paid-leave counter on contractor cards ---------------------------------- */
.leave-counter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 14px;
  padding: 10px 14px;
  background: #f6f3fd;
  border: 1px solid #ebe5f9;
  border-radius: 12px;
}

.leave-counter-value {
  font-size: 24px;
  font-weight: 750;
  line-height: 1.1;
  color: #3a2b68;
}

.leave-counter-label {
  font-size: 12px;
  color: #6f6888;
}

.leave-counter-meta {
  font-size: 12px;
  color: #827d90;
  text-align: right;
}

.leave-counter.negative .leave-counter-value {
  color: #ae3333;
}

/* Tables ------------------------------------------------------------------ */
.tablewrap {
  overflow: auto;
}

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 680px;
}

th,
td {
  padding: 13px 10px;
  text-align: left;
  border-bottom: 1px solid #efedf3;
  font-size: 13px;
}

th {
  color: #777184;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Label/value table inside a modal (e.g. contractor profile): fits the modal, no scrollbar */
.details-table {
  min-width: 0;
}

/* Toolbar (inline controls) ----------------------------------------------- */
.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.toolbar select {
  width: auto;
  min-width: 155px;
}

/* Modal dialog ------------------------------------------------------------ */
dialog {
  border: 0;
  border-radius: 16px;
  max-width: 620px;
  width: calc(100% - 25px);
  padding: 24px;
  box-shadow: 0 15px 65px #221c4455;
}

dialog::backdrop {
  background: #211a3977;
}

/* Confirmation / message dialog (js/ui/dialogs.js) ------------------------ */
dialog.confirm {
  max-width: 420px;
  padding: 0;
  text-align: center;
}

dialog.confirm[open] {
  animation: confirm-in 0.15s ease-out;
}

@keyframes confirm-in {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
}

.confirm-body {
  padding: 28px 28px 24px;
}

.confirm-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ece8fa;
  color: #6545b4;
}

.confirm.danger .confirm-icon {
  background: #ffe6e6;
  color: #ae3333;
}

.confirm.warning .confirm-icon {
  background: #fff1d7;
  color: #9c6500;
}

.confirm h2 {
  margin: 0 0 8px;
  font-size: 18px;
}

.confirm p {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: #51476c;
  white-space: pre-line;
}

.confirm-input {
  margin-top: 18px;
}

/* Validation message under an input in a dialog */
.confirm-error {
  margin-top: 8px;
  font-size: 13px;
  color: #ae3333;
  text-align: left;
}

/* Short highlight when a field was filled in automatically */
.autofilled {
  animation: autofilled 1.2s ease-out;
}

@keyframes autofilled {
  from {
    background: #e4f6eb;
    border-color: #238054;
  }
}

/* "Manage roles / countries" list (js/ui/lists.js) ------------------------ */
.list-manager {
  list-style: none;
  margin: 18px 0 0;
  padding: 0;
  text-align: left;
  max-height: 280px;
  overflow: auto;
  border: 1px solid #e8e5ef;
  border-radius: 10px;
}

.list-manager li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 6px 6px 14px;
  border-bottom: 1px solid #efedf3;
  font-size: 14px;
}

.list-manager li:last-child {
  border-bottom: 0;
}

.list-item-name {
  flex: 1;
}

.list-item-usage {
  font-size: 12px;
  color: #827d90;
}

.list-empty {
  color: #8a8395;
  justify-content: center;
  padding: 16px !important;
}

/* Small icon-only delete button */
.icon-button {
  border: 0;
  background: transparent;
  color: #ae3333;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.icon-button:hover {
  background: #ffe6e6;
}

.icon-button svg {
  width: 16px;
  height: 16px;
}

.list-manager-add {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.list-manager-add input {
  flex: 1;
}

.list-manager-add button {
  min-height: 42px;
}

.confirm .formactions {
  justify-content: center;
  margin-top: 24px;
}

.confirm .formactions button {
  min-width: 120px;
}

/* Solid red button for confirming a delete */
button.destructive {
  background: #c53030;
  color: white;
  border: 0;
  border-radius: 9px;
  padding: 11px 16px;
  font-weight: 650;
}

button.destructive:hover {
  background: #a82727;
}

/* Notes & labels ---------------------------------------------------------- */
.note {
  border-left: 4px solid #a58acb;
  background: #f1eef9;
  padding: 13px 15px;
  border-radius: 8px;
  font-size: 13px;
  color: #51476c;
  margin: 16px 0;
}

.sectionlabel {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #9c94ae;
  font-weight: 750;
  margin: 0 0 7px;
}

/* Responsive -------------------------------------------------------------- */
@media (max-width: 580px) {
  .formgrid {
    grid-template-columns: 1fr;
  }
}
