/* ================================================================
   style.css — Générateur de Factures Meta
   Design premium, dark glassmorphism
   ================================================================ */

/* ── Variables ── */
:root {
    --meta-blue:     #0866FF;
    --meta-blue-rgb: 8, 102, 255;
    --meta-dark:     #1C1E21;
    --meta-gray:     #65676B;
    --meta-divider:  #E4E4E4;

    --bg-base:       #08090d;
    --bg-card:       rgba(16, 18, 27, 0.85);
    --bg-card-border:rgba(255,255,255,0.08);
    --bg-input:      rgba(255,255,255,0.04);
    --bg-input-focus:rgba(8, 102, 255, 0.08);

    --text-primary:  #F0F2F5;
    --text-secondary:#9AA3BF;
    --text-muted:    #5C6682;

    --radius-sm:  8px;
    --radius-md:  14px;
    --radius-lg:  22px;

    --shadow-card: 0 24px 72px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.06);
    --shadow-btn:  0 8px 32px rgba(8,102,255,0.4);

    --transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    overflow-x: hidden;
    position: relative;
}

/* ── Animated background orbs ── */
.bg-orbs {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.25;
    animation: orb-drift 18s ease-in-out infinite;
}

.orb-1 {
    width: 600px; height: 600px;
    background: radial-gradient(circle, #0866FF 0%, transparent 70%);
    top: -200px; left: -150px;
    animation-delay: 0s;
}

.orb-2 {
    width: 480px; height: 480px;
    background: radial-gradient(circle, #6B00FF 0%, transparent 70%);
    bottom: -180px; right: -100px;
    animation-delay: -6s;
}

.orb-3 {
    width: 350px; height: 350px;
    background: radial-gradient(circle, #00C8FF 0%, transparent 70%);
    top: 50%; left: 55%;
    animation-delay: -12s;
    opacity: 0.12;
}

@keyframes orb-drift {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33%       { transform: translate(30px, -40px) scale(1.08); }
    66%       { transform: translate(-20px, 25px) scale(0.95); }
}

/* ── App wrapper ── */
.app-wrapper {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 820px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ── Header ── */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 26px;
    background: var(--bg-card);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: var(--shadow-card);
}

.logo-group {
    display: flex;
    align-items: center;
    gap: 14px;
}

.meta-logo-wrap {
    width: 44px; height: 44px;
    background: rgba(8, 102, 255, 0.12);
    border: 1px solid rgba(8, 102, 255, 0.3);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.app-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
    line-height: 1.2;
}

.brand-meta {
    background: linear-gradient(135deg, #0866FF, #00C8FF);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.app-subtitle {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 2px;
    font-weight: 400;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.header-badge {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.72rem;
    color: var(--text-muted);
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 100px;
    padding: 5px 13px;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.badge-dot {
    width: 6px; height: 6px;
    background: #3ADA75;
    border-radius: 50%;
    box-shadow: 0 0 8px #3ADA75;
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.6; transform: scale(0.85); }
}

/* ── Main card ── */
.main-card {
    background: var(--bg-card);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: var(--shadow-card);
    padding: 32px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* ── Info banner ── */
.info-banner {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    background: rgba(8, 102, 255, 0.08);
    border: 1px solid rgba(8, 102, 255, 0.2);
    border-radius: var(--radius-md);
    padding: 14px 16px;
}

.info-icon {
    color: var(--meta-blue);
    flex-shrink: 0;
    margin-top: 1px;
}

.info-text {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.info-text strong { color: var(--text-primary); font-weight: 600; }
.info-text em { color: var(--meta-blue); font-style: normal; font-weight: 500; }

/* ── Field group ── */
.field-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.field-label {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.field-label svg { color: var(--meta-blue); }

/* ── Textarea ── */
.textarea-wrap {
    position: relative;
}

.raw-textarea {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: 'Inter', monospace;
    font-size: 0.82rem;
    line-height: 1.65;
    padding: 16px 18px 40px;
    resize: vertical;
    transition: var(--transition);
    outline: none;
}

.raw-textarea::placeholder {
    color: var(--text-muted);
    font-size: 0.78rem;
    line-height: 1.7;
}

.raw-textarea:focus {
    border-color: rgba(var(--meta-blue-rgb), 0.5);
    background: var(--bg-input-focus);
    box-shadow: 0 0 0 3px rgba(var(--meta-blue-rgb), 0.12);
}

.char-counter {
    position: absolute;
    bottom: 12px;
    right: 14px;
    font-size: 0.7rem;
    color: var(--text-muted);
    transition: var(--transition);
    pointer-events: none;
}

.char-counter.active { color: var(--meta-blue); }

/* ── Preview section ── */
.preview-section {
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: var(--radius-md);
    padding: 20px;
    animation: fade-in 0.3s ease;
}

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

.preview-title {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #3ADA75;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.preview-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.preview-item {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    transition: var(--transition);
}

.preview-item.found {
    border-color: rgba(58, 218, 117, 0.25);
    background: rgba(58, 218, 117, 0.04);
}

.preview-item.not-found {
    border-color: rgba(255, 90, 90, 0.2);
    background: rgba(255, 90, 90, 0.03);
}

.preview-key {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
}

.preview-value {
    font-size: 0.8rem;
    color: var(--text-primary);
    font-weight: 500;
    word-break: break-all;
}

.preview-item.not-found .preview-value { color: rgba(255, 90, 90, 0.7); }

/* ── Action buttons ── */
.actions-row {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
}

/* Base button */
button {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    white-space: nowrap;
}

/* Secondary */
.btn-secondary {
    padding: 10px 18px;
    font-size: 0.82rem;
    background: rgba(255,255,255,0.06);
    color: var(--text-secondary);
    border: 1px solid rgba(255,255,255,0.08);
}

.btn-secondary:hover {
    background: rgba(255,255,255,0.1);
    color: var(--text-primary);
    border-color: rgba(255,255,255,0.14);
    transform: translateY(-1px);
}

/* Primary — Generate button */
.btn-primary {
    padding: 13px 26px;
    font-size: 0.88rem;
    background: linear-gradient(135deg, #0866FF, #0053D4);
    color: #fff;
    box-shadow: var(--shadow-btn);
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #1870FF, #0060F0);
    box-shadow: 0 12px 40px rgba(8,102,255,0.55);
    transform: translateY(-2px);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: var(--shadow-btn);
}

.btn-primary.loading {
    opacity: 0.8;
    pointer-events: none;
    cursor: wait;
}

/* Spin animation */
.spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ── Footer ── */
.app-footer {
    text-align: center;
    font-size: 0.72rem;
    color: var(--text-muted);
    padding: 8px 0 4px;
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.footer-sep { color: var(--text-muted); opacity: 0.4; }

/* ── Responsive ── */
@media (max-width: 580px) {
    .main-card { padding: 20px 16px; }
    .preview-grid { grid-template-columns: 1fr; }
    .app-header { flex-direction: column; gap: 12px; align-items: flex-start; }
    .actions-row { flex-direction: column; align-items: stretch; }
    .btn-primary, .btn-secondary { justify-content: center; }
    .app-title { font-size: 0.95rem; }
}
