/* WhatsApp Flows — journey & blast manager
   All styles scoped under .wa-flows to avoid clashing with AdminLTE/Bootstrap. */

.wa-flows {
  --wa-teal: #008069;
  --wa-teal-dark: #075e54;
  --wa-green: #25d366;
  --wa-bubble: #d9fdd3;
  --wa-bubble-ink: #1f7a3f;
  --wa-bg: #efeae2;
  --wa-panel: #ffffff;
  --wa-ink: #111b21;
  --wa-muted: #667781;
  --wa-divider: #e9edef;
  --wa-row-hover: #f5f6f6;
  --wa-shadow: 0 1px 2px rgba(11, 20, 26, 0.08), 0 6px 18px rgba(11, 20, 26, 0.06);

  position: relative;
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px 16px 48px;
  font-family: "Segoe UI", "Helvetica Neue", Helvetica, "Lucida Grande", Arial,
    system-ui, sans-serif;
  color: var(--wa-ink);
}

/* Doodle wallpaper sits behind the whole view */
.wa-flows .wa-wallpaper {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: var(--wa-bg);
  border-radius: 14px;
}
.wa-flows > *:not(.wa-wallpaper) {
  position: relative;
  z-index: 1;
}

/* App bar — the WhatsApp teal header */
.wa-flows .wa-appbar {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--wa-teal);
  color: #fff;
  padding: 14px 18px;
  border-radius: 14px 14px 0 0;
}
.wa-flows .wa-appbar-avatar {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 17px;
}
.wa-flows .wa-appbar-titles {
  flex: 1 1 auto;
  min-width: 0;
}
.wa-flows .wa-appbar-title {
  margin: 0;
  font-size: 19px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wa-flows .wa-appbar-sub {
  font-size: 12.5px;
  opacity: 0.85;
}
.wa-flows .wa-actions {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}

/* Create buttons */
.wa-flows .wa-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: transform 0.06s ease, background-color 0.15s ease,
    box-shadow 0.15s ease;
}
.wa-flows .wa-btn:active {
  transform: scale(0.97);
}
.wa-flows .wa-btn-ghost {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}
.wa-flows .wa-btn-ghost:hover {
  background: rgba(255, 255, 255, 0.28);
}
.wa-flows .wa-btn-blast {
  background: var(--wa-green);
  color: #04361a;
  box-shadow: 0 2px 6px rgba(37, 211, 102, 0.4);
}
.wa-flows .wa-btn-blast:hover {
  background: #20c35d;
}
.wa-flows .wa-btn svg {
  width: 16px;
  height: 16px;
}

/* The list card */
.wa-flows .wa-card {
  background: var(--wa-panel);
  border-radius: 0 0 14px 14px;
  box-shadow: var(--wa-shadow);
  overflow: hidden;
}

.wa-flows .wa-table {
  width: 100%;
  border-collapse: collapse;
}
.wa-flows .wa-table thead th {
  text-align: left;
  font-size: 11.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--wa-muted);
  font-weight: 600;
  padding: 12px 18px;
  border-bottom: 1px solid var(--wa-divider);
  background: #fbfcfc;
}
.wa-flows .wa-table tbody tr {
  cursor: pointer;
  transition: background-color 0.12s ease;
}
.wa-flows .wa-table tbody tr:hover {
  background: var(--wa-row-hover);
}
.wa-flows .wa-table tbody tr:not(:last-child) td {
  border-bottom: 1px solid var(--wa-divider);
}
.wa-flows .wa-table td {
  padding: 12px 18px;
  font-size: 14px;
  vertical-align: middle;
}

/* Name cell — chat-list style: avatar + name + id */
.wa-flows .wa-name-cell {
  display: flex;
  align-items: center;
  gap: 13px;
}
.wa-flows .wa-avatar {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 600;
  font-size: 16px;
}
.wa-flows .wa-name {
  font-weight: 500;
  color: var(--wa-ink);
  line-height: 1.25;
}
.wa-flows .wa-id {
  font-size: 12px;
  color: var(--wa-muted);
}

/* Type bubble badges — the signature element */
.wa-flows .wa-bubble-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px 5px 9px;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 9px;
  position: relative;
}
.wa-flows .wa-bubble-badge svg {
  width: 14px;
  height: 14px;
}
/* outgoing bubble = blast (broadcast) */
.wa-flows .wa-badge-blast {
  background: var(--wa-bubble);
  color: var(--wa-bubble-ink);
  border-top-right-radius: 2px;
}
.wa-flows .wa-badge-blast::after {
  content: "";
  position: absolute;
  top: 0;
  right: -5px;
  border: 5px solid transparent;
  border-top-color: var(--wa-bubble);
  border-right: 0;
}
/* incoming bubble = flow (journey) */
.wa-flows .wa-badge-flow {
  background: #f0f2f5;
  color: #54656f;
  border-top-left-radius: 2px;
}
.wa-flows .wa-badge-flow::after {
  content: "";
  position: absolute;
  top: 0;
  left: -5px;
  border: 5px solid transparent;
  border-top-color: #f0f2f5;
  border-left: 0;
}

.wa-flows .wa-meta {
  color: var(--wa-muted);
  font-size: 13px;
  white-space: nowrap;
}

/* Open affordance */
.wa-flows .wa-open {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--wa-teal);
  cursor: pointer;
  transition: background-color 0.12s ease;
}
.wa-flows .wa-table tbody tr:hover .wa-open {
  background: rgba(0, 128, 105, 0.1);
}
.wa-flows .wa-open svg {
  width: 18px;
  height: 18px;
}

/* States */
.wa-flows .wa-state {
  text-align: center;
  padding: 56px 24px;
  color: var(--wa-muted);
  font-size: 14.5px;
}
.wa-flows .wa-state-title {
  color: var(--wa-ink);
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
}
.wa-flows .wa-state-error {
  color: #c0392b;
}

/* Footer / pagination */
.wa-flows .wa-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  border-top: 1px solid var(--wa-divider);
  background: #fbfcfc;
}
.wa-flows .wa-pginfo {
  font-size: 13px;
  color: var(--wa-muted);
}
.wa-flows .wa-pgbtn {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--wa-divider);
  background: #fff;
  color: var(--wa-teal);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.12s ease;
}
.wa-flows .wa-pgbtn:hover:not(:disabled) {
  background: var(--wa-row-hover);
}
.wa-flows .wa-pgbtn:disabled {
  color: #c4ccd1;
  cursor: default;
}

/* Focus visibility */
.wa-flows button:focus-visible,
.wa-flows tr:focus-visible {
  outline: 2px solid var(--wa-teal);
  outline-offset: 2px;
}

/* Responsive — collapse to chat-list rows */
@media (max-width: 680px) {
  .wa-flows .wa-appbar {
    flex-wrap: wrap;
  }
  .wa-flows .wa-actions {
    width: 100%;
  }
  .wa-flows .wa-actions .wa-btn {
    flex: 1 1 0;
    justify-content: center;
  }
  .wa-flows .wa-col-created,
  .wa-flows .wa-table thead {
    display: none;
  }
  .wa-flows .wa-table,
  .wa-flows .wa-table tbody,
  .wa-flows .wa-table tr,
  .wa-flows .wa-table td {
    display: block;
    width: 100%;
  }
  .wa-flows .wa-table tr {
    position: relative;
    padding: 6px 0;
  }
  .wa-flows .wa-table td {
    border: none !important;
    padding: 2px 16px;
  }
  .wa-flows .wa-table td.wa-col-name {
    padding-top: 12px;
  }
  .wa-flows .wa-table td.wa-col-action {
    position: absolute;
    top: 14px;
    right: 8px;
    width: auto;
    padding: 0;
  }
  .wa-flows .wa-meta::before {
    content: "Modified ";
  }
}

@media (prefers-reduced-motion: reduce) {
  .wa-flows * {
    transition: none !important;
  }
}
