/* ITZAIN Applications Portal - theme layer on top of Bootstrap 5 */
:root {
  --itz-navy: #0f2a47;
  --itz-navy-700: #163a60;
  --itz-cyan: #15b8c8;
  --itz-cyan-dark: #0f8f9c;
  --itz-bg: #f4f6f9;
  --itz-surface: #ffffff;
  --itz-line: #e2e7ee;
  --itz-ink: #16202c;
  --itz-muted: #5f6c7b;
  --itz-success: #1e8f63;
  --itz-amber: #b57d10;
  --itz-danger: #c0413a;
  --itz-radius: 14px;
}

body {
  background: var(--itz-bg);
  color: var(--itz-ink);
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
}

h1, h2, h3, h4 { font-weight: 600; letter-spacing: -0.01em; color: var(--itz-navy); }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
a { color: var(--itz-navy-700); }
a:hover { color: var(--itz-cyan-dark); }

/* Navigation */
.itz-nav {
  background: var(--itz-navy);
  padding: .65rem 0;
}
.itz-nav .navbar-brand {
  color: #fff;
  font-weight: 600;
  letter-spacing: .02em;
}
.itz-nav .navbar-brand span { color: var(--itz-cyan); }
.itz-nav .nav-link { color: rgba(255,255,255,.78); padding: .35rem .85rem; border-radius: 8px; }
.itz-nav .nav-link:hover, .itz-nav .nav-link.active { color: #fff; background: rgba(255,255,255,.1); }
.itz-nav .itz-user { color: rgba(255,255,255,.72); font-size: .88rem; }

/* Surfaces */
.itz-card {
  background: var(--itz-surface);
  border: 1px solid var(--itz-line);
  border-radius: var(--itz-radius);
  padding: 1.25rem 1.35rem;
}
.itz-card + .itz-card { margin-top: 1rem; }
.itz-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.itz-label { color: var(--itz-muted); font-size: .8rem; margin-bottom: .1rem; }
.itz-value { font-weight: 500; }
.itz-muted { color: var(--itz-muted); }
.itz-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .86rem; }

.itz-add-card {
  border: 1px dashed var(--itz-line);
  background: transparent;
  border-radius: var(--itz-radius);
  padding: 1.25rem;
  display: flex; align-items: center; justify-content: center;
  color: var(--itz-muted);
  text-decoration: none;
  min-height: 100%;
}
.itz-add-card:hover { border-color: var(--itz-cyan); color: var(--itz-cyan-dark); }

/* Badges */
.itz-badge {
  display: inline-block;
  border-radius: 999px;
  padding: .2rem .65rem;
  font-size: .76rem;
  font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge-success { background: rgba(30,143,99,.12); color: var(--itz-success); border-color: rgba(30,143,99,.25); }
.badge-pending { background: rgba(181,125,16,.12); color: var(--itz-amber); border-color: rgba(181,125,16,.28); }
.badge-danger  { background: rgba(192,65,58,.1);  color: var(--itz-danger);  border-color: rgba(192,65,58,.25); }
.badge-info    { background: rgba(21,184,200,.12); color: var(--itz-cyan-dark); border-color: rgba(21,184,200,.3); }
.badge-muted   { background: #eef1f5; color: var(--itz-muted); border-color: var(--itz-line); }

.itz-platform { font-size: .78rem; color: var(--itz-muted); border: 1px solid var(--itz-line);
  border-radius: 6px; padding: .1rem .5rem; margin-right: .35rem; }

/* Buttons */
.btn-itz {
  background: var(--itz-navy);
  border-color: var(--itz-navy);
  color: #fff;
  border-radius: 9px;
  font-weight: 500;
}
.btn-itz:hover { background: var(--itz-navy-700); border-color: var(--itz-navy-700); color: #fff; }
.btn-itz-outline {
  background: transparent; color: var(--itz-navy); border: 1px solid var(--itz-line);
  border-radius: 9px; font-weight: 500;
}
.btn-itz-outline:hover { border-color: var(--itz-navy); color: var(--itz-navy); }
.btn-itz-success { background: var(--itz-success); border-color: var(--itz-success); color: #fff; border-radius: 9px; }
.btn-itz-success:hover { filter: brightness(.94); color: #fff; }
.btn-itz-danger { background: transparent; color: var(--itz-danger); border: 1px solid rgba(192,65,58,.4); border-radius: 9px; }
.btn-itz-danger:hover { background: var(--itz-danger); color: #fff; }

/* Tables */
.itz-table { background: var(--itz-surface); border: 1px solid var(--itz-line); border-radius: var(--itz-radius); overflow: hidden; }
.itz-table table { margin: 0; }
.itz-table thead th {
  background: #fbfcfd; color: var(--itz-muted); font-weight: 600; font-size: .8rem;
  border-bottom: 1px solid var(--itz-line); white-space: nowrap;
}
.itz-table td { vertical-align: middle; font-size: .9rem; border-color: var(--itz-line); }
.itz-table tbody tr:hover { background: #fafbfd; }

/* Wizard */
.itz-step { display: none; }
.itz-step.active { display: block; }
.itz-steps { display: flex; gap: .4rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.itz-steps .dot {
  flex: 1 1 0; height: 4px; border-radius: 4px; background: var(--itz-line); min-width: 40px;
}
.itz-steps .dot.done { background: var(--itz-cyan); }
.itz-choice {
  display: block; width: 100%; text-align: left;
  border: 1px solid var(--itz-line); background: var(--itz-surface);
  border-radius: 10px; padding: .75rem .9rem; margin-bottom: .55rem; cursor: pointer;
}
.itz-choice:hover { border-color: var(--itz-cyan); }
.itz-choice input { margin-right: .55rem; }
.itz-choice.selected { border-color: var(--itz-navy); box-shadow: inset 0 0 0 1px var(--itz-navy); }
.itz-choice .hint { display: block; color: var(--itz-muted); font-size: .84rem; margin-left: 1.45rem; }

/* Timeline */
.itz-timeline { list-style: none; padding-left: 0; margin: 0; }
.itz-timeline li { position: relative; padding-left: 1.4rem; padding-bottom: .9rem; border-left: 2px solid var(--itz-line); margin-left: .35rem; }
.itz-timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.itz-timeline li::before {
  content: ""; position: absolute; left: -6px; top: .35rem; width: 10px; height: 10px;
  border-radius: 50%; background: var(--itz-cyan);
}
.itz-log {
  background: #0f1720; color: #dbe4ee; border-radius: 10px; padding: .85rem 1rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .8rem;
  white-space: pre-wrap; word-break: break-word; max-height: 320px; overflow: auto;
}

.itz-page-head { margin: 1.75rem 0 1.15rem; }
.itz-footer { color: var(--itz-muted); font-size: .82rem; padding: 2rem 0 1.5rem; }

@media (max-width: 576px) {
  .itz-card { padding: 1rem; }
  h1 { font-size: 1.35rem; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
:focus-visible { outline: 2px solid var(--itz-cyan); outline-offset: 2px; }


/* Responsive build history and navigation */
.itz-value {
  overflow-wrap: anywhere;
}

.itz-history-error {
  max-width: 220px;
  overflow-wrap: anywhere;
}

@media (max-width: 991.98px) {
  .itz-history-filters {
    width: 100%;
  }

  .itz-history-filters .form-select {
    flex: 1 1 220px;
  }

  .itz-history-table {
    background: transparent;
    border: 0;
    border-radius: 0;
    overflow: visible;
  }

  .itz-history-table table,
  .itz-history-table tbody,
  .itz-history-table tr,
  .itz-history-table td {
    display: block;
    width: 100%;
  }

  .itz-history-table thead {
    display: none;
  }

  .itz-history-table tbody {
    display: grid;
    gap: .85rem;
  }

  .itz-history-table tbody tr {
    background: var(--itz-surface);
    border: 1px solid var(--itz-line);
    border-radius: var(--itz-radius);
    padding: .4rem 1rem;
    overflow: hidden;
  }

  .itz-history-table tbody tr:hover {
    background: var(--itz-surface);
  }

  .itz-history-table tbody td {
    display: grid;
    grid-template-columns: minmax(105px, 34%) minmax(0, 1fr);
    gap: .75rem;
    align-items: start;
    padding: .55rem 0;
    border-width: 0 0 1px;
    border-color: var(--itz-line);
    overflow-wrap: anywhere;
  }

  .itz-history-table tbody td:last-child {
    border-bottom: 0;
  }

  .itz-history-table tbody td::before {
    content: attr(data-label);
    color: var(--itz-muted);
    font-size: .78rem;
    font-weight: 600;
  }

  .itz-history-table .itz-history-error {
    max-width: none;
  }

  .itz-history-table td[colspan] {
    display: block;
    padding: 1.25rem 0;
    text-align: center;
  }

  .itz-history-table td[colspan]::before {
    content: none;
  }
}

@media (max-width: 767.98px) {
  .itz-nav .container {
    gap: .4rem !important;
  }

  .itz-nav .navbar-brand {
    margin-right: auto !important;
  }

  .itz-nav .nav {
    order: 3;
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .itz-nav .nav::-webkit-scrollbar {
    display: none;
  }

  .itz-nav .nav-link {
    padding: .35rem .65rem;
    white-space: nowrap;
  }

  .itz-page-head {
    margin-top: 1.25rem;
  }
}
