/**
 * PR-CARTEGRISE — Styles module Carte Grise
 * Propulse par cartegrise.com
 */

:root {
    --cg-primary: #1260A8;
    --cg-accent: #0284C7;
    --cg-dark: #0D1B2A;
    --cg-surface: #F4F7FA;
    --cg-border: #E8E8E8;
    --cg-text: #1A1A1A;
    --cg-text-sec: #666;
    --cg-success: #0F8A4F;
    --cg-error: #CC2936;
    --cg-warning: #D4760A;
    --cg-radius: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Calibri', Arial, sans-serif; background: var(--cg-surface); color: var(--cg-text); min-height: 100vh; }

/* Header */
.cg-header { background: linear-gradient(135deg, #0284C7 0%, #0369A1 100%); color: white; padding: 24px 20px 20px; text-align: center; }
.cg-header-logos { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 10px; }
.cg-header-logo { width: 44px; height: 44px; border-radius: 10px; }
.cg-header-x { font-size: 16px; opacity: 0.6; }
.cg-header-partner { font-size: 12px; opacity: 0.7; }
.cg-header-title { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.cg-header-sub { font-size: 13px; opacity: 0.85; }
.cg-powered { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; padding: 4px 12px; background: rgba(255,255,255,0.15); border-radius: 20px; font-size: 11px; }

/* Stepper */
.cg-stepper { display: flex; justify-content: center; padding: 20px 16px 0; max-width: 600px; margin: 0 auto; overflow-x: auto; }
.cg-step { display: flex; align-items: center; flex: 1; min-width: 0; }
.cg-step:not(:last-child)::after { content: ''; flex: 1; height: 2px; background: var(--cg-border); margin: 0 4px; min-width: 8px; }
.cg-step.active:not(:last-child)::after { background: var(--cg-accent); }
.cg-step-dot { width: 26px; height: 26px; border-radius: 50%; background: var(--cg-border); color: var(--cg-text-sec); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0; transition: all 0.3s; }
.cg-step.active .cg-step-dot { background: var(--cg-accent); color: white; }
.cg-step.done .cg-step-dot { background: var(--cg-success); color: white; }
.cg-step-label { font-size: 9px; color: var(--cg-text-sec); margin-left: 4px; white-space: nowrap; display: none; }

.cg-container { max-width: 600px; margin: 0 auto; padding: 20px; }

/* Cards */
.cg-card { background: white; border: 1px solid var(--cg-border); border-radius: var(--cg-radius); padding: 20px; margin-bottom: 16px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.cg-card-title { font-size: 16px; font-weight: 700; color: var(--cg-dark); margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.cg-card-title svg { width: 20px; height: 20px; color: var(--cg-accent); flex-shrink: 0; }

/* Form */
.cg-field { margin-bottom: 14px; }
.cg-label { display: block; font-size: 13px; font-weight: 600; color: var(--cg-text-sec); margin-bottom: 6px; }
.cg-input { width: 100%; padding: 12px 14px; border: 1px solid var(--cg-border); border-radius: 8px; font-family: 'Calibri', Arial, sans-serif; font-size: 15px; color: var(--cg-text); outline: none; transition: border-color 0.2s; }
.cg-input:focus { border-color: var(--cg-accent); box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.1); }
.cg-input::placeholder { color: #aaa; }
.cg-select { appearance: none; background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") right 14px center no-repeat; padding-right: 36px; }
.cg-row { display: flex; gap: 12px; }
.cg-row .cg-field { flex: 1; }
.cg-row .cg-field-small { flex: 0 0 140px; }

/* Immatriculation input */
.cg-immat-input { font-size: 24px; font-weight: 700; text-align: center; letter-spacing: 3px; font-family: Consolas, 'Courier New', monospace; text-transform: uppercase; }

/* Taxe result */
.cg-taxe-result { background: var(--cg-surface); border-radius: var(--cg-radius); padding: 16px; margin-top: 12px; }
.cg-taxe-row { display: flex; justify-content: space-between; padding: 8px 0; font-size: 14px; border-bottom: 1px solid var(--cg-border); }
.cg-taxe-row:last-child { border: none; font-weight: 700; font-size: 18px; padding-top: 12px; }
.cg-taxe-label { color: var(--cg-text-sec); }
.cg-taxe-value { color: var(--cg-text); font-weight: 600; }
.cg-taxe-total { color: var(--cg-accent); }

/* Upload zone */
.cg-upload-zone { border: 2px dashed var(--cg-border); border-radius: var(--cg-radius); padding: 20px; text-align: center; cursor: pointer; transition: all 0.2s; }
.cg-upload-zone:hover { border-color: var(--cg-accent); }
.cg-upload-zone.uploaded { border-style: solid; border-color: var(--cg-success); background: rgba(15,138,79,0.03); }
.cg-upload-icon { width: 32px; height: 32px; margin: 0 auto 8px; color: var(--cg-border); }
.cg-upload-zone.uploaded .cg-upload-icon { color: var(--cg-success); }
.cg-upload-text { font-size: 13px; color: var(--cg-text-sec); }

/* Documents list */
.cg-doc-item { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--cg-border); border-radius: 10px; margin-bottom: 8px; }
.cg-doc-icon { width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.cg-doc-icon.pending { background: rgba(212,118,10,0.1); color: var(--cg-warning); }
.cg-doc-icon.done { background: rgba(15,138,79,0.1); color: var(--cg-success); }
.cg-doc-text { flex: 1; }
.cg-doc-name { font-size: 14px; font-weight: 600; }
.cg-doc-hint { font-size: 11px; color: var(--cg-text-sec); }
.cg-doc-action { flex-shrink: 0; }
.cg-doc-btn { padding: 6px 14px; border: 1px solid var(--cg-accent); color: var(--cg-accent); background: white; border-radius: 8px; font-size: 12px; font-weight: 600; cursor: pointer; }
.cg-doc-btn:hover { background: rgba(2,132,199,0.05); }
.cg-doc-check { color: var(--cg-success); font-size: 18px; }

/* Signature */
.cg-signature-pad { border: 2px dashed var(--cg-border); border-radius: var(--cg-radius); cursor: crosshair; touch-action: none; background: white; }
.cg-signature-pad.signed { border-color: var(--cg-success); border-style: solid; }

/* Status timeline */
.cg-timeline { padding: 0; }
.cg-timeline-item { display: flex; gap: 12px; padding-bottom: 20px; position: relative; }
.cg-timeline-item:not(:last-child)::before { content: ''; position: absolute; left: 15px; top: 32px; bottom: 0; width: 2px; background: var(--cg-border); }
.cg-timeline-item.active::before { background: var(--cg-accent); }
.cg-timeline-dot { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 14px; }
.cg-timeline-dot.pending { background: var(--cg-border); color: var(--cg-text-sec); }
.cg-timeline-dot.active { background: rgba(2,132,199,0.1); color: var(--cg-accent); animation: cgPulse 2s infinite; }
.cg-timeline-dot.done { background: rgba(15,138,79,0.1); color: var(--cg-success); }
@keyframes cgPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(2,132,199,0.2); } 50% { box-shadow: 0 0 0 8px rgba(2,132,199,0); } }
.cg-timeline-text { padding-top: 4px; }
.cg-timeline-title { font-size: 14px; font-weight: 600; }
.cg-timeline-desc { font-size: 12px; color: var(--cg-text-sec); margin-top: 2px; }
.cg-timeline-date { font-size: 11px; color: #999; margin-top: 2px; }

/* Buttons */
.cg-btn { width: 100%; padding: 14px 24px; border: none; border-radius: var(--cg-radius); font-family: 'Calibri', Arial, sans-serif; font-size: 16px; font-weight: 600; cursor: pointer; transition: all 0.2s; display: flex; align-items: center; justify-content: center; gap: 8px; }
.cg-btn-primary { background: var(--cg-primary); color: white; }
.cg-btn-primary:hover { background: #0F4F8A; }
.cg-btn-primary:disabled { background: #9CA3AF; cursor: not-allowed; }
.cg-btn-secondary { background: white; color: var(--cg-text-sec); border: 1px solid var(--cg-border); }
.cg-btn-row { display: flex; gap: 12px; margin-top: 20px; }
.cg-btn-row .cg-btn { flex: 1; }

/* Confirmation */
.cg-confirmation { text-align: center; padding: 32px 20px; }
.cg-code-display { background: rgba(2,132,199,0.08); border: 2px solid var(--cg-accent); border-radius: var(--cg-radius); padding: 20px; margin-bottom: 20px; }
.cg-code-label { font-size: 12px; color: var(--cg-text-sec); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 6px; }
.cg-code-value { font-family: Consolas, monospace; font-size: 32px; font-weight: 700; color: var(--cg-accent); letter-spacing: 4px; }

/* Pages */
.cg-page { display: none; }
.cg-page.active { display: block; }

/* Footer */
.cg-footer { text-align: center; padding: 20px; font-size: 12px; color: #999; }
.cg-footer a { color: var(--cg-accent); text-decoration: none; }

/* Notification */
.cg-notification { position: fixed; top: 20px; left: 50%; transform: translateX(-50%) translateY(-100px); padding: 12px 24px; border-radius: 10px; font-size: 14px; font-weight: 600; z-index: 9999; transition: transform 0.3s; max-width: 90%; }
.cg-notification.show { transform: translateX(-50%) translateY(0); }
.cg-notification.success { background: var(--cg-success); color: white; }
.cg-notification.error { background: var(--cg-error); color: white; }

/* Responsive */
@media (max-width: 480px) {
    .cg-container { padding: 16px; }
    .cg-card { padding: 16px; }
    .cg-row { flex-direction: column; gap: 0; }
    .cg-row .cg-field-small { flex: 1; }
    .cg-code-value { font-size: 26px; }
    .cg-immat-input { font-size: 20px; }
    .cg-btn-row { flex-direction: column; }
}
