/* ============================================================
   POSYB Solution — Shared Stylesheet
   ============================================================ */

:root {
  --bg-0: #ecf7ff;
  --bg-1: #d9efff;
  --panel: #ffffff;
  --primary: #0f8fe8;
  --primary-deep: #056bb3;
  --text-0: #0b2940;
  --text-1: #4a677c;
  --danger: #be123c;
  --ok: #047857;
  --ring: rgba(15, 143, 232, 0.26);
  --shadow: 0 14px 36px rgba(15, 74, 119, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "General Sans", "Segoe UI", sans-serif;
  color: var(--text-0);
  background:
    radial-gradient(1100px 380px at 95% -10%, #a8dcff 0%, transparent 70%),
    radial-gradient(920px 420px at -6% 105%, #b8e8ff 0%, transparent 72%),
    linear-gradient(155deg, var(--bg-0), var(--bg-1));
  padding: 20px;
}

/* ── Login Shell ───────────────────────────────────────────── */

.shell {
  width: min(1320px, 100%);
  min-height: calc(100vh - 40px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  background: #ffffff;
  border-radius: 22px;
  border: 1px solid #d9efff;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.brand {
  padding: 28px;
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.96), rgba(223, 244, 255, 0.96)),
    linear-gradient(120deg, #ffffff, #dff2ff);
  position: relative;
  display: flex;
  flex-direction: column;
}

.brand::after {
  content: "";
  position: absolute;
  width: 280px;
  height: 280px;
  right: -90px;
  bottom: -130px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(15, 143, 232, 0.2) 0%, rgba(15, 143, 232, 0) 70%);
}

.brand-header {
  display: flex;
  gap: 12px;
  align-items: center;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.brand-logo {
  width: 56px;
  height: 56px;
  object-fit: contain;
}

.tagline {
  margin-top: 42px;
  max-width: 430px;
}

.tagline h1 {
  margin: 0;
  font-size: clamp(1.5rem, 4vw, 2.1rem);
  line-height: 1.14;
}

.qa-theme {
  margin-top: 28px;
  flex: 1;
  min-height: 320px;
  position: relative;
  border: 1px solid rgba(15, 143, 232, 0.16);
  border-radius: 18px;
  background:
    radial-gradient(circle at 12% 22%, rgba(15, 143, 232, 0.07), transparent 40%),
    repeating-linear-gradient(
      135deg,
      rgba(15, 143, 232, 0.06) 0px,
      rgba(15, 143, 232, 0.06) 1px,
      transparent 1px,
      transparent 14px
    ),
    linear-gradient(165deg, rgba(255, 255, 255, 0.82), rgba(223, 244, 255, 0.72));
  padding: 24px;
  display: grid;
  align-content: center;
  gap: 8px;
  overflow: hidden;
}

.qa-theme h3 {
  margin: 0;
  font-size: clamp(2.1rem, 4vw, 3rem);
  line-height: 1.06;
  color: #164f76;
  letter-spacing: 0.2px;
}

.qa-theme p {
  margin: 0;
  max-width: 360px;
  font-size: 1rem;
  color: #4b6e86;
  line-height: 1.4;
}

.panel {
  padding: 28px 30px;
  background: var(--panel);
  border-left: 1px solid #e3f3ff;
}

/* ── Shared Form Components ────────────────────────────────── */

.card-title {
  margin: 0;
  font-size: 1.4rem;
}

.subtext {
  margin: 8px 0 0;
  color: var(--text-1);
  line-height: 1.45;
}

.loader {
  height: 3px;
  margin-top: 18px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(15, 143, 232, 0.15), rgba(15, 143, 232, 0.95), rgba(15, 143, 232, 0.15));
  background-size: 200% 100%;
  animation: pulse 1.2s linear infinite;
}

@keyframes pulse {
  from { background-position: 0 0; }
  to   { background-position: 200% 0; }
}

.form {
  margin-top: 26px;
  display: grid;
  gap: 14px;
  max-width: 520px;
}

.label {
  display: grid;
  gap: 6px;
  font-size: 0.93rem;
  color: var(--text-1);
}

.input {
  border: 1px solid #c9e6f8;
  border-radius: 12px;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 1rem;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--ring);
}

.password-wrap {
  position: relative;
}

.password-wrap .input {
  width: 100%;
  padding-right: 78px;
}

.peek-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: #eef7ff;
  color: var(--primary-deep);
  border-radius: 8px;
  padding: 6px 10px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.forgot-box {
  border: 1px solid #c9e6f8;
  border-radius: 12px;
  background: #f4fbff;
  padding: 12px;
  display: grid;
  gap: 10px;
}

.otp-helper {
  color: var(--text-1);
  font-size: 0.9rem;
}

.error,
.success {
  font-size: 0.9rem;
  border-radius: 10px;
  padding: 9px 10px;
}

.error {
  color: #881337;
  background: #ffe4e6;
}

.success {
  color: #064e3b;
  background: #dcfce7;
}

.actions {
  margin-top: 5px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ── Buttons ───────────────────────────────────────────────── */

.button {
  border: none;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 0.92rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

.button-primary {
  background: linear-gradient(180deg, #26a3fb, var(--primary));
  color: #fff;
}

.button-light {
  background: #eef7ff;
  color: var(--primary-deep);
}

.button-link {
  border: none;
  background: transparent;
  color: var(--primary-deep);
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
  font: inherit;
  width: fit-content;
  cursor: pointer;
}

.button[disabled] {
  opacity: 0.62;
  cursor: not-allowed;
}

.footnote {
  margin-top: 14px;
  font-size: 0.86rem;
  color: var(--text-1);
}

/* ── Dashboard Shell ───────────────────────────────────────── */

.dashboard-shell {
  width: min(1320px, 100%);
  margin: 0 auto;
  background: #ffffff;
  border-radius: 22px;
  box-shadow: var(--shadow);
  border: 1px solid #d9efff;
  overflow: hidden;
}

.topbar {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 22px;
  border-bottom: 1px solid #dcefff;
  background: #f6fbff;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
}

.topbar-logo {
  width: 40px;
  height: 40px;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-meta {
  text-align: right;
  line-height: 1.2;
}

.user-meta strong {
  display: block;
}

.user-meta span {
  color: var(--text-1);
  font-size: 0.86rem;
}

.dashboard-main {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: calc(100vh - 150px);
  height: calc(100vh - 150px);
}

.sidebar {
  border-right: 1px solid #e3f3ff;
  background: linear-gradient(180deg, #f9fdff 0%, #f2f9ff 100%);
  padding: 22px;
}

.sidebar h2 {
  margin: 0;
  font-size: 2.2rem;
}

.sidebar p {
  color: var(--text-1);
  margin-top: 10px;
}

.module-group {
  margin-top: 18px;
  border: 1px solid rgba(15, 143, 232, 0.18);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  padding: 12px;
}

.module-list {
  margin: 0;
  padding-left: 0;
  list-style: none;
}

.module-list li + li {
  margin-top: 6px;
}

.module-item-btn {
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  color: #2f5a76;
  font: inherit;
  font-size: 0.95rem;
  line-height: 1.34;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
}

.module-item-btn:hover {
  background: rgba(15, 143, 232, 0.12);
}

.module-item-btn.active {
  background: rgba(15, 143, 232, 0.18);
  color: #0d4368;
  font-weight: 700;
}

/* Sidebar links (<a> tags) styled identically to buttons */
a.module-item-btn {
  display: block;
  text-decoration: none;
}

.content {
  padding: 22px;
  overflow: auto;
}

.content h2 {
  margin: 0;
  font-size: 2rem;
}

.content-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  flex-wrap: wrap;
}

.content-top-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.plus-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(180deg, #26a3fb, var(--primary));
  color: #fff;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.breadcrumb {
  color: var(--text-1);
  font-size: 0.88rem;
  margin-top: 2px;
}

.dashboard-clock {
  color: var(--text-1);
  font-size: 0.9rem;
  font-weight: 600;
}

.content .subtext {
  margin-bottom: 12px;
}

/* ── User List Toolbar / Pagination ────────────────────────── */

.user-list-toolbar {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.user-search-input {
  width: min(520px, 100%);
}

.pagination-wrap {
  margin-top: 12px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.table-pagination-center {
  width: 100%;
  display: flex;
  justify-content: center;
}

.page-nav-btn {
  min-width: 42px;
}

.page-number-btn {
  min-width: 42px;
  background: #eef7ff;
  color: var(--primary-deep);
}

.page-number-active {
  background: linear-gradient(180deg, #26a3fb, var(--primary));
  color: #fff;
}

/* ── Tables ────────────────────────────────────────────────── */

.table-wrap {
  margin-top: 12px;
  border: 1px solid #cce9fb;
  border-radius: 12px;
  overflow: auto;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-size: 0.95rem;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid #e8f5ff;
  text-align: left;
  vertical-align: top;
}

th {
  background: #edf7ff;
  color: #1d4f6b;
  font-weight: 700;
}

tr:last-child td {
  border-bottom: none;
}

.status-pill {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 0.8rem;
  font-weight: 700;
}

.status-pill.active   { background: #dcfce7; color: #065f46; }
.status-pill.blocked  { background: #fee2e2; color: #991b1b; }
.status-pill.pending  { background: #fff7d6; color: #8a6a07; }
.status-pill.inactive { background: #e5e7eb; color: #374151; }

/* ── Tool Settings ─────────────────────────────────────────── */

.tool-settings-panel {
  margin-top: 12px;
  border: 1px solid #cce9fb;
  border-radius: 12px;
  background: #fafdff;
  padding: 20px;
  min-height: 420px;
}

.tool-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(140px, 200px));
  gap: 16px;
  margin-top: 20px;
}

.tool-card-btn {
  border: 1px solid #9fcdea;
  border-radius: 10px;
  background: #fff;
  color: #1f4f73;
  font-weight: 700;
  padding: 18px 16px;
  cursor: pointer;
}

.tool-card-btn.active {
  background: linear-gradient(145deg, #17a4e3, #1482d8);
  color: #fff;
  border-color: #1482d8;
}

.tool-actions {
  margin-top: 24px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.tool-test-status {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.94rem;
  font-weight: 600;
}

.tool-test-status-success {
  color: #0f766e;
}

.tool-test-status-error {
  color: #991b1b;
}

.tool-test-status-testing {
  color: #215475;
}

.tool-test-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid #c2d9ec;
  border-top-color: #1f7dc8;
  border-radius: 50%;
  animation: posyb-spin 0.8s linear infinite;
}

@keyframes posyb-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── Checkbox Group ────────────────────────────────────────── */

.checkbox-group {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  color: var(--text-0);
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* ── User Cards & Modals ───────────────────────────────────── */

.user-card {
  margin-top: 14px;
  border: 1px solid #cce9fb;
  border-radius: 12px;
  background: #f8fdff;
  padding: 14px;
  display: grid;
  gap: 10px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(9, 42, 66, 0.34);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  z-index: 40;
  padding: 18px;
}

.modal-card {
  width: min(560px, 100%);
  border-radius: 14px;
  border: 1px solid #b9def6;
  background: #fff;
  box-shadow: 0 18px 44px rgba(8, 49, 79, 0.2);
  padding: 18px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.modal-title {
  margin: 0;
  font-size: 1.25rem;
}

/* ── Footer ────────────────────────────────────────────────── */

.app-footer {
  width: min(1320px, 100%);
  margin: 0 auto;
  text-align: center;
  font-size: 0.78rem;
  color: #5f7f95;
  padding: 6px 10px 2px;
}

/* ── Responsive ────────────────────────────────────────────── */

@media (max-width: 980px) {
  .shell {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .dashboard-main {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: none;
    border-bottom: 1px solid #e3f3ff;
  }

  .user-meta {
    text-align: left;
  }

  .topbar {
    height: auto;
    padding: 12px;
    align-items: flex-start;
    flex-direction: column;
  }
}
