/* EQid: redesigned Create Asset and Edit Asset pages, plus matching add/edit forms. Layout and styling only —
   every field, validation and the Save logic come from the original Vue page.
   Active only while body has .eqd-asset-form / .eqd-form-page (set by /js/eqid-page-class.js). */

body.eqd-asset-form .content-body .card:has(form.p-2) {
  background: transparent; box-shadow: none; border: 0; margin-bottom: 0;
}
body.eqd-asset-form .content-body .card:has(form.p-2) > .card-body { padding: 0; }

/* Page title */
body.eqd-asset-form .content-body .card:has(form.p-2) > .card-body > h3 {
  margin: 4px 0 18px !important; font-size: 24px; line-height: 30px; font-weight: 600; color: rgb(20, 34, 45);
}
body.eqd-asset-form .content-body .card:has(form.p-2) > .card-body > h3::after {
  content: "Fill in the details below. Fields marked * are required.";
  display: block; margin-top: 4px; font-size: 13px; font-weight: 400; color: rgb(92, 111, 126);
}

/* Two-column layout: details on the left, images/status/disposition/attachments on the right */
body.eqd-asset-form .card-body form.p-2 {
  padding: 0 !important;
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(300px, 1fr);
  column-gap: 20px;
  align-items: start;
}
body.eqd-asset-form form.p-2 > .row { margin: 0; }
body.eqd-asset-form form.p-2 > :nth-child(1) { grid-column: 2; grid-row: 1; }              /* Item Images */
body.eqd-asset-form form.p-2 > :nth-child(2) { grid-column: 1; grid-row: 1 / span 7; }     /* Item Details */
body.eqd-asset-form form.p-2 > :nth-child(3) { grid-column: 2; grid-row: 2; }              /* Item Status heading */
body.eqd-asset-form form.p-2 > :nth-child(4) { grid-column: 2; grid-row: 3; }              /* Item Status fields */
body.eqd-asset-form form.p-2 > :nth-child(5) { grid-column: 2; grid-row: 4; }              /* Disposition heading */
body.eqd-asset-form form.p-2 > :nth-child(6) { grid-column: 2; grid-row: 5; }              /* Disposition fields */
body.eqd-asset-form form.p-2 > :nth-child(7) { grid-column: 2; grid-row: 6; }              /* Item Attachments */
body.eqd-asset-form form.p-2 > :nth-child(8) { grid-column: 1 / -1; grid-row: 8; }         /* Save bar */

/* Section cards */
body.eqd-asset-form form.p-2 > .row,
body.eqd-asset-form form.p-2 > h4 {
  background: #fff; border: 1px solid #e3e8ee; box-shadow: 0 2px 10px rgba(20, 34, 45, .05);
}
body.eqd-asset-form form.p-2 > .row { border-radius: 14px; padding: 18px 8px 6px; margin-bottom: 16px; }
body.eqd-asset-form form.p-2 > h4 {
  margin: 0; border-bottom: 0; border-radius: 14px 14px 0 0; padding: 16px 22px 4px;
}
body.eqd-asset-form form.p-2 > h4 + .row { border-top: 0; border-radius: 0 0 14px 14px; padding-top: 8px; box-shadow: 0 6px 10px rgba(20, 34, 45, .05); }
/* the disposition card continues into the attachments row: keep it as its own card */
body.eqd-asset-form form.p-2 > :nth-child(7) { border-radius: 14px; }

body.eqd-asset-form form.p-2 > h4 { margin: 0 !important; box-shadow: none; }

/* Section headings */
body.eqd-asset-form form.p-2 h4 {
  display: flex; align-items: center; gap: 10px;
  font-size: 16px; line-height: 22px; font-weight: 600; color: rgb(20, 34, 45); margin-bottom: 12px;
}
body.eqd-asset-form form.p-2 h4::before {
  content: ""; flex: none; width: 30px; height: 30px; border-radius: 8px; background: #e3eef9 center / 16px no-repeat;
}
body.eqd-asset-form form.p-2 > :nth-child(1) h4::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231f5a96' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='18' height='18' rx='2'/%3E%3Ccircle cx='9' cy='9' r='2'/%3E%3Cpath d='m21 15-5-5L5 21'/%3E%3C/svg%3E"); }
body.eqd-asset-form form.p-2 > :nth-child(2) h4::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231f5a96' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 16V8l-9-5-9 5v8l9 5 9-5z'/%3E%3Cpath d='M3.3 7 12 12l8.7-5M12 22V12'/%3E%3C/svg%3E"); }
body.eqd-asset-form form.p-2 > :nth-child(3)::before { background-color: #e6f4e6; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%233f9a41' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z'/%3E%3Cpath d='m9 12 2 2 4-4'/%3E%3C/svg%3E"); }
body.eqd-asset-form form.p-2 > :nth-child(5)::before { background-color: #fdebd2; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b86e00' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6h18M8 6V4h8v2M19 6l-1 14H6L5 6'/%3E%3C/svg%3E"); }
body.eqd-asset-form form.p-2 > :nth-child(7) h4::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231f5a96' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m21.4 11.1-9.2 9.2a6 6 0 0 1-8.5-8.5l9.2-9.2a4 4 0 0 1 5.7 5.7l-9.2 9.2a2 2 0 0 1-2.8-2.8l8.5-8.5'/%3E%3C/svg%3E"); }

/* Right-column cards: one field per line */
body.eqd-asset-form form.p-2 > :nth-child(1) > [class*="col-"],
body.eqd-asset-form form.p-2 > :nth-child(4) > [class*="col-"],
body.eqd-asset-form form.p-2 > :nth-child(6) > [class*="col-"],
body.eqd-asset-form form.p-2 > :nth-child(7) > [class*="col-"] { flex: 0 0 100%; max-width: 100%; }
/* Details card: description and additional information use the full width */
body.eqd-asset-form form.p-2 > :nth-child(2) > [class*="col-"]:nth-last-child(-n+2) { flex: 0 0 100%; max-width: 100%; }

/* Labels and inputs */
body.eqd-asset-form form.p-2 label { font-size: 12px; font-weight: 500; color: rgb(92, 111, 126); margin-bottom: 4px; }
body.eqd-asset-form form.p-2 .form-control,
body.eqd-asset-form form.p-2 .vs__dropdown-toggle,
body.eqd-asset-form form.p-2 .flatpickr-input {
  min-height: 40px; border-radius: 8px; border-color: #cfd8e2; font-size: 14px; color: rgb(20, 34, 45);
}
body.eqd-asset-form form.p-2 textarea.form-control { min-height: 84px; }
body.eqd-asset-form form.p-2 .form-control:focus,
body.eqd-asset-form form.p-2 .vs--open .vs__dropdown-toggle {
  border-color: #3b7fd0; box-shadow: 0 0 0 3px rgba(59, 127, 208, .15);
}
body.eqd-asset-form form.p-2 .form-control::placeholder { color: #9aa8b6; }

/* File pickers become drop zones (the real file input still covers the whole box) */
body.eqd-asset-form form.p-2 .custom-file { height: 112px; }
body.eqd-asset-form form.p-2 .custom-file-input { height: 112px; cursor: pointer; }
body.eqd-asset-form form.p-2 .custom-file-label {
  height: 112px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  padding: 44px 12px 8px; border: 2px dashed #b9c7d6; border-radius: 12px; background: #f7f9fc center 14px / 24px no-repeat;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%233b7fd0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 16V4M7 9l5-5 5 5M4 20h16'/%3E%3C/svg%3E");
  color: rgb(92, 111, 126); font-size: 13px; text-align: center; white-space: normal; overflow: hidden;
}
body.eqd-asset-form form.p-2 .custom-file-label::after {
  position: static; height: auto; padding: 2px 12px; border: 0; border-radius: 6px; background: #3b7fd0; color: #fff;
  font-size: 12px; font-weight: 600; line-height: 22px;
}
body.eqd-asset-form form.p-2 .custom-file:hover .custom-file-label { border-color: #3b7fd0; background-color: #eef5fd; }

/* Warranty switch */
body.eqd-asset-form form.p-2 .custom-switch { padding-top: 6px; }

/* Sticky save bar */
body.eqd-asset-form form.p-2 > :nth-child(8) {
  float: none !important; margin: 4px 0 0 !important; position: sticky; bottom: 0; z-index: 5;
  display: flex; justify-content: flex-end; align-items: center; gap: 12px;
  padding: 12px 84px 12px 18px; background: rgba(255, 255, 255, .96); border: 1px solid #e3e8ee; border-radius: 14px;
  box-shadow: 0 -4px 16px rgba(20, 34, 45, .06);
}
body.eqd-asset-form form.p-2 > :nth-child(8)::before {
  content: "Save adds the asset to your register."; margin-right: auto; font-size: 13px; color: rgb(92, 111, 126);
}
body.eqd-asset-form form.p-2 > :nth-child(8) .btn-primary {
  min-height: 42px; min-width: 140px; border-radius: 8px; font-weight: 600; font-size: 15px;
  background: #1f5a96 !important; border-color: #1f5a96 !important;
}
body.eqd-asset-form form.p-2 > :nth-child(8) .btn-primary.disabled,
body.eqd-asset-form form.p-2 > :nth-child(8) .btn-primary:disabled { opacity: .5; }

/* Phones and narrow screens: one column, in the original order */
@media (max-width: 991px) {
  body.eqd-asset-form .card-body form.p-2 { display: block; }
  body.eqd-asset-form form.p-2 > :nth-child(8)::before { display: none; }
}

/* Dark mode */
body.dark-layout.eqd-asset-form form.p-2 > .row,
body.dark-layout.eqd-asset-form form.p-2 > h4,
body.dark-layout.eqd-asset-form form.p-2 > :nth-child(8) { background: #283046; border-color: #3b4253; }
body.dark-layout.eqd-asset-form .content-body .card:has(form.p-2) > .card-body > h3,
body.dark-layout.eqd-asset-form form.p-2 h4 { color: #d0d7e2; }
body.dark-layout.eqd-asset-form form.p-2 .custom-file-label { background-color: #2f3850; border-color: #4a5470; }

/* Edit Asset: different subtitle and save-bar text */
body.eqd-asset-edit .content-body .card:has(form.p-2) > .card-body > h3::after { content: "Update any field below, then click Save. Fields marked * are required."; }
body.eqd-asset-edit form.p-2 > :nth-child(8)::before { content: "Changes are saved when you click Save."; }
body.eqd-asset-form form.p-2 > :nth-child(8).row { margin: 4px 0 0 !important; }

/* Edit Asset: the other cards on the page (current images, attachments, asset history) */
body.eqd-asset-form .content-body .card:not(:has(form.p-2)),
body.eqd-form-page .content-body .card {
  border: 1px solid #e3e8ee; border-radius: 14px; box-shadow: 0 2px 10px rgba(20, 34, 45, .05);
}
body.eqd-asset-form .content-body .card:not(:has(form.p-2)) h3,
body.eqd-asset-form .content-body .card:not(:has(form.p-2)) h4,
body.eqd-asset-form .content-body .card:not(:has(form.p-2)) .card-title {
  font-size: 16px; line-height: 22px; font-weight: 600; color: rgb(20, 34, 45);
}
body.eqd-asset-form .content-body .card:not(:has(form.p-2)) img { border-radius: 10px; }

/* Other add/edit forms (categories, custom fields, locations, organizations, users, permission sets) */
body.eqd-form-page .content-body .card > .card-body { padding: 22px 24px; }
body.eqd-form-page .content-body .card h3,
body.eqd-form-page .content-body .card h4,
body.eqd-form-page .content-body .card .card-title {
  font-size: 20px; line-height: 26px; font-weight: 600; color: rgb(20, 34, 45); margin-bottom: 16px;
}
body.eqd-form-page .content-body label { font-size: 12px; font-weight: 500; color: rgb(92, 111, 126); margin-bottom: 4px; }
body.eqd-form-page .content-body .form-control,
body.eqd-form-page .content-body .vs__dropdown-toggle {
  min-height: 40px; border-radius: 8px; border-color: #cfd8e2; font-size: 14px; color: rgb(20, 34, 45);
}
body.eqd-form-page .content-body .form-control:focus,
body.eqd-form-page .content-body .vs--open .vs__dropdown-toggle { border-color: #3b7fd0; box-shadow: 0 0 0 3px rgba(59, 127, 208, .15); }
body.eqd-form-page .content-body .form-control::placeholder { color: #9aa8b6; }
body.eqd-form-page .content-body .btn { border-radius: 8px; font-weight: 600; min-height: 40px; }
body.eqd-form-page .content-body .btn-primary { background: #1f5a96 !important; border-color: #1f5a96 !important; min-width: 120px; }
body.eqd-form-page .content-body .btn-outline-primary,
body.eqd-form-page .content-body .btn-outline-secondary { border-color: #cfd8e2 !important; color: rgb(20, 34, 45) !important; background: #fff !important; }

/* Dark mode for the shared cards */
body.dark-layout.eqd-asset-form .content-body .card:not(:has(form.p-2)),
body.dark-layout.eqd-form-page .content-body .card { border-color: #3b4253; }
body.dark-layout.eqd-asset-form .content-body .card:not(:has(form.p-2)) h3,
body.dark-layout.eqd-form-page .content-body .card h3,
body.dark-layout.eqd-form-page .content-body .card h4 { color: #d0d7e2; }
body.dark-layout.eqd-form-page .content-body .btn-outline-primary,
body.dark-layout.eqd-form-page .content-body .btn-outline-secondary { background: transparent !important; color: #d0d7e2 !important; border-color: #4a5470 !important; }
