/* styles/forms.css
   Leave/Issue form styles, form card layout, attach-preview, signature canvas
   Extracted from style.css (non-mobile rules). Mobile-only patches remain in style.css
   and will be moved later to styles/mobile.css as phase 2.
*/

/* Form elements */
.form label {
  display: block;
  margin: 10px 0
}

.form input,
.form select,
.form textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg)
}

/* Card form (requests card) */
.card.form {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 170px;
  text-align: center;
}

.card.form h3 {
  margin-bottom: 12px
}

.card.form .form-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  width: 100%;
  max-width: 100%;
  /* Full width on mobile */
}

.card.form .form-buttons .btn {
  width: 100%;
  min-width: 0;
  padding: 12px 18px;
  border-radius: 12px;
}

/* On larger screens, limit form buttons width for better aesthetics */
@media (min-width: 768px) {
  .card.form .form-buttons {
    max-width: 360px;
  }
}

@media (max-width: 420px) {
  .card.form {
    min-height: 143px
  }
}

/* ===== Form modal shared styles (non-mobile) ===== */
#leaveForm,
#issueForm {
  max-height: calc(72vh - 120px);
  overflow: auto;
  padding-bottom: 12px;
}

#leaveForm .row,
#issueForm .row {
  display: flex;
  gap: 10px;
  margin: 8px 0;
  align-items: center;
}

#leaveForm .row label,
#issueForm .row label {
  min-width: 140px;
  color: #555;
}

#leaveForm input[type="text"],
#leaveForm input[type="number"],
#leaveForm input[type="date"],
#leaveForm select,
#leaveForm textarea,
#leaveForm input[type="datetime-local"],
#issueForm input[type="text"],
#issueForm input[type="number"],
#issueForm input[type="date"],
#issueForm select,
#issueForm textarea,
#issueForm input[type="datetime-local"] {
  flex: 1;
  padding: 8px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

#leaveForm textarea,
#issueForm textarea {
  min-height: 120px;
  resize: vertical
}

#leaveForm .muted,
#issueForm .muted {
  font-size: .86rem;
  color: #6b7280
}

#leaveForm .sep,
#issueForm .sep {
  height: 8px;
  border-top: 1px solid #e5e7eb;
  margin: 8px 0
}

#leaveForm .actions,
#issueForm .actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 10px
}

#leaveForm .pill,
#issueForm .pill {
  background: #efe7df;
  color: #3a2f27;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: .8rem
}

#leaveForm .hint,
#issueForm .hint {
  font-size: .78rem;
  color: #6b7280;
  margin-top: 2px
}

#leaveForm .err,
#issueForm .err {
  color: #b91c1c;
  font-size: .86rem;
  margin: 6px 0 0
}

#leaveForm .inline,
#issueForm .inline {
  display: flex;
  align-items: center;
  gap: 10px
}

/* Issue form container layout */
#issueForm {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 320px
}

/* Buttons / states used in forms */
.spinner-small {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 3px solid rgba(181, 139, 99, 0.12);
  border-top-color: #b58b63;
  animation: spin .9s linear infinite;
  display: inline-block;
  vertical-align: middle;
  margin-right: 8px
}

.btn[disabled],
.primary[disabled],
button[disabled] {
  opacity: 0.6;
  cursor: default;
  transform: none
}

/* Attachment preview spacing and helpers (non-mobile) */
#leaveForm .attach-preview:not(:empty),
#issueForm .attach-preview:not(:empty) {
  margin: 8px 0 10px;
}

#leaveForm .row .btn+.attach-preview:not(:empty),
#issueForm .row .btn+.attach-preview:not(:empty) {
  margin-top: 10px;
}

#leaveForm #lf-attach-preview:not(:empty)+.d-flex,
#issueForm .attach-preview:not(:empty)+.d-flex {
  margin-top: 10px;
}

/* Attachment thumbnails */
.attach-preview {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.attach-preview .thumb {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(107, 74, 51, .08);
  background: #fff;
}

.attach-preview .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.attach-preview .thumb .thumb-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, .55);
  color: #fff;
  font-size: 14px;
  line-height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform .12s ease, background .12s ease;
}

.attach-preview .thumb .thumb-remove:hover {
  transform: scale(1.06);
  background: rgba(0, 0, 0, .7);
}

.attach-preview .thumb .thumb-remove:active {
  transform: scale(.98);
}

/* Tighten alignment: Half-day row */
#leaveForm .row:has(#lf-half),
#issueForm .row:has(#lf-half) {
  gap: 4px !important;
  align-items: center !important;
}

#leaveForm .row:has(#lf-half) label:first-of-type {
  margin-right: 4px !important;
}

#leaveForm #lf-half {
  margin-right: 6px !important;
  transform: translateY(1px);
}

#leaveForm .radio-row label,
#leaveForm .radio-row span {
  margin-left: 0 !important;
}

@media (max-width: 540px) {

  #leaveForm .row:has(#lf-half),
  #issueForm .row:has(#lf-half) {
    flex-wrap: wrap;
    gap: 6px !important;
  }
}

/* Signature visual box */
.signature-canvas {
  width: 100%;
  height: 160px;
  display: block;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fff;
}