/* po-generator.css — Purchase Order Modal Styles */

/* ---- OVERLAY ---- */
#po-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 20, 0.85);
  backdrop-filter: blur(6px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

/* ---- MODAL ---- */
.po-modal {
  background: #12172a;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 16px;
  width: 100%;
  max-width: 1100px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 80px rgba(0,0,0,.6);
  overflow: hidden;
}

.po-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: #1a2038;
  border-bottom: 1px solid rgba(255,255,255,.07);
  font-size: 15px;
  font-weight: 700;
  color: #e4e8f0;
  flex-shrink: 0;
}

.po-close-btn {
  background: none;
  border: none;
  color: #8b92a8;
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all .15s;
}
.po-close-btn:hover { background: rgba(255,255,255,.06); color: #e4e8f0; }

.po-modal-body {
  overflow-y: auto;
  flex: 1;
  padding: 24px;
}

/* ---- LOADING ---- */
.po-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #8b92a8;
  font-size: 14px;
  padding: 40px;
  justify-content: center;
}

.po-spinner {
  width: 24px; height: 24px;
  border: 2px solid rgba(0,212,255,.2);
  border-top-color: #00d4ff;
  border-radius: 50%;
  animation: po-spin .7s linear infinite;
}
@keyframes po-spin { to { transform: rotate(360deg); } }

/* ---- LAYOUT ---- */
.po-form-grid {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 24px;
}

.po-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #00d4ff;
  margin-bottom: 16px;
}

/* ---- FORM ---- */
.po-form-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.po-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.po-field label {
  font-size: 11px;
  font-weight: 600;
  color: #8b92a8;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.po-field input,
.po-field select,
.po-field textarea {
  background: #0a0e1a;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 8px;
  color: #e4e8f0;
  font-size: 13px;
  font-family: inherit;
  padding: 8px 12px;
  outline: none;
  transition: border-color .15s;
  resize: vertical;
}

.po-field input:focus,
.po-field select:focus,
.po-field textarea:focus {
  border-color: rgba(0,212,255,.4);
}

/* ---- TOTALS ---- */
.po-totals {
  background: #0a0e1a;
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.po-total-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: #8b92a8;
}

.po-total-final {
  font-size: 15px;
  font-weight: 700;
  color: #00ff88;
  padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,.06);
  margin-top: 4px;
}

/* ---- ACTIONS ---- */
.po-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.po-btn-primary {
  flex: 1;
  padding: 10px 16px;
  background: #00d4ff;
  color: #000;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s;
}
.po-btn-primary:hover { background: #33ddff; transform: translateY(-1px); }

.po-btn-secondary {
  padding: 10px 16px;
  background: transparent;
  color: #8b92a8;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.po-btn-secondary:hover { background: rgba(255,255,255,.04); color: #e4e8f0; }

/* ---- PREVIEW ---- */
.po-preview-section {
  min-width: 0;
}

.po-preview {
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  max-height: 75vh;
  overflow-y: auto;
  box-shadow: 0 4px 24px rgba(0,0,0,.3);
}

/* ---- PO DOCUMENT (preview inside modal) ---- */
.po-doc {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 11px;
  color: #1a1a2e;
  padding: 28px;
}

.po-doc-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid #1a1a2e;
}

.po-logo { max-height: 50px; max-width: 140px; object-fit: contain; }
.po-logo-placeholder {
  width: 100px; height: 40px;
  background: #f0f0f0;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; color: #aaa;
  border: 1px dashed #ccc;
  border-radius: 3px;
}

.po-doc-title-block { text-align: right; }
.po-doc-title {
  font-size: 18px; font-weight: 800;
  letter-spacing: 2px; color: #1a1a2e;
}
.po-doc-meta { font-size: 10px; color: #555; margin-top: 3px; }
.po-doc-meta strong { color: #1a1a2e; }

.po-doc-parties {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.po-party {
  padding: 12px;
  background: #f8f9fc;
  border-left: 3px solid #1a1a2e;
}

.po-party-label {
  font-size: 8px; font-weight: 800;
  letter-spacing: 2px; text-transform: uppercase;
  color: #888; margin-bottom: 6px;
}

.po-party-name {
  font-size: 12px; font-weight: 700;
  color: #1a1a2e; margin-bottom: 4px;
}

.po-party-detail { font-size: 9px; color: #555; line-height: 1.6; }
.po-bank {
  color: #1a1a2e; font-weight: 500;
  margin-top: 5px; padding-top: 5px;
  border-top: 1px solid #e0e0e0;
}

.po-doc-table {
  width: 100%; border-collapse: collapse;
  margin-bottom: 16px;
}
.po-doc-table thead th {
  background: #1a1a2e; color: #fff;
  padding: 8px 12px;
  font-size: 9px; letter-spacing: 1px;
  text-transform: uppercase;
}
.po-doc-table tbody td {
  padding: 8px 12px;
  border-bottom: 1px solid #eee;
  font-size: 10px;
}
.po-total-tr td {
  font-weight: 700;
  background: #f8f9fc;
  font-size: 11px;
  border-top: 2px solid #1a1a2e;
}

.po-doc-description {
  padding: 12px;
  background: #f8f9fc;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  font-size: 9px; line-height: 1.7; color: #444;
  margin-bottom: 12px;
}

.po-doc-terms {
  font-size: 9px; color: #555;
  margin-bottom: 20px;
}

.po-doc-signature { margin-top: 20px; padding-top: 16px; border-top: 1px solid #e0e0e0; }
.po-sig-label {
  font-size: 8px; font-weight: 700;
  letter-spacing: 1px; text-transform: uppercase;
  color: #888; margin-bottom: 10px;
}
.po-sig-line {
  font-size: 10px; color: #333;
  margin-bottom: 12px;
  border-bottom: 1px solid #ccc;
  padding-bottom: 2px;
  width: 240px;
}

/* ---- PO BUTTON in forecast table ---- */
.po-generate-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: rgba(0,212,255,.1);
  border: 1px solid rgba(0,212,255,.25);
  border-radius: 6px;
  color: #00d4ff;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.po-generate-btn:hover {
  background: rgba(0,212,255,.2);
  transform: translateY(-1px);
}

/* ---- NEW PO BUTTON (topbar/panel) ---- */
.po-new-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: rgba(0,255,136,.1);
  border: 1px solid rgba(0,255,136,.25);
  border-radius: 8px;
  color: #00ff88;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s;
}
.po-new-btn:hover {
  background: rgba(0,255,136,.18);
  transform: translateY(-1px);
}

@media (max-width: 900px) {
  .po-form-grid { grid-template-columns: 1fr; }
  .po-preview-section { display: none; }
}

/* Signature image in preview */
.po-sig-img {
  max-height: 60px;
  max-width: 200px;
  display: block;
  margin-bottom: 6px;
  object-fit: contain;
}
.po-sig-name {
  font-size: 12px;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 2px;
}
.po-sig-title {
  font-size: 10px;
  color: #555;
  margin-bottom: 4px;
}
.po-sig-date {
  font-size: 10px;
  color: #555;
}
