/* Proceda design system */
:root {
    --brand-50: #eef4fa;
    --brand-500: #004080;
    --brand-600: #002B5B;
    --brand-700: #002248;
    --brand-900: #001528;
    --surface: #ffffff;
    --surface-muted: #f8fafc;
    --border: #e2e8f0;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 8px 30px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 24px 60px rgba(15, 23, 42, 0.12);
    --radius-lg: 1rem;
    --radius-xl: 1.25rem;
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

html {
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

body {
    font-feature-settings: "cv02", "cv03", "cv04", "cv11";
}

.brand-logo {
    display: block;
    max-width: 100%;
    object-fit: contain;
}

.brand-logo-icon {
    height: 2.5rem;
    width: 2.5rem;
    border-radius: 0.375rem;
    object-fit: cover;
    box-shadow: 0 1px 3px rgba(0, 43, 91, 0.18);
}

.brand-logo-link:hover .brand-logo-icon {
    transform: scale(1.02);
    transition: transform 0.2s ease;
}

.brand-logo-auth.brand-logo-icon {
    height: 4rem;
    width: 4rem;
    border-radius: 0.5rem;
}

/* Typography gradient */
.text-gradient {
    background: linear-gradient(135deg, #fff 0%, #bfdbfe 50%, #93c5fd 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.text-gradient-dark {
    background: linear-gradient(135deg, #002248 0%, #002B5B 50%, #004080 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* Animations */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes meshMove {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(2%, -3%) scale(1.05); }
    66% { transform: translate(-2%, 2%) scale(0.98); }
}

@keyframes shimmer {
    0% { background-position: -200% center; }
    100% { background-position: 200% center; }
}

@keyframes pulseSoft {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    50% { opacity: 0.85; box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fade-up { animation: fadeUp 0.7s var(--ease-out-expo) both; }
.animate-fade-in { animation: fadeIn 0.6s ease both; }
.animate-scale-in { animation: scaleIn 0.65s var(--ease-out-expo) both; }
.animate-float { animation: float 5s ease-in-out infinite; }
.animate-delay-1 { animation-delay: 0.08s; }
.animate-delay-2 { animation-delay: 0.16s; }
.animate-delay-3 { animation-delay: 0.24s; }
.animate-delay-4 { animation-delay: 0.32s; }
.animate-delay-5 { animation-delay: 0.4s; }
.animate-delay-6 { animation-delay: 0.48s; }

/* Scroll reveal */
.reveal {
    opacity: 0;
    transform: translateY(32px);
    transition: opacity 0.8s var(--ease-out-expo), transform 0.8s var(--ease-out-expo);
}

.reveal.reveal-visible {
    opacity: 1;
    transform: translateY(0);
}

.reveal-scale {
    opacity: 0;
    transform: scale(0.94);
    transition: opacity 0.7s var(--ease-out-expo), transform 0.7s var(--ease-out-expo);
}

.reveal-scale.reveal-visible {
    opacity: 1;
    transform: scale(1);
}

.stagger-children > *:nth-child(1) { transition-delay: 0ms; }
.stagger-children > *:nth-child(2) { transition-delay: 80ms; }
.stagger-children > *:nth-child(3) { transition-delay: 160ms; }
.stagger-children > *:nth-child(4) { transition-delay: 240ms; }
.stagger-children > *:nth-child(5) { transition-delay: 320ms; }
.stagger-children > *:nth-child(6) { transition-delay: 400ms; }

.stagger-children > .reveal:nth-child(1),
.stagger-children > .reveal-scale:nth-child(1) { transition-delay: 0ms; }
.stagger-children > .reveal:nth-child(2),
.stagger-children > .reveal-scale:nth-child(2) { transition-delay: 100ms; }
.stagger-children > .reveal:nth-child(3),
.stagger-children > .reveal-scale:nth-child(3) { transition-delay: 200ms; }
.stagger-children > .reveal:nth-child(4),
.stagger-children > .reveal-scale:nth-child(4) { transition-delay: 300ms; }

/* Hero */
.hero-section {
    position: relative;
    overflow: hidden;
    background: linear-gradient(145deg, #001528 0%, #002248 45%, #002B5B 100%);
}

.hero-mesh {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.hero-mesh::before,
.hero-mesh::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.45;
    animation: meshMove 18s ease-in-out infinite;
}

.hero-mesh::before {
    width: min(60vw, 520px);
    height: min(60vw, 520px);
    top: -10%;
    right: -5%;
    background: radial-gradient(circle, #60a5fa 0%, transparent 70%);
}

.hero-mesh::after {
    width: min(50vw, 420px);
    height: min(50vw, 420px);
    bottom: -15%;
    left: -10%;
    background: radial-gradient(circle, #818cf8 0%, transparent 70%);
    animation-delay: -9s;
}

.hero-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, black, transparent);
}

/* Surfaces */
.glass {
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.glass-dark {
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.ui-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    transition: transform 0.35s var(--ease-out-expo), box-shadow 0.35s ease, border-color 0.25s ease;
}

.ui-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: #cbd5e1;
}

.ui-card-static {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
}

.card-hover { transition: box-shadow 0.3s ease, transform 0.3s var(--ease-out-expo); }
.card-hover:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.card-lift {
    transition: transform 0.4s var(--ease-out-expo), box-shadow 0.4s ease;
}

.card-lift:hover {
    transform: translateY(-6px) scale(1.01);
    box-shadow: var(--shadow-lg);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 600;
    border-radius: 0.75rem;
    transition: transform 0.2s var(--ease-spring), box-shadow 0.2s ease, background 0.2s ease;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
    background: #fff;
    color: var(--brand-700);
    padding: 0.875rem 1.5rem;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
}

.btn-primary:hover {
    background: #f8fafc;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    transform: translateY(-1px);
}

.btn-secondary {
    border: 1px solid rgba(255, 255, 255, 0.35);
    color: #fff;
    padding: 0.875rem 1.5rem;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(8px);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.5);
}

.btn-brand {
    background: var(--brand-600);
    color: #fff;
    padding: 0.625rem 1.25rem;
    box-shadow: 0 2px 8px rgba(29, 78, 216, 0.35);
}

.btn-brand:hover {
    background: var(--brand-700);
    box-shadow: 0 4px 16px rgba(29, 78, 216, 0.45);
    transform: translateY(-1px);
}

.btn-brand-lg {
    padding: 0.875rem 2rem;
    font-size: 1rem;
}

/* Nav */
.site-nav {
    transition: background 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.site-nav.is-scrolled {
    background: rgba(255, 255, 255, 0.88);
    box-shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
    border-color: rgba(226, 232, 240, 0.8);
}

.nav-mobile-panel {
    animation: slideDown 0.25s var(--ease-out-expo) both;
}

.nav-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: currentColor;
    border-radius: 1px;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.nav-toggle.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.is-open span:nth-child(2) { opacity: 0; }
.nav-toggle.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mock UI (hero) */
.mock-dashboard {
    border-radius: 1.25rem;
    overflow: hidden;
    box-shadow: 0 32px 64px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.mock-row {
    transition: background 0.2s ease;
}

.mock-row:hover {
    background: rgba(255, 255, 255, 0.04);
}

/* Stats strip */
.stat-pill {
    position: relative;
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: transform 0.35s var(--ease-out-expo), border-color 0.25s ease;
}

.stat-pill:hover {
    transform: translateY(-4px);
    border-color: rgba(96, 165, 250, 0.35);
}

/* KPI & progress */
.kpi-value { font-variant-numeric: tabular-nums; }

.progress-bar {
    width: 0;
    transition: width 1.2s var(--ease-out-expo);
}

.progress-bar.is-animated {
    width: var(--progress, 0%);
}

.progress-track {
    background: #f1f5f9;
    border-radius: 9999px;
    overflow: hidden;
}

/* Status dots */
.status-dot-green { background: #10b981; }
.status-dot-orange { background: #f59e0b; }
.status-dot-red { background: #ef4444; }

.status-dot-unset { background: #94a3b8; }

.status-dot-pulse {
    animation: pulseSoft 2s ease-in-out infinite;
}

/* FAQ */
.faq-item {
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.faq-item[open] {
    border-color: #bfdbfe;
    box-shadow: var(--shadow-sm);
}

.faq-item summary {
    cursor: pointer;
    list-style: none;
    transition: color 0.2s ease;
}

.faq-item summary::-webkit-details-marker { display: none; }

.faq-item summary::after {
    content: "+";
    float: right;
    font-weight: 300;
    font-size: 1.25rem;
    line-height: 1.2;
    color: #94a3b8;
    transition: transform 0.25s var(--ease-spring);
}

.faq-item[open] summary::after {
    transform: rotate(45deg);
    color: var(--brand-600);
}

.faq-content {
    animation: fadeUp 0.35s var(--ease-out-expo) both;
}

/* Forms */
.ui-input {
    width: 100%;
    border-radius: 0.75rem;
    border: 1px solid var(--border);
    padding: 0.625rem 0.875rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.ui-input:focus {
    outline: none;
    border-color: var(--brand-500);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.auth-card {
    animation: scaleIn 0.6s var(--ease-out-expo) both;
}

/* Table */
.table-row-hover {
    transition: background 0.15s ease, transform 0.15s ease;
}

.table-row-hover:hover {
    background: rgba(248, 250, 252, 0.9);
}

/* Modal */
.modal-backdrop {
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(6px);
    animation: fadeIn 0.2s ease both;
}

.modal-panel {
    animation: scaleIn 0.3s var(--ease-out-expo) both;
}

/* Toast */
.copy-toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 100;
    background: #0f172a;
    color: #fff;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    box-shadow: var(--shadow-lg);
    animation: fadeUp 0.3s var(--ease-out-expo) both;
}

/* Section backgrounds */
.section-muted {
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
}

.section-dark {
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
}

/* Pricing glow */
.pricing-card {
    position: relative;
    overflow: hidden;
}

.pricing-card::before {
    content: "";
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg, #2563eb, #818cf8, #2563eb);
    background-size: 200% 200%;
    animation: shimmer 6s linear infinite;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

/* App shell */
.app-content { position: relative; }

.page-app main {
    animation: fadeUp 0.5s var(--ease-out-expo) both;
}

.subscription-locked { filter: blur(5px); opacity: 0.45; }

.subscription-overlay {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 4rem;
    background: rgba(248, 250, 252, 0.35);
}

.subscription-overlay-card {
    pointer-events: auto;
    max-width: 24rem;
    width: 100%;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    text-align: center;
    animation: scaleIn 0.4s var(--ease-out-expo) both;
}

/* Diligence table */
.print-only { display: none; }
.diligence-table details summary { list-style: none; }
.diligence-table details summary::-webkit-details-marker { display: none; }
.diligence-table details summary::after {
    content: ' · Voir le message';
    color: #64748b;
    font-weight: normal;
}
.diligence-table details[open] summary::after { content: ' · Masquer'; }

/* Legal pages */
.legal-page .legal-section-body ul {
    margin-top: 0.25rem;
}
.legal-page .legal-section-body table {
    font-variant-numeric: tabular-nums;
}
.legal-page .legal-page-nav a {
    padding: 0.25rem 0;
}

/* RNE timeline */
.rne-timeline {
    position: relative;
}
.rne-timeline::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 10px;
    bottom: 10px;
    width: 2px;
    background: #e2e8f0;
}
.rne-timeline-item:last-child { padding-bottom: 0; }

/* Responsive helpers */
@media (max-width: 639px) {
    .hero-section { padding-top: 2rem; }
    .mock-dashboard { transform: scale(0.95); }
}

.prose-help ul {
    margin-top: 0.5rem;
}
.prose-help code {
    font-size: 0.85em;
    background: #f1f5f9;
    padding: 0.1rem 0.35rem;
    border-radius: 0.25rem;
}

@media print {
    body { background: #fff !important; }
    nav, footer, .print\\:hidden, [data-modal], .modal-backdrop, form button,
    a[href="/dashboard.php"], .card-hover:hover { display: none !important; }
    .print-only { display: block !important; }
    main { max-width: 100% !important; padding: 0 !important; }
    #registre-diligence, .diligence-table { break-inside: avoid; }
    .reveal, .reveal-scale { opacity: 1 !important; transform: none !important; }
}
