/* =========================================================
   ALFAA ERP - STOCK PRODUCT ACTIONS UI
   File: assets/css/stock-product-actions.css
   Scope: Stock product actions and pages only
   ========================================================= */

/* =========================================================
   FLOATING ROW ACTION MENU
   ========================================================= */
.stock-product-action-menu {
  position: fixed;
  z-index: 15000;
  width: 214px;
  display: none;
  gap: 3px;
  padding: 8px;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 22px 52px rgba(15, 23, 42, .18);
}

.stock-product-action-menu.open { display: grid; }

.stock-action-title {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 11px 9px;
  color: #64748b;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.stock-product-action-menu button {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  height: 39px;
  border: 0;
  border-radius: 9px;
  padding: 0 11px;
  background: transparent;
  color: #0f172a;
  font-size: 13px;
  font-weight: 650;
  text-align: left;
  cursor: pointer;
}

.stock-product-action-menu button i {
  width: 17px;
  color: #64748b;
  text-align: center;
}

.stock-product-action-menu button:hover {
  background: #f1f5f9;
}

.stock-product-action-menu button.danger,
.stock-product-action-menu button.danger i {
  color: #dc2626;
}

.stock-product-action-menu button.danger:hover {
  background: #fef2f2;
}

.stock-action-divider {
  height: 1px;
  margin: 5px 4px;
  background: #e2e8f0;
}

/* =========================================================
   DELETE CONFIRMATION
   ========================================================= */
.stock-confirm-backdrop {
  position: fixed;
  inset: 0;
  z-index: 16000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, .56);
  backdrop-filter: blur(3px);
}

.stock-confirm-backdrop.open { display: flex; }

.stock-confirm-card {
  position: relative;
  width: min(445px, 100%);
  padding: 29px 28px 25px;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 32px 72px rgba(15, 23, 42, .25);
  text-align: center;
}

.stock-confirm-x {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 35px;
  height: 35px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  color: #64748b;
  cursor: pointer;
}

.stock-confirm-icon {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  margin: 0 auto 17px;
  border-radius: 50%;
  color: #dc2626;
  background: #fef2f2;
  font-size: 23px;
}

.stock-confirm-card h3 {
  margin: 0 0 9px;
  color: #0f172a;
  font-size: 20px;
  font-weight: 750;
}

.stock-confirm-card p {
  margin: 0 auto 24px;
  color: #64748b;
  font-size: 13px;
  line-height: 1.6;
}

.stock-confirm-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.stock-cancel-btn,
.stock-delete-btn {
  height: 43px;
  padding: 0 19px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.stock-cancel-btn {
  border: 1px solid #dbe3ef;
  background: #fff;
  color: #0f172a;
}

.stock-delete-btn {
  border: 1px solid #dc2626;
  background: #dc2626;
  color: #fff;
}

/* =========================================================
   PRODUCT ACTION PAGE STRUCTURE
   ========================================================= */
.stock-product-action-page {
  padding: 0 !important;
  min-width: 0;
}

.stock-product-action-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 17px;
}

.stock-product-back {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 12px;
  border: 0;
  padding: 0;
  color: #64748b;
  background: transparent;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}

.stock-product-back:hover { color: #059669; }

.stock-product-action-header h1 {
  margin: 0;
  color: #0f172a;
  font-size: clamp(25px, 1.9vw, 29px);
  line-height: 1.15;
  letter-spacing: -.035em;
  font-weight: 800;
}

.stock-product-action-header p {
  margin: 5px 0 0;
  color: #64748b;
  font-size: 13px;
  font-weight: 500;
}

.stock-product-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.stock-primary-action,
.stock-secondary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 43px;
  padding: 0 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.stock-primary-action {
  color: #fff;
  border: 1px solid #059669;
  background: #059669;
  box-shadow: 0 8px 18px rgba(5, 150, 105, .18);
}

.stock-secondary-action {
  color: #0f172a;
  border: 1px solid #dbe3ef;
  background: #fff;
}

.stock-primary-action:hover { background: #047857; }
.stock-secondary-action:hover { background: #f8fafc; }

.stock-product-panel,
.stock-product-hero {
  border: 1px solid #e2e8f0;
  border-radius: 13px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(15,23,42,.045);
}

.stock-product-hero {
  padding: 16px 18px;
  margin-bottom: 13px;
}

.stock-product-identity {
  display: flex;
  align-items: center;
  gap: 13px;
  padding-bottom: 15px;
  border-bottom: 1px solid #eef2f7;
}

.stock-product-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 13px;
  color: #2563eb;
  background: #eff6ff;
}

.stock-product-identity h2 {
  margin: 0 0 4px;
  color: #0f172a;
  font-size: 18px;
  font-weight: 750;
}

.stock-product-identity p {
  margin: 0;
  color: #64748b;
  font-size: 12px;
  font-weight: 550;
}

.stock-product-status {
  margin-left: auto;
  padding: 6px 11px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 750;
}

.stock-product-status.green { color: #047857; background: #dcfce7; }
.stock-product-status.orange { color: #b45309; background: #fef3c7; }
.stock-product-status.red { color: #dc2626; background: #fee2e2; }
.stock-product-status.muted { color: #64748b; background: #f1f5f9; }

.stock-product-information {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 15px;
  padding-top: 14px;
}

.stock-product-information span {
  display: block;
  margin-bottom: 5px;
  color: #64748b;
  font-size: 11px;
  font-weight: 650;
}

.stock-product-information strong {
  color: #0f172a;
  font-size: 13px;
  font-weight: 700;
}

.stock-product-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(145px, 1fr));
  gap: 12px;
  margin-bottom: 13px;
}

.stock-product-kpi {
  min-height: 122px;
  padding: 14px 15px;
  border: 1px solid #e2e8f0;
  border-radius: 13px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(15,23,42,.045);
}

.stock-product-kpi-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  margin-bottom: 9px;
  border-radius: 11px;
}

.stock-product-kpi.green .stock-product-kpi-icon { color: #059669; background: #dcfce7; }
.stock-product-kpi.blue .stock-product-kpi-icon { color: #2563eb; background: #dbeafe; }
.stock-product-kpi.purple .stock-product-kpi-icon { color: #7c3aed; background: #ede9fe; }
.stock-product-kpi.orange .stock-product-kpi-icon { color: #ea580c; background: #ffedd5; }

.stock-product-kpi span {
  display: block;
  color: #475569;
  font-size: 11.5px;
  font-weight: 650;
}

.stock-product-kpi strong {
  display: block;
  margin: 7px 0 5px;
  color: #0f172a;
  font-size: clamp(18px, 1.35vw, 21px);
  font-weight: 800;
  white-space: nowrap;
}

.stock-product-kpi p {
  margin: 0;
  color: #64748b;
  font-size: 11px;
  font-weight: 550;
}

.stock-product-panel {
  padding: 15px 16px;
}

.stock-product-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 13px;
}

.stock-product-panel-head h2 {
  margin: 0;
  color: #0f172a;
  font-size: 15px;
  font-weight: 750;
}

.stock-product-panel-head p {
  margin: 4px 0 0;
  color: #64748b;
  font-size: 12px;
}

.stock-record-count {
  padding: 6px 10px;
  border-radius: 999px;
  color: #047857;
  background: #dcfce7;
  font-size: 11px;
  font-weight: 700;
}

.stock-product-movement-wrap {
  overflow-x: auto;
  border: 1px solid #eef2f7;
  border-radius: 10px;
}

.stock-product-movement-table {
  width: 100%;
  min-width: 750px;
  border-collapse: collapse;
  font-size: 12px;
}

.stock-product-movement-table th {
  padding: 11px 12px;
  color: #64748b;
  background: #f8fafc;
  font-size: 10.5px;
  font-weight: 750;
  letter-spacing: .04em;
  text-transform: uppercase;
  text-align: left;
}

.stock-product-movement-table td {
  padding: 11px 12px;
  border-top: 1px solid #eef2f7;
  color: #0f172a;
  font-weight: 550;
}

.stock-product-movement-table .text-right { text-align: right; }

.stock-movement-tag {
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
}

.stock-movement-tag.in { color: #047857; background: #dcfce7; }
.stock-movement-tag.out { color: #dc2626; background: #fee2e2; }

.stock-in-value { color: #059669 !important; font-weight: 700 !important; }
.stock-out-value { color: #dc2626 !important; font-weight: 700 !important; }

.stock-reference-link {
  border: 0;
  padding: 0;
  color: #2563eb;
  background: transparent;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.stock-reference-link:hover { text-decoration: underline; }

.stock-product-no-data {
  padding: 28px !important;
  color: #64748b !important;
  text-align: center;
}

/* =========================================================
   EDIT AND ADJUST FORMS
   ========================================================= */
.stock-edit-layout {
  display: grid;
  gap: 13px;
}

.stock-action-form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 13px;
}

.stock-action-field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.stock-action-field.span-2 { grid-column: span 2; }
.stock-action-field.span-full { grid-column: 1 / -1; }

.stock-action-field span {
  color: #475569;
  font-size: 11px;
  font-weight: 700;
}

.stock-action-field input,
.stock-action-field select,
.stock-action-field textarea {
  width: 100%;
  border: 1px solid #dbe3ef;
  border-radius: 9px;
  color: #0f172a;
  background: #fff;
  font: 500 13px/1.4 Inter, Arial, sans-serif;
  outline: none;
}

.stock-action-field input,
.stock-action-field select {
  height: 42px;
  padding: 0 12px;
}

.stock-action-field textarea {
  min-height: 100px;
  padding: 11px 12px;
  resize: vertical;
}

.stock-action-field input:focus,
.stock-action-field select:focus,
.stock-action-field textarea:focus {
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16,185,129,.12);
}

.stock-action-field input[readonly] {
  color: #64748b;
  background: #f8fafc;
}

.stock-form-safe-note,
.stock-adjust-audit-note {
  display: flex;
  gap: 9px;
  margin-top: 15px;
  padding: 12px 13px;
  border-radius: 10px;
  color: #1d4ed8;
  background: #eff6ff;
  font-size: 12px;
  line-height: 1.5;
}

.stock-adjust-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 13px;
  align-items: start;
}

.stock-adjust-summary {
  position: sticky;
  top: 90px;
}

.stock-adjust-summary h2 {
  margin: 0 0 12px;
  color: #0f172a;
  font-size: 15px;
}

.stock-adjust-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid #eef2f7;
  color: #64748b;
  font-size: 12px;
  font-weight: 600;
}

.stock-adjust-row strong {
  color: #0f172a;
  font-size: 13px;
  font-weight: 750;
}

.stock-adjust-row.total {
  margin: 4px -4px 0;
  padding: 13px 4px;
  color: #0f172a;
  font-weight: 700;
}

.stock-adjust-row.total strong { font-size: 18px; color: #059669; }
.stock-adjust-row .positive, .stock-adjust-row strong.positive { color: #059669; }
.stock-adjust-row .negative, .stock-adjust-row strong.negative { color: #dc2626; }

.stock-adjust-warning {
  display: flex;
  gap: 9px;
  margin-top: 15px;
  padding: 12px;
  border-radius: 10px;
  color: #b45309;
  background: #fffbeb;
  font-size: 11.5px;
  line-height: 1.5;
}

.stock-action-loading,
.stock-action-empty {
  min-height: 270px;
  display: grid;
  place-items: center;
  gap: 10px;
  padding: 34px;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #fff;
  color: #64748b;
  text-align: center;
}

.stock-action-empty i {
  color: #10b981;
  font-size: 32px;
}

.stock-action-empty h2 { margin: 0; color: #0f172a; font-size: 20px; }
.stock-action-empty p { margin: 0 0 10px; font-size: 13px; }

@media (max-width: 1080px) {
  .stock-product-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stock-adjust-grid { grid-template-columns: 1fr; }
  .stock-adjust-summary { position: static; }
}

@media (max-width: 780px) {
  .stock-product-action-header { flex-direction: column; align-items: flex-start; }
  .stock-product-information,
  .stock-action-form-grid { grid-template-columns: 1fr; }
  .stock-action-field.span-2 { grid-column: auto; }
  .stock-product-kpis { grid-template-columns: 1fr; }
  .stock-product-header-actions { width: 100%; flex-wrap: wrap; }
}


/* =========================================================
   PRODUCT INVENTORY - CLICKABLE PRODUCT NAME
   Directly opens the View Details page for improved navigation.
   ========================================================= */
.stock-page .stock-product-name-link {
  display: block;
  max-width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #0f172a;
  font: inherit;
  font-weight: 700;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  transition: color .18s ease;
}

.stock-page .stock-product-name-link:hover {
  color: #059669;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.stock-page .stock-product-name-link:focus-visible {
  color: #059669;
  outline: 2px solid rgba(16, 185, 129, .32);
  outline-offset: 3px;
  border-radius: 3px;
}
