/*
 * JDC Portal breakpoint convention
 * --------------------------------
 *   <=400px  very narrow phones (iPhone SE 1st gen, 320 width too)
 *   <=600px  phones — tables collapse to card-view here
 *   <=768px  tablets portrait — sidenav collapses to horizontal strip
 *   >=980px  desktop — login split-screen kicks in, brand panel visible
 *   >=1200px large desktop — dashboard content gets extra padding
 *
 * Prefer reusing these thresholds when adding new styles. Legacy rules
 * still use 700px and 900px; avoid introducing more.
 */

@font-face {
  font-family: "Axiforma";
  src: url("../fonts/axiforma/Axiforma-Regular.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Axiforma";
  src: url("../fonts/axiforma/Axiforma-Bold.otf") format("opentype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

.jdc-portal {
  --jdc-primary: #FECB00;
  --jdc-secondary: #1C3632;
  --jdc-accent: #85CDDB;

  --jdc-bg: #ffffff;
  --jdc-surface: #ffffff;
  --jdc-border: rgba(28, 54, 50, 0.14);
  --jdc-text: #0b0b0b;
  --jdc-muted: rgba(11, 11, 11, 0.70);

  --jdc-success: #1a7f37;
  --jdc-danger: #b42318;
  --jdc-warning: #b54708;

  --jdc-radius: 12px;
  --jdc-shadow: 0 10px 30px rgba(0,0,0,.06);

  --jdc-font-title: "Axiforma", Arial, sans-serif;
  --jdc-font-body: Arial, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  color: var(--jdc-text);
  font-family: var(--jdc-font-body);
}

.jdc-portal * { box-sizing: border-box; }
.jdc-portal a { color: var(--jdc-secondary); text-decoration: none; }
.jdc-portal a:hover { text-decoration: underline; }

.jdc-portal h1, .jdc-portal h2, .jdc-portal h3 {
  font-family: var(--jdc-font-title);
  color: var(--jdc-secondary);
  letter-spacing: -0.01em;
  margin: 0 0 12px;
}
.jdc-portal h1 { font-size: 26px; font-weight: 700; }
.jdc-portal h2 { font-size: 20px; font-weight: 700; }
.jdc-portal h3 { font-size: 16px; font-weight: 700; }

.jdc-portal p { margin: 0 0 12px; color: var(--jdc-muted); line-height: 1.5; }

.jdc-container { max-width: 1100px; margin: 0 auto; padding: 28px 18px; }
@media (min-width: 900px){ .jdc-container { padding: 40px 24px; } }

.jdc-card {
  background: var(--jdc-surface);
  border: 1px solid var(--jdc-border);
  border-radius: var(--jdc-radius);
  box-shadow: var(--jdc-shadow);
  padding: 18px;
}
@media (min-width: 900px){ .jdc-card { padding: 22px; } }

.jdc-row { display:flex; gap:12px; flex-wrap:wrap; align-items:center; }
.jdc-row-between { display:flex; gap:12px; justify-content:space-between; align-items:center; flex-wrap:wrap; }

.jdc-muted { color: var(--jdc-muted); }
.jdc-inactive { opacity: .55; }

.jdc-input, .jdc-select {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--jdc-border);
  border-radius: 10px;
  background: #fff;
  color: var(--jdc-text);
  outline: none;
}
.jdc-input:focus, .jdc-select:focus {
  border-color: rgba(28,54,50,.45);
  box-shadow: 0 0 0 4px rgba(133,205,219,.25);
}

.jdc-label { display:block; margin: 10px 0 6px; font-size: 14px; color: var(--jdc-secondary); font-weight: 600;
  font-family: var(--jdc-font-title); }

.jdc-btn {
  display:inline-flex;
  gap:10px;
  align-items:center;
  justify-content:center;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 600;
  font-family: var(--jdc-font-title);
  transition: transform .06s ease, opacity .12s ease, box-shadow .12s ease;
}
.jdc-btn:active { transform: translateY(1px); }
.jdc-btn[disabled] { opacity:.55; cursor:not-allowed; }

.jdc-btn-primary { background: var(--jdc-primary); color: #111; }
.jdc-btn-primary:hover { box-shadow: 0 10px 20px rgba(254,203,0,.18); text-decoration:none; }

.jdc-btn-secondary { background: var(--jdc-secondary); color: #fff; }
.jdc-btn-secondary:hover { box-shadow: 0 10px 20px rgba(28,54,50,.20); text-decoration:none; }

.jdc-btn-ghost { background: transparent; border-color: var(--jdc-border); color: var(--jdc-secondary); }
.jdc-btn-ghost:hover { background: rgba(28,54,50,.04); text-decoration:none; }

.jdc-alert {
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid var(--jdc-border);
  background: #fff;
}
.jdc-alert-success { border-color: rgba(26,127,55,.25); background: rgba(26,127,55,.06); color: #0a3b1c; }
.jdc-alert-error { border-color: rgba(180,35,24,.25); background: rgba(180,35,24,.06); color: #5a0b0b; }
.jdc-alert-warn { border-color: rgba(181,71,8,.25); background: rgba(181,71,8,.06); color: #5a2a00; }

.jdc-table { width:100%; border-collapse: collapse; }
.jdc-table th, .jdc-table td { padding: 10px 10px; border-bottom: 1px solid var(--jdc-border); text-align:left; font-size:14px; }
.jdc-table th { font-family: var(--jdc-font-title); color: var(--jdc-secondary); font-weight:700; }

.jdc-card-soft{
  border: 1px solid var(--jdc-border);
  border-radius: var(--jdc-radius);
  background: #fff;
  padding: 14px;
}

.jdc-table-wrap{ overflow:auto; margin-top: 14px; }

.jdc-btn-sm{
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
}

.jdc-actions-inline{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  align-items:center;
}

.jdc-badge{
  display:inline-flex;
  align-items:center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--jdc-border);
  font-size: 12px;
  font-weight: 700;
  font-family: var(--jdc-font-title);
  line-height: 1;
  color: var(--jdc-secondary);
  background: rgba(28,54,50,.03);
}

.jdc-badge-inactive{
  opacity: .6;
}
.jdc-badge-danger {
  background: rgba(180,35,24,.08);
  color: var(--jdc-danger);
  border-color: rgba(180,35,24,.25);
}
.jdc-log-alert td {
  background: rgba(180,35,24,.04) !important;
}

body.jdc-portal-page header,
body.jdc-portal-page footer:not(.jdc-portal-footer),
body.jdc-portal-page .wp-site-blocks > header,
body.jdc-portal-page .wp-site-blocks > footer {
  display: none !important;
}

/* Prevent page-level horizontal scroll caused by any child overflowing
   (tables use their own .jdc-table-wrap scroll container, so clipping
   here just stops stray elements from pushing the whole page sideways
   and reflowing the layout). */
body.jdc-portal-page,
html:has(body.jdc-portal-page) { overflow-x: clip; }

body.jdc-portal-page .wp-site-blocks { padding: 0 !important; }

body.page-id-7 .wp-block-post-title{
  display:none !important;
}

body.jdc-portal-page .is-layout-constrained > :where(:not(.alignleft):not(.alignright):not(.alignfull)){
  max-width: none !important;
  width: 100% !important;
}

body.jdc-portal-page .jdc-portal{
  width: 100% !important;
}

body.jdc-portal-page .wp-site-blocks,
body.jdc-portal-page .wp-site-blocks > *{
  max-width: none !important;
}

/* Floating toast notifications (top-right, auto-dismiss) */
#jdc-toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 10001;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  max-width: calc(100vw - 32px);
}
.jdc-toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 260px;
  max-width: 380px;
  padding: 12px 16px;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 10px 30px -8px rgba(0,0,0,.18), 0 4px 12px -4px rgba(0,0,0,.08);
  border-left: 4px solid #999;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  word-break: break-word;
  transform: translateX(20px);
  opacity: 0;
  transition: transform .25s cubic-bezier(.25,.46,.45,.94), opacity .25s ease;
}
.jdc-toast.is-visible {
  transform: translateX(0);
  opacity: 1;
}
.jdc-toast.is-leaving {
  transform: translateX(20px);
  opacity: 0;
}
.jdc-toast-success {
  border-left-color: #1a7f37;
  color: #1a5c2a;
}
.jdc-toast-error {
  border-left-color: #b42318;
  color: #922018;
}
@media (max-width: 600px) {
  #jdc-toast-container {
    top: auto;
    bottom: 16px;
    left: 16px;
    right: 16px;
    max-width: none;
  }
  .jdc-toast { min-width: 0; max-width: none; }
}

/* Modal-local message (inline error inside an open modal) */
.jdc-modal-msg { margin: 14px 0 0; }
.jdc-modal-msg:empty { margin: 0; }
.jdc-modal-msg-inner {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
}
.jdc-modal-msg-error {
  background: rgba(180,35,24,.07);
  color: #922018;
  border: 1px solid rgba(180,35,24,.18);
}
.jdc-modal-msg-success {
  background: rgba(26,127,55,.07);
  color: #1a5c2a;
  border: 1px solid rgba(26,127,55,.18);
}

/* Auth pages layout */
.jdc-auth-page {
  min-height: calc(100vh - 40px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 18px;
}
.jdc-auth-card {
  width: 100%;
  max-width: 480px;
  background: var(--jdc-surface);
  border: 1px solid var(--jdc-border);
  border-radius: var(--jdc-radius);
  box-shadow: var(--jdc-shadow);
  padding: 32px 28px;
}
.jdc-auth-card h2 {
  margin: 0 0 6px;
}
.jdc-auth-card p {
  margin: 0 0 20px;
}
.jdc-auth-links {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
  font-size: 14px;
}
.jdc-auth-links a {
  color: var(--jdc-secondary);
  opacity: .75;
}
.jdc-auth-links a:hover { opacity: 1; }

/* Equipment page */
.jdc-eq-layout {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.jdc-eq-main { min-width: 260px; flex: 1; }
.jdc-eq-qr-card {
  width: 240px;
  flex-shrink: 0;
  text-align: center;
}
.jdc-eq-qr-card img {
  width: 220px;
  height: 220px;
  display: block;
  margin: 0 auto 12px;
}
.jdc-eq-info-grid {
  display: grid;
  gap: 6px;
  font-size: 14px;
}
.jdc-eq-info-row { display: flex; gap: 8px; }
.jdc-eq-info-label { font-weight: 600; color: var(--jdc-secondary); min-width: 90px; }
.jdc-eq-info-value { color: var(--jdc-muted); }
.jdc-eq-docs-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.jdc-eq-docs-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--jdc-border);
  border-radius: 10px;
  font-size: 14px;
}
.jdc-eq-doc-type {
  font-weight: 700;
  font-size: 11px;
  font-family: var(--jdc-font-title);
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--jdc-secondary);
  background: rgba(28,54,50,.06);
  border: 1px solid var(--jdc-border);
  padding: 2px 8px;
  border-radius: 6px;
  white-space: nowrap;
}
.jdc-eq-doc-title { flex: 1; }
.jdc-eq-doc-version { font-size: 12px; color: var(--jdc-muted); }

/* Loading state */
.jdc-loading {
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--jdc-border);
  background: rgba(28,54,50,.03);
  font-size: 14px;
  color: var(--jdc-muted);
}

/* Hide WP theme header/footer on portal pages */
body.jdc-portal-page .wp-block-template-part[class*="header"],
body.jdc-portal-page header.wp-block-template-part,
body.jdc-portal-page .wp-block-site-title,
body.jdc-portal-page .wp-block-navigation,
body.jdc-portal-page .wp-block-site-logo,
body.jdc-portal-page footer.wp-block-template-part,
body.jdc-portal-page .wp-block-template-part[class*="footer"] {
  display: none !important;
}

body.jdc-portal-page .wp-site-blocks {
  padding: 0 !important;
}

body.jdc-portal-page .wp-site-blocks > .wp-block-template-part {
  display: none !important;
}

/* Remove WP global padding on portal pages */
body.jdc-portal-page .has-global-padding {
  padding-right: 0 !important;
  padding-left: 0 !important;
}

/* Icon buttons */
.jdc-btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  position: relative;
}
.jdc-btn-icon svg {
  flex-shrink: 0;
  display: block;
}
.jdc-btn-icon .jdc-btn-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Tooltip on hover */
.jdc-btn-icon[title] { position: relative; }
.jdc-btn-icon[title]::after {
  content: attr(title);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--jdc-secondary);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--jdc-font-title);
  padding: 4px 10px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s ease;
  z-index: 10000;
}
.jdc-btn-icon[title]:hover::after {
  opacity: 1;
}

/* Icon button small */
.jdc-btn-icon.jdc-btn-sm {
  padding: 7px 8px;
  min-width: 32px;
  min-height: 32px;
}

/* Button danger */
.jdc-btn-danger {
  background: var(--jdc-danger);
  color: #fff;
  border-color: var(--jdc-danger);
}
.jdc-btn-danger:hover {
  box-shadow: 0 10px 20px rgba(180,35,24,.18);
  text-decoration: none;
}

/* Modal backdrop (shared by confirm + edit modals) */
.jdc-modal-backdrop,
.jdc-edit-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.40);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 18px;
  backdrop-filter: blur(2px);
}
.jdc-modal-backdrop.is-open,
.jdc-edit-backdrop.is-open { display: flex; }
.jdc-modal-inner,
.jdc-edit-modal {
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 24px 64px rgba(0,0,0,.18);
  padding: 28px;
  width: 100%;
  max-width: 420px;
}
.jdc-modal-inner h3,
.jdc-edit-modal h3 { margin: 0 0 20px; font-size: 18px; }
.jdc-modal-actions,
.jdc-edit-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* Confirm modal */
.jdc-confirm-modal {
  text-align: center;
  max-width: 380px;
}
.jdc-confirm-icon {
  margin: 0 auto 12px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(28,54,50,.06);
  color: var(--jdc-secondary);
}
.jdc-confirm-modal .jdc-btn-danger ~ .jdc-confirm-icon,
.jdc-confirm-modal:has(.jdc-btn-danger) .jdc-confirm-icon {
  background: rgba(180,35,24,.08);
  color: var(--jdc-danger);
}
.jdc-confirm-msg {
  font-size: 14px;
  color: var(--jdc-muted);
  margin: 0 0 20px;
  line-height: 1.5;
}
.jdc-confirm-modal .jdc-modal-actions {
  justify-content: center;
  gap: 10px;
}
.jdc-confirm-modal .jdc-modal-actions .jdc-btn {
  min-width: 110px;
}
/* Confirm modal button labels */
.jdc-confirm-modal .jdc-btn-icon .jdc-btn-label {
  position: static;
  width: auto;
  height: auto;
  overflow: visible;
  clip: auto;
  white-space: nowrap;
}
.jdc-confirm-modal .jdc-btn-icon {
  gap: 6px;
}

/* Hamburger button */
.jdc-hamburger-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  color: var(--jdc-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .12s;
}
.jdc-hamburger-btn:hover {
  background: rgba(28,54,50,.06);
}

/* Side panel */
.jdc-sidepanel-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 9998;
  backdrop-filter: blur(2px);
}
.jdc-sidepanel-backdrop.is-open { display: block; }

.jdc-sidepanel {
  position: fixed;
  top: 0;
  right: 0;
  width: 360px;
  max-width: 90vw;
  height: 100vh;
  background: #fff;
  z-index: 9999;
  box-shadow: -8px 0 40px rgba(0,0,0,.12);
  transform: translateX(100%);
  transition: transform .25s ease;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.jdc-sidepanel.is-open { transform: translateX(0); }

.jdc-sidepanel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--jdc-border);
}
.jdc-sidepanel-header h3 {
  margin: 0;
  font-size: 16px;
}
.jdc-sidepanel-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  color: var(--jdc-secondary);
  display: flex;
  align-items: center;
  transition: background .12s;
}
.jdc-sidepanel-close:hover { background: rgba(28,54,50,.06); }

.jdc-sidepanel-body { flex: 1; padding: 16px 22px; }

/* Profile card */
.jdc-profile-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: #f4f6f4;
  border-radius: 14px;
  margin-bottom: 20px;
}
.jdc-profile-card .jdc-user-avatar {
  width: 48px;
  height: 48px;
  font-size: 16px;
}
.jdc-profile-card .jdc-profile-name {
  font-weight: 700;
  font-size: 15px;
  color: var(--jdc-secondary);
  font-family: var(--jdc-font-title);
}
.jdc-profile-card .jdc-profile-email {
  font-size: 12px;
  color: var(--jdc-muted);
  margin-top: 2px;
}
.jdc-profile-card .jdc-profile-company {
  font-size: 11px;
  color: var(--jdc-muted);
  margin-top: 2px;
}

/* Side panel nav */
.jdc-sidepanel-nav {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
}
.jdc-sidepanel-nav li {
  margin: 0;
}
.jdc-sidepanel-nav a,
.jdc-sidepanel-nav button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--jdc-font-title);
  color: var(--jdc-secondary);
  text-decoration: none;
  transition: background .12s;
  text-align: left;
}
.jdc-sidepanel-nav a:hover,
.jdc-sidepanel-nav button:hover {
  background: rgba(28,54,50,.04);
  text-decoration: none;
}
.jdc-sidepanel-nav svg {
  flex-shrink: 0;
  opacity: .6;
}
.jdc-sidepanel-nav .jdc-nav-badge {
  margin-left: auto;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--jdc-primary);
  color: #111;
  font-weight: 700;
}

.jdc-sidepanel-divider {
  height: 1px;
  background: var(--jdc-border);
  margin: 8px 0;
}

/* Language selector */
.jdc-lang-selector {
  display: flex;
  gap: 6px;
  padding: 8px 14px;
}
.jdc-lang-btn {
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid var(--jdc-border);
  background: #fff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--jdc-font-title);
  color: var(--jdc-muted);
  transition: all .12s;
}
.jdc-lang-btn:hover { border-color: rgba(28,54,50,.3); }
.jdc-lang-btn.is-active {
  background: var(--jdc-secondary);
  color: #fff;
  border-color: var(--jdc-secondary);
}

/* Responsive */
@media (max-width: 768px) {
  .jdc-container { padding: 20px 14px; }
  .jdc-modal-inner,
  .jdc-edit-modal { max-width: calc(100vw - 24px); padding: 20px; border-radius: 14px; }
  .jdc-confirm-modal { max-width: calc(100vw - 24px); }
  .jdc-sidepanel { width: calc(100vw - 40px); }
  .jdc-profile-card { padding: 12px; gap: 10px; }
  .jdc-profile-card .jdc-user-avatar { width: 40px; height: 40px; font-size: 14px; }
  .jdc-profile-card .jdc-profile-name { font-size: 14px; }
  .jdc-lang-selector { padding: 6px 10px; }
  .jdc-lang-btn { padding: 5px 10px; font-size: 12px; }
  .jdc-btn { padding: 9px 12px; font-size: 13px; }
  .jdc-btn-sm { padding: 6px 8px; font-size: 12px; }
  .jdc-input, .jdc-select { padding: 9px 10px; font-size: 14px; }
  .jdc-auth-page { padding: 16px 12px; }
  .jdc-auth-card { padding: 24px 18px; }
}

/* Very narrow phones: let modal action buttons wrap + stack full-width
   when they would otherwise crash into each other. */
@media (max-width: 420px) {
  .jdc-modal-inner,
  .jdc-edit-modal { padding: 18px; border-radius: 12px; }
  .jdc-modal-actions,
  .jdc-edit-actions,
  .jdc-confirm-modal .jdc-modal-actions {
    flex-wrap: wrap-reverse;
    gap: 8px;
  }
  .jdc-modal-actions > .jdc-btn,
  .jdc-edit-actions > .jdc-btn,
  .jdc-confirm-modal .jdc-modal-actions > .jdc-btn {
    flex: 1 1 140px;
    min-width: 0;
    justify-content: center;
  }
}

