/* ── Reset ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
img, svg { display: block; }

/* ── Base ──────────────────────────────────────────────────────────────────── */
:root {
  --navy:       #0D1B2A;
  --cyan:       #00C2CB;
  --bg:         #F4F6F9;
  --surface:    #FFFFFF;
  --surface2:   #F9FAFB;
  --border:     #E2E6EC;
  --border2:    #C8D0DB;
  --text:       #111827;
  --text2:      #4B5563;
  --text3:      #9CA3AF;
  --accent:     #1A56DB;
  --accent-bg:  #EFF3FD;
  --success:    #047857;
  --success-bg: #D1FAE5;
  --danger:     #B91C1C;
  --danger-bg:  #FEE2E2;
  --warn-bg:    #FEF3C7;
  --radius:     8px;
  --radius-lg:  12px;
}

html { font-size: 16px; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Layout ────────────────────────────────────────────────────────────────── */
.page { min-height: 100vh; display: flex; flex-direction: column; }
.main { flex: 1; padding: 2.5rem 1rem 4rem; }

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1rem;
}

.container--narrow { max-width: 680px; }

/* ── Header ────────────────────────────────────────────────────────────────── */
.site-header {
  background: var(--navy);
  padding: 0 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

.site-header .container {
  display: flex;
  align-items: center;
  height: 60px;
  gap: 1rem;
}

.logo { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.logo-text { line-height: 1.25; }
.logo-name  { display: block; font-size: 15px; font-weight: 600; color: #fff; letter-spacing: -0.01em; }
.logo-domain { display: block; font-size: 11px; color: rgba(255,255,255,0.45); font-family: 'IBM Plex Mono', monospace; }

.header-badge {
  margin-left: auto;
  background: rgba(0,194,203,0.12);
  color: var(--cyan);
  font-size: 11px;
  font-weight: 500;
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid rgba(0,194,203,0.25);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* ── Footer ────────────────────────────────────────────────────────────────── */
.site-footer {
  background: var(--navy);
  padding: 1rem;
  border-top: 1px solid rgba(255,255,255,0.07);
}

.site-footer .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: rgba(255,255,255,0.35);
}

/* ── Cards ──────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 1.25rem;
}

/* ── Lookup card ─────────────────────────────────────────────────────────────── */
.lookup-card { text-align: center; padding: 2.5rem 2rem; }

.card-icon {
  width: 56px;
  height: 56px;
  background: #F0F4FA;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.25rem;
}

.card-title {
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

.card-desc {
  font-size: 14px;
  color: var(--text2);
  max-width: 420px;
  margin: 0 auto 1.75rem;
  line-height: 1.7;
}

/* ── Form elements ───────────────────────────────────────────────────────────── */
.field-group { text-align: left; }

.field-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text2);
  margin-bottom: 6px;
}

.input-row { display: flex; gap: 8px; }

.pid-input {
  flex: 1;
  height: 44px;
  padding: 0 14px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 14px;
  letter-spacing: 0.05em;
  background: var(--surface);
  border: 1.5px solid var(--border2);
  border-radius: var(--radius);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.pid-input::placeholder {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: var(--text3);
  letter-spacing: 0;
}

.pid-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(26,86,219,0.12);
}

.pid-input--error {
  border-color: var(--danger);
}

.btn-verify {
  height: 44px;
  padding: 0 20px;
  background: var(--navy);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  transition: opacity 0.15s, transform 0.1s;
}

.btn-verify:hover  { opacity: 0.88; }
.btn-verify:active { transform: scale(0.97); }

.field-error {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
  font-size: 13px;
  color: var(--danger);
}

.field-hint {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text3);
}

/* ── Certificate result ──────────────────────────────────────────────────────── */
.cert-status-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--success-bg);
  border: 1px solid #6EE7B7;
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
  font-size: 13px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
}

.status-label { font-weight: 500; color: var(--success); }
.status-pid   { font-family: 'IBM Plex Mono', monospace; color: var(--text2); font-size: 12px; }

.btn-new-lookup {
  margin-left: auto;
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}
.btn-new-lookup:hover { text-decoration: underline; }

.cert-card { padding: 0; overflow: hidden; }

.cert-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.cert-icon {
  width: 44px;
  height: 44px;
  background: #F0F4FA;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.cert-meta { flex: 1; }
.cert-name { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.cert-type { font-size: 13px; color: var(--text2); }

.verified-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--success-bg);
  color: var(--success);
  font-size: 12px;
  font-weight: 500;
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid #6EE7B7;
  white-space: nowrap;
}

.cert-details {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
}

.detail {
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
}

.detail:nth-child(3n) { border-right: none; }
.detail:nth-last-child(-n+3) { border-bottom: none; }

.detail-label {
  display: block;
  font-size: 10px;
  font-weight: 500;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
  font-family: 'IBM Plex Mono', monospace;
}

.detail-value { font-size: 13px; font-weight: 500; color: var(--text); }
.detail-value--mono { font-family: 'IBM Plex Mono', monospace; font-size: 12px; }
.detail-value--expired { color: var(--danger); }

.expired-tag {
  display: inline-block;
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 10px;
  font-weight: 500;
  padding: 1px 7px;
  border-radius: 10px;
  margin-left: 5px;
  vertical-align: middle;
}

/* ── PDF viewer ──────────────────────────────────────────────────────────────── */
.viewer-card { padding: 0; overflow: hidden; }

.viewer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
}

.viewer-filename {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-family: 'IBM Plex Mono', monospace;
  color: var(--text2);
}

.viewer-readonly {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text3);
}

.pdf-embed-wrap { background: #525659; line-height: 0; }

.pdf-embed {
  width: 100%;
  height: 640px;
  border: none;
  display: block;
}

.viewer-notice {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  padding: 0.85rem 1.25rem;
  font-size: 12px;
  color: var(--text3);
  border-top: 1px solid var(--border);
  line-height: 1.6;
}

.viewer-notice a { color: var(--accent); }

/* ── Admin grid ──────────────────────────────────────────────────────────────── */
.admin-grid {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 900px) {
  .admin-grid { grid-template-columns: 1fr; }
}

.admin-form-card { padding: 1.5rem; }
.card-heading {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.form-field { margin-bottom: 1rem; }
.form-field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text2);
  margin-bottom: 5px;
}

.form-field input[type="text"],
.form-field input[type="date"],
.form-field input[type="file"] {
  width: 100%;
  height: 38px;
  padding: 0 10px;
  font-size: 13px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}

.form-field input[type="file"] {
  height: auto;
  padding: 7px 10px;
  cursor: pointer;
}

.form-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(26,86,219,0.1);
}

.form-field input[readonly] {
  background: var(--surface2);
  color: var(--text2);
  cursor: not-allowed;
}

.form-hint {
  font-size: 11px;
  color: var(--text3);
  margin-top: 4px;
  line-height: 1.5;
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }

.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.req { color: var(--danger); }

/* ── Buttons ─────────────────────────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 16px;
  background: var(--navy);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s;
  text-decoration: none;
}

.btn-primary:hover  { opacity: 0.85; }
.btn-primary--full  { width: 100%; justify-content: center; height: 42px; font-size: 14px; }

.btn-ghost-sm {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 12px;
  font-size: 12px;
  color: rgba(255,255,255,0.6);
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s;
  margin-left: auto;
}

.btn-ghost-sm:hover { background: rgba(255,255,255,0.13); color: #fff; }

/* ── Table ───────────────────────────────────────────────────────────────────── */
.admin-table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.table-header {
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
}

.table-header .card-heading { margin: 0; padding: 0; border: none; font-size: 14px; }

.table-scroll { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 10px 14px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td      { background: var(--surface2); }

.data-table code {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  background: var(--surface2);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.td-expired { color: var(--danger); }

.pdf-tag {
  font-size: 11px;
  color: var(--success);
  background: var(--success-bg);
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
}

.no-pdf-tag {
  font-size: 11px;
  color: var(--text3);
  background: var(--surface2);
  padding: 2px 8px;
  border-radius: 10px;
}

.td-actions { white-space: nowrap; }

.action-link {
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
  margin-right: 10px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  font-weight: 500;
}
.action-link:hover { text-decoration: underline; }
.action-link--danger { color: var(--danger); }

.empty-state {
  padding: 2.5rem;
  text-align: center;
  font-size: 14px;
  color: var(--text3);
}

/* ── Alerts ──────────────────────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 1.25rem;
}

.alert--success { background: var(--success-bg); color: var(--success); border: 1px solid #6EE7B7; }
.alert--error   { background: var(--danger-bg);  color: var(--danger);  border: 1px solid #FCA5A5; }

/* ── Login page ──────────────────────────────────────────────────────────────── */
.login-page { background: var(--navy); }

.login-wrap {
  max-width: 380px;
  margin: 0 auto;
  padding: 4rem 1.5rem;
}

.login-logo { margin-bottom: 1.5rem; }

.login-title {
  font-size: 22px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 4px;
  letter-spacing: -0.02em;
}

.login-sub {
  font-size: 13px;
  color: rgba(255,255,255,0.45);
  margin-bottom: 1.75rem;
}

.login-form .form-field label { color: rgba(255,255,255,0.65); }

.login-form input[type="text"],
.login-form input[type="password"] {
  background: rgba(255,255,255,0.07);
  border-color: rgba(255,255,255,0.12);
  color: #fff;
}

.login-form input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(0,194,203,0.15);
}

.login-form input::placeholder { color: rgba(255,255,255,0.25); }

/* ── Responsive ──────────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .card { padding: 1.25rem; }
  .cert-details { grid-template-columns: 1fr 1fr; }
  .detail:nth-child(3n) { border-right: 1px solid var(--border); }
  .detail:nth-child(2n) { border-right: none; }
  .input-row { flex-direction: column; }
  .btn-verify { width: 100%; justify-content: center; }
  .pdf-embed  { height: 420px; }
  .form-row   { grid-template-columns: 1fr; }
}
