/* =================================================================
   My Desktop CertVault — components.css
   Reusable UI primitives: cards, inputs, buttons, tables, alerts.
   Each interactive role maps to one of the four Google colors so the
   palette stays coherent across the site.
   ================================================================= */

/* ---- Cards ---- */
.card, .panel, .hero-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}
.card { padding: 22px; }
.hero-card { padding: 28px; }

/* ---- Stat cards ---- */
.stat-card {
  padding: 22px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255,255,255,0.95), rgba(243,247,254,0.92));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.stat-label {
  margin: 0 0 8px;
  color: var(--text-soft);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.stat-value {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(28px, 4vw, 42px);
}

/* ---- Labels + inputs ---- */
.label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.input, .select, .textarea {
  width: 100%;
  border: 1px solid rgba(66, 133, 244, 0.24);
  background: rgba(255, 255, 255, 0.94);
  color: var(--text);
  border-radius: 14px;
  padding: 14px 16px;
  outline: none;
  transition: 0.2s ease;
}
.textarea { min-height: 120px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus {
  border-color: rgba(66, 133, 244, 0.6);
  box-shadow: 0 0 0 4px rgba(66, 133, 244, 0.12);
}

/* ---- Buttons ---- */
.button, .button-secondary, .button-danger, .button-ghost, .button-success, .button-warning {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 999px;
  text-decoration: none;
  border: none;
  cursor: pointer;
  font-weight: 600;
  transition: transform 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease;
}
.button:hover, .button-secondary:hover, .button-danger:hover, .button-ghost:hover,
.button-success:hover, .button-warning:hover {
  transform: translateY(-1px);
}
.button {
  background: linear-gradient(135deg, var(--g-blue), #5a95f7);
  color: white;
  box-shadow: 0 14px 24px rgba(66, 133, 244, 0.20);
}
.button-secondary {
  background: linear-gradient(135deg, var(--g-green), #2eb672);
  color: white;
  box-shadow: 0 14px 24px rgba(15, 157, 88, 0.20);
}
.button-danger {
  background: linear-gradient(135deg, var(--g-red), #e65f53);
  color: white;
  box-shadow: 0 14px 24px rgba(219, 68, 55, 0.20);
}
.button-warning {
  background: linear-gradient(135deg, var(--g-yellow), #ffc629);
  color: #5a4500;
  box-shadow: 0 14px 24px rgba(244, 180, 0, 0.22);
}
.button-success {
  background: linear-gradient(135deg, var(--g-green), #2eb672);
  color: white;
  box-shadow: 0 14px 24px rgba(15, 157, 88, 0.20);
}
.button-ghost {
  background: rgba(66, 133, 244, 0.10);
  color: var(--primary);
}
.button-row { display: flex; flex-wrap: wrap; gap: 12px; }

/* ---- Alerts ---- */
.alert {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid transparent;
}
.alert-error {
  color: #8a231d;
  background: #fdecea;
  border-color: rgba(219, 68, 55, 0.18);
}
.alert-success {
  color: #15633b;
  background: #e9f8ef;
  border-color: rgba(15, 157, 88, 0.18);
}
.alert-warning {
  color: #8a6500;
  background: #fef6da;
  border-color: rgba(244, 180, 0, 0.22);
}
.alert-info {
  color: #1a519b;
  background: #e9f0fe;
  border-color: rgba(66, 133, 244, 0.18);
}

/* ---- Tables ---- */
.table-shell {
  overflow: auto;
  border-radius: 18px;
  border: 1px solid var(--line);
}
table.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
  background: rgba(255,255,255,0.78);
}
.data-table th, .data-table td {
  text-align: left;
  padding: 16px;
  border-bottom: 1px solid rgba(66, 133, 244, 0.10);
}
.data-table th {
  font-size: 12px;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  background: rgba(66, 133, 244, 0.06);
}
.data-table tr:last-child td { border-bottom: none; }

/* ---- Pills ---- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(66, 133, 244, 0.12);
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
  font-family: "Consolas", "Courier New", monospace;
}
.pill.pill-green  { background: rgba(15, 157, 88, 0.12);  color: var(--g-green); }
.pill.pill-yellow { background: rgba(244, 180, 0, 0.18);  color: #8a6500; }
.pill.pill-red    { background: rgba(219, 68, 55, 0.12);  color: var(--g-red); }

/* Certificate-type badge (verify results table) */
.pill.pill-type {
  background: rgba(15, 157, 88, 0.10);
  color: #0a7d46;
  font-family: "Avenir Next", "Segoe UI", "Trebuchet MS", sans-serif;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* ---- Messages ---- */
.message-stack { display: grid; gap: 12px; margin-bottom: 20px; }
.message-card {
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(66, 133, 244, 0.09);
  border: 1px solid rgba(66, 133, 244, 0.16);
  color: #174a8a;
}

.muted { color: var(--text-soft); }

/* ---- Loading spinner ---- */
.spinner {
  display: inline-block;
  width: 20px; height: 20px;
  border: 3px solid rgba(66, 133, 244, 0.20);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Responsive grids ---- */
.grid-2, .grid-3, .grid-4 { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (max-width: 980px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .card, .hero-card, .stat-card { padding: 18px; }
  .grid-4 { grid-template-columns: 1fr; }

  /* ---- Mobile-friendly buttons ---- */
  .button, .button-secondary, .button-danger, .button-ghost,
  .button-success, .button-warning {
    min-height: 42px;
    padding: 0 16px;
    font-size: 14px;
    width: 100%;
  }
  .button-row { flex-direction: column; gap: 8px; }
  .button-row > * { width: 100%; }

  /* ---- Mobile-friendly inputs ---- */
  .input, .select, .textarea {
    padding: 12px 14px;
    font-size: 15px;
    border-radius: 12px;
  }

  /* ---- Table: tighter but still scrollable within its container ---- */
  table.data-table { min-width: 560px; }
  .data-table th, .data-table td {
    padding: 10px 12px;
    font-size: 13px;
  }
  .pill { font-size: 11px; padding: 6px 10px; }
}

@media (max-width: 400px) {
  table.data-table { min-width: 480px; }
  .data-table th, .data-table td { padding: 8px 10px; font-size: 12px; }
}
