/* ============================================================
   CMC — Styles Espace Client Particulier
   ============================================================ */

body {
  background: #f8fafc;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header Client */
.client-header {
  background: #1c3b5c;
  color: #fff;
  padding: 14px 0;
  box-shadow: 0 4px 20px rgba(0,0,0,.15);
}

.client-header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.brand-info {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-weight: 800;
  font-size: 1.15rem;
  color: #fff;
}

.brand-sub {
  font-size: .8rem;
  color: #94a3b8;
}

/* User badge in header */
.client-user-bar {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,.1);
  padding: 6px 14px;
  border-radius: 999px;
}

.user-avatar {
  font-size: 1.2rem;
}

.user-details {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.user-details strong {
  font-size: .88rem;
  color: #fff;
}

.user-details small {
  font-size: .75rem;
  color: #cbd5e1;
}

.btn-back-home {
  color: #cbd5e1;
  text-decoration: none;
  font-size: .88rem;
  font-weight: 600;
  transition: color .2s ease;
}

.btn-back-home:hover {
  color: #fff;
}

/* Main Content */
.client-main {
  flex: 1;
  padding-top: 36px;
  padding-bottom: 50px;
}

/* Auth Login Card */
.auth-card {
  max-width: 520px;
  margin: 40px auto;
  background: #fff;
  padding: 40px 32px;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,.06);
  text-align: center;
  border: 1px solid #e2e8f0;
}

.auth-icon {
  font-size: 2.8rem;
  margin-bottom: 12px;
}

.auth-card h2 {
  color: #1c3b5c;
  font-size: 1.5rem;
  margin-bottom: 10px;
}

.auth-desc {
  color: #64748b;
  font-size: .95rem;
  line-height: 1.5;
  margin-bottom: 24px;
}

/* Google button */
.google-auth-box {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}

/* Fallback custom google button if Google GSI library not loaded */
button.btn-custom-google {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 24px;
  background: #fff;
  color: #374151;
  border: 1px solid #d1d5db;
  border-radius: 999px;
  font-weight: 700;
  font-size: .95rem;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,.05);
  transition: all .15s ease;
}

button.btn-custom-google:hover {
  background: #f9fafb;
  border-color: #9ca3af;
  box-shadow: 0 4px 12px rgba(0,0,0,.1);
}

/* Divider */
.auth-divider {
  display: flex;
  align-items: center;
  margin: 24px 0;
  color: #94a3b8;
  font-size: .85rem;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e2e8f0;
}

.auth-divider span {
  padding: 0 14px;
}

/* Form email */
.auth-email-form {
  text-align: left;
}

.auth-email-form label {
  font-weight: 700;
  font-size: .9rem;
  color: #1e293b;
  display: block;
  margin-bottom: 6px;
}

.auth-email-form input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 1rem;
  margin-bottom: 14px;
  box-sizing: border-box;
}

.auth-footnote {
  margin-top: 20px;
  font-size: .82rem;
  color: #64748b;
  line-height: 1.4;
}

/* Dashboard Cards */
.client-card {
  background: #fff;
  border-radius: 14px;
  padding: 24px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 16px rgba(0,0,0,.04);
  margin-bottom: 24px;
}

/* Maintenance Banner */
.maintenance-card {
  border-left: 6px solid #e7ac35;
  background: linear-gradient(180deg, #fffdfa 0%, #ffffff 100%);
}

.equipment-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.equipment-icon {
  font-size: 2.2rem;
  background: #fef3c7;
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 12px;
}

h3#eq-brand-title {
  margin: 2px 0 4px;
  color: #1c3b5c;
  font-size: 1.35rem;
}

p.eq-sub {
  color: #64748b;
  font-size: .88rem;
  margin: 0;
}

/* Badge */
div.maintenance-badge {
  margin-left: auto;
  padding: 6px 16px;
  border-radius: 999px;
  font-weight: 800;
  font-size: .85rem;
  text-transform: uppercase;
  letter-spacing: .5px;
  background: #dcfce7;
  color: #166534;
}

div.maintenance-badge.due {
  background: #fef3c7;
  color: #92400e;
}

div.maintenance-badge.overdue {
  background: #fee2e2;
  color: #991b1b;
}

/* Grid 3 stats */
div.maintenance-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 22px;
  background: #f8fafc;
  padding: 16px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}

div.m-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

span.m-lbl {
  font-size: .78rem;
  color: #64748b;
  text-transform: uppercase;
  font-weight: 700;
}

strong.m-val {
  font-size: 1.05rem;
  color: #1e293b;
}

strong.m-val.highlight {
  color: #e7ac35;
  font-weight: 800;
}

div.maintenance-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

/* 2 Cols Grid */
div.client-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

div.card-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  border-bottom: 2px solid #f1f5f9;
  padding-bottom: 10px;
}

div.card-title-row h3 {
  margin: 0;
  color: #1c3b5c;
  font-size: 1.2rem;
}

span.badge-count {
  background: #e2e8f0;
  color: #475569;
  font-size: .8rem;
  font-weight: 800;
  padding: 2px 10px;
  border-radius: 999px;
}

.quote-review-notice {
  display: grid;
  gap: 4px;
  margin-bottom: 12px;
  padding: 13px 14px;
  border: 1px solid #f2cf7c;
  border-left: 4px solid #d89a1d;
  border-radius: 9px;
  background: #fff9e9;
  color: #704b08;
}
.quote-review-notice strong { font-size: .9rem; }
.quote-review-notice span { font-size: .8rem; line-height: 1.45; }

/* Doc Item */
div.doc-item {
  padding: 14px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  margin-bottom: 12px;
  background: #fff;
  transition: border-color .15s ease, box-shadow .15s ease;
}

div.doc-item:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 12px rgba(0,0,0,.05);
}

div.doc-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

span.doc-id {
  font-weight: 800;
  color: #1c3b5c;
  font-size: .95rem;
}

div.doc-title {
  font-weight: 600;
  color: #334155;
  font-size: .9rem;
  margin-bottom: 10px;
}

div.doc-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #f1f5f9;
}

span.doc-price {
  font-size: 1.1rem;
  font-weight: 800;
  color: #1c3b5c;
}

/* Parcours de signature et modales client */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
  background: rgba(15, 23, 42, .72);
}

.modal-box {
  position: relative;
  width: min(100%, 620px);
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  padding: 28px;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, .28);
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: #edf2f7;
  color: #1c3b5c;
  font: 700 1.2rem/1 sans-serif;
  cursor: pointer;
}

.modal-header {
  padding-right: 42px;
  margin-bottom: 18px;
}

.modal-header h2 {
  margin: 0 0 6px;
  color: #1c3b5c;
  font-size: 1.4rem;
}

.modal-header p {
  margin: 0;
  color: #64748b;
  font-size: .9rem;
  line-height: 1.5;
}

.signature-modal-box {
  width: min(100%, 760px);
  border-top: 6px solid #e7ac35;
}

.signature-document-summary {
  display: grid;
  grid-template-columns: .8fr 1.5fr .8fr auto;
  align-items: end;
  gap: 14px;
  padding: 15px;
  border: 1px solid #d7e2ea;
  background: #f8fafc;
}

.signature-document-summary div {
  min-width: 0;
}

.signature-document-summary span {
  display: block;
  margin-bottom: 3px;
  color: #64748b;
  font-size: .72rem;
}

.signature-document-summary strong {
  display: block;
  overflow: hidden;
  color: #1c3b5c;
  font-size: .9rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.signature-scope-note {
  margin: 14px 0 18px;
  padding: 11px 13px;
  border-left: 4px solid #e7ac35;
  background: #fff9e9;
  color: #704b08;
  font-size: .82rem;
  line-height: 1.5;
}

.signature-field {
  margin-bottom: 17px;
}

.signature-field > label,
.signature-label-row label {
  display: block;
  margin-bottom: 7px;
  color: #1c3b5c;
  font-size: .88rem;
  font-weight: 800;
}

.signature-field input {
  box-sizing: border-box;
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #b8c6d3;
  border-radius: 8px;
  color: #1f2937;
  font: inherit;
  font-size: 16px;
}

.signature-field input:focus,
.signature-consent:focus-within {
  outline: 3px solid rgba(28, 59, 92, .15);
  outline-offset: 2px;
}

.signature-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.signature-clear {
  border: 0;
  background: transparent;
  color: #b91c1c;
  font: 700 .8rem/1 sans-serif;
  cursor: pointer;
}

.signature-canvas-frame {
  position: relative;
  overflow: hidden;
  border: 2px solid #1c3b5c;
  background:
    linear-gradient(to bottom, transparent calc(100% - 34px), #d7e2ea calc(100% - 33px), transparent calc(100% - 32px)),
    #fff;
}

.signature-canvas-frame canvas {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 180px;
  cursor: crosshair;
  touch-action: none;
}

.signature-canvas-frame span {
  position: absolute;
  right: 12px;
  bottom: 9px;
  color: #94a3b8;
  font-size: .72rem;
  pointer-events: none;
}

.signature-consent {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  margin: 4px 0 18px;
  padding: 13px;
  border: 1px solid #a7d7b9;
  background: #f0fdf4;
  color: #14532d;
  font-size: .86rem;
  font-weight: 700;
  line-height: 1.5;
  cursor: pointer;
}

.signature-consent input {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: #15803d;
}

.signature-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid #e2e8f0;
}

.acceptance-proof-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Quick Contact */
div.quick-contact-card {
  background: linear-gradient(135deg, #1c3b5c 0%, #2b5683 100%);
  color: #fff;
}

div.quick-contact-card h3 {
  color: #fff;
  margin-top: 0;
}

div.quick-contact-card p {
  color: #cbd5e1;
  margin: 0;
}

/* Footer Mini */
footer.footer-mini {
  background: #0f172a;
  color: #94a3b8;
  padding: 20px 0;
  font-size: .85rem;
}

@media (max-width: 900px) {
  div.client-grid-2 { grid-template-columns: 1fr; }
  div.maintenance-grid-3 { grid-template-columns: 1fr; }
  .client-header-inner { flex-direction: column; align-items: flex-start; }
  .signature-document-summary { grid-template-columns: 1fr 1fr; }
  .signature-document-summary a { width: 100%; }
}

/* ============================================================
   RESPONSIVE CONNEXION — Espace Client et écrans pliables
   ============================================================ */
html,
body { max-width: 100%; overflow-x: hidden; }

.client-header-inner,
.client-main,
.auth-card,
.auth-email-form { min-width: 0; }

.client-header-inner .brand,
.client-header-inner .brand-info { min-width: 0; }
.client-header-inner .brand-title,
.client-header-inner .brand-sub { overflow: hidden; text-overflow: ellipsis; }

.auth-card {
  width: 100%;
  max-width: 520px;
  box-sizing: border-box;
}
.auth-card h2 { line-height: 1.2; text-wrap: balance; }
.auth-email-form input,
.auth-email-form button { box-sizing: border-box; max-width: 100%; }
.auth-email-form input { font-size: 16px; }
.auth-email-form button { min-width: 0; white-space: normal; line-height: 1.25; }
.google-auth-box,
#google-signin-btn-slot { min-width: 0; max-width: 100%; overflow: hidden; }

@media (max-width: 900px) {
  .client-header { padding: 10px 0; }
  .client-header-inner { flex-direction: row; align-items: center; gap: 10px; }
  .client-header-inner .brand { flex: 1 1 auto; }
  .client-header-inner .brand-logo { width: 46px; height: 46px; flex: 0 0 46px; }
  .client-header-inner .brand-title { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; font-size: 1rem; line-height: 1.2; }
  .client-header-inner .brand-sub { display: block; font-size: .7rem; line-height: 1.3; white-space: nowrap; }
  .client-header-inner .btn-back-home { flex: 0 0 auto; padding: 8px 10px; border: 1px solid rgba(255,255,255,.22); border-radius: 10px; color: #fff; font-size: .74rem; white-space: nowrap; }
  .client-main { width: 100%; padding: 24px 16px 42px; }
  .auth-card { margin: 18px auto 28px; padding: 28px 18px; border-radius: 19px; }
  .auth-card h2 { font-size: clamp(1.3rem, 5.4vw, 1.55rem); }
  .auth-desc { font-size: .9rem; line-height: 1.5; }
  .google-auth-box { width: 100%; }
  #google-signin-btn-slot { width: 100%; }
  .client-user-bar { min-width: 0; max-width: 100%; flex-wrap: wrap; justify-content: flex-end; }
  .user-profile-badge { min-width: 0; max-width: 100%; }
  .user-details { min-width: 0; }
  .user-details small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

@media (max-width: 520px) {
  .auth-switcher { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px !important; }
  .auth-switcher .btn { width: 100%; min-width: 0; padding-left: 8px !important; padding-right: 8px !important; white-space: normal; line-height: 1.2; }
  .auth-footnote { font-size: .78rem; }
  .modal-backdrop { align-items: flex-start; padding: 8px; }
  .modal-box { max-height: calc(100dvh - 16px); padding: 22px 15px; }
  .signature-modal-box { border-top-width: 5px; }
  .signature-document-summary { grid-template-columns: 1fr; }
  .signature-canvas-frame canvas { height: 150px; }
  .signature-actions { flex-direction: column-reverse; }
  .signature-actions .btn { width: 100%; }
}

@media (max-width: 420px) {
  .client-header-inner { gap: 8px; }
  .client-header-inner .brand-logo { width: 42px; height: 42px; flex-basis: 42px; }
  .client-header-inner .brand-title { font-size: .86rem; }
  .client-header-inner .brand-sub { display: none; }
  .client-header-inner .btn-back-home { padding: 8px 9px; font-size: .7rem; }
  .client-main { padding-left: 12px; padding-right: 12px; }
  .auth-card { padding: 24px 14px; }
}
