/*
 * Bloc Carte de visite — styles autonomes scopés sur .cv-page / .cv-wrap.
 * Branding neutre Ngento : bleu profond + surface claire. Surchargeable
 * en P3 via tenants/<code>/config.json (palette CSS variables).
 */

:root {
  --cv-primary: #1f4e79;
  --cv-primary-dark: #163a5a;
  --cv-primary-light: #2c6a9d;
  --cv-accent: #f58220;
  --cv-text: #1e293b;
  --cv-muted: #64748b;
  --cv-bg: linear-gradient(145deg, #1a556d 0%, #1f4e79 60%, #2c6a9d 100%);
  --cv-card-bg: rgba(255, 255, 255, 0.97);
  --cv-radius-card: 28px;
  --cv-radius-btn: 16px;
  --cv-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
  --cv-safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body.cv-page {
  margin: 0;
  padding: 16px 12px calc(20px + var(--cv-safe-bottom));
  min-height: 100vh;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--cv-text);
  background: var(--cv-bg);
}

.cv-wrap {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
}

/* ─── carte ─── */
.cv-card {
  position: relative;
  background: var(--cv-card-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--cv-radius-card);
  box-shadow: var(--cv-shadow);
  padding: 1.25rem 1.25rem 1rem;
  overflow: hidden;
}

.cv-toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.cv-icon-btn {
  width: 40px;
  height: 40px;
  border: none;
  background: rgba(31, 78, 121, 0.06);
  color: var(--cv-primary-dark);
  border-radius: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, transform 0.1s ease;
  font-size: 18px;
  font-weight: 600;
}
.cv-icon-btn:hover { background: rgba(31, 78, 121, 0.12); }
.cv-icon-btn:active { transform: scale(0.96); }
.cv-icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.cv-title h1 {
  margin: 0.5rem 0 0.25rem;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--cv-primary-dark);
}
.cv-subtitle {
  margin: 0 0 1rem;
  color: var(--cv-muted);
  font-size: 0.85rem;
}

/* ─── QR + identité ─── */
.cv-qr-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 1rem 0 1.25rem;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}
.cv-qr-box {
  width: 196px;
  height: 196px;
  background: #fff;
  padding: 12px;
  border-radius: 18px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.10);
  display: flex;
  align-items: center;
  justify-content: center;
}
.cv-qr-box img,
.cv-qr-box canvas { width: 100% !important; height: 100% !important; }

.cv-identity { text-align: center; }
.cv-identity-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--cv-primary-dark);
}
.cv-identity-job {
  color: var(--cv-primary);
  font-weight: 500;
  font-size: 0.95rem;
  margin-top: 0.1rem;
}
.cv-identity-company {
  color: var(--cv-muted);
  font-size: 0.85rem;
  margin-top: 0.05rem;
}

/* ─── actions rapides ─── */
.cv-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-top: 1rem;
}
.cv-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 0.25rem;
  background: linear-gradient(135deg, var(--cv-primary-dark) 0%, var(--cv-primary) 100%);
  color: #fff;
  text-decoration: none;
  border-radius: var(--cv-radius-btn);
  font-weight: 600;
  font-size: 0.85rem;
  transition: transform 0.12s ease, filter 0.12s ease;
}
.cv-action-btn:hover { filter: brightness(1.05); transform: translateY(-1px); }
.cv-action-btn:active { transform: scale(0.98); }
.cv-action-icon {
  font-size: 1.3rem;
  margin-bottom: 0.15rem;
}

/* ─── footer ─── */
.cv-footer {
  margin-top: 0.75rem;
  text-align: center;
}
.cv-block-id {
  font-size: 0.7rem;
  color: var(--cv-muted);
  opacity: 0.7;
}

/* ─── overlays / modals ─── */
.cv-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 1000;
}
.cv-overlay[aria-hidden="false"] { display: flex; }

.cv-modal {
  background: #fff;
  border-radius: 22px;
  max-width: 460px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.25rem 1.25rem 1rem;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.30);
}
.cv-modal-compact { max-width: 380px; }

.cv-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.cv-modal-header h2 {
  margin: 0;
  font-size: 1.15rem;
  color: var(--cv-primary-dark);
}
.cv-modal-text {
  color: var(--cv-muted);
  font-size: 0.9rem;
  margin: 0 0 1rem;
}

.cv-form, .cv-form-field { display: flex; flex-direction: column; }
.cv-form label, .cv-form-field {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--cv-primary-dark);
  margin-bottom: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.cv-form input, .cv-form-field input {
  padding: 0.65rem 0.85rem;
  border: 1px solid rgba(31, 78, 121, 0.18);
  border-radius: 10px;
  font-size: 0.95rem;
  font-family: inherit;
  background: #fafbfc;
  outline: none;
  transition: border-color 0.15s ease;
}
.cv-form input:focus, .cv-form-field input:focus {
  border-color: var(--cv-primary);
  background: #fff;
}

.cv-form-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.cv-btn {
  flex: 1;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.9rem;
  font-family: inherit;
  transition: filter 0.12s ease, transform 0.1s ease;
}
.cv-btn-primary {
  background: linear-gradient(135deg, var(--cv-primary-dark) 0%, var(--cv-primary) 100%);
  color: #fff;
}
.cv-btn-ghost {
  background: rgba(31, 78, 121, 0.08);
  color: var(--cv-primary-dark);
}
.cv-btn:hover { filter: brightness(1.05); }
.cv-btn:active { transform: scale(0.98); }

@media (max-width: 420px) {
  .cv-card { padding: 1rem; }
  .cv-title h1 { font-size: 1.3rem; }
  .cv-qr-box { width: 176px; height: 176px; }
}
