/* =========================================================
   CheckJDF — Thème Violet/Indigo Premium
   ========================================================= */

:root {
    --bg:            #0e0e16;
    --surface:       #1a1a2c;
    --card:          #22223a;
    --border:        #2e2e4a;
    --border-light:  rgba(255, 255, 255, 0.06);

    --primary:       #7c4dff;
    --primary-dark:  #5c35cc;
    --primary-light: #b47dff;
    --primary-glow:  rgba(124, 77, 255, 0.22);

    --accent:        #00d4ff;
    --accent-glow:   rgba(0, 212, 255, 0.2);

    --success:       #4fd47d;
    --success-glow:  rgba(79, 212, 125, 0.3);
    --warning:       #ffb74d;
    --danger:        #ff5370;

    --text:          #eeeef8;
    --text-muted:    #8888b0;

    --radius:        12px;
    --radius-sm:     8px;
    --radius-pill:   50px;
    --shadow:        0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg:     0 8px 40px rgba(0, 0, 0, 0.6);
    --transition:    0.2s ease;
}

/* === RESET === */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* === BASE === */
body {
    background-color: var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    font-size: 15px;
}

/* === HEADER === */
header {
    padding: 0.875rem 1.25rem;
    background: linear-gradient(135deg, var(--surface) 0%, var(--card) 100%);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.5);
    flex-shrink: 0;
    position: relative;
}

header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--primary), var(--accent), transparent);
    opacity: 0.5;
}

header h1 {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* === MAIN === */
main {
    flex: 1;
    padding: 1.25rem;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

main::-webkit-scrollbar { width: 4px; }
main::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* === VIEWS === */
.view {
    display: none;
    max-width: 560px;
    margin: 0 auto;
}

.view.active {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
    animation: viewIn 0.22s ease;
}

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

/* === TITRES === */
h2 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--text) 30%, var(--primary-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

h3 {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.1rem;
}

/* === INPUTS === */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

input {
    background-color: var(--surface);
    border: 1.5px solid var(--border);
    color: var(--text);
    padding: 0.7rem 0.9rem;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    width: 100%;
    transition: border-color var(--transition), box-shadow var(--transition);
}

input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

input::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
    font-size: 0.9rem;
}

/* === BOUTONS === */
button {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    border: none;
    padding: 0.72rem 1.2rem;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    letter-spacing: 0.3px;
    transition: box-shadow var(--transition), opacity var(--transition), transform 0.1s;
    white-space: nowrap;
}

button:hover {
    opacity: 0.93;
    box-shadow: 0 4px 18px var(--primary-glow);
}

button:active {
    transform: scale(0.97);
}

button.secondary {
    background: transparent;
    color: var(--primary-light);
    border: 1.5px solid var(--primary);
    box-shadow: none;
}

button.secondary:hover {
    background: var(--primary-glow);
    box-shadow: none;
}

/* Boutons header — discrets */
#logout-btn {
    background: transparent;
    color: var(--danger);
    border: 1.5px solid rgba(255, 83, 112, 0.5);
    padding: 0.4rem 0.75rem;
    font-size: 0.82rem;
    box-shadow: none;
}
#logout-btn:hover {
    background: rgba(255, 83, 112, 0.1);
    border-color: var(--danger);
    box-shadow: none;
}

#header-export-btn {
    background: transparent;
    border: none;
    font-size: 1.15rem;
    padding: 0.35rem 0.45rem;
    color: var(--accent);
    box-shadow: none;
    line-height: 1;
}
#header-export-btn:hover { opacity: 0.75; box-shadow: none; }

#settings-btn {
    background: transparent;
    border: none;
    font-size: 1.1rem;
    padding: 0.35rem 0.45rem;
    color: var(--text-muted);
    box-shadow: none;
    line-height: 1;
}
#settings-btn:hover { color: var(--text); opacity: 1; box-shadow: none; }

/* === CARTES === */
.card {
    background: linear-gradient(145deg, var(--surface), var(--card));
    padding: 1.1rem 1.15rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

/* === ROW === */
.row {
    display: flex;
    gap: 0.55rem;
    align-items: stretch;
}
.row input { flex: 1; }

/* === AUTH / SETUP === */
#auth-view {
    justify-content: center;
    height: 100%;
    text-align: center;
}

#auth-view .input-group,
#setup-view .input-group {
    background: linear-gradient(145deg, var(--surface), var(--card));
    padding: 1.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow), 0 0 40px var(--primary-glow);
}

#biometric-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
}

#biometric-container p {
    color: var(--text-muted);
    font-size: 0.85rem;
}

#biometric-btn {
    background: transparent;
    border: 1.5px solid var(--primary);
    color: var(--primary-light);
    padding: 0.6rem 1.4rem;
    font-size: 0.9rem;
}
#biometric-btn:hover { background: var(--primary-glow); }

/* === STATUT AJOUT === */
#add-status {
    font-size: 0.85rem;
    min-height: 1.1em;
    transition: color var(--transition);
}
#add-status.success { color: var(--success); }

/* === LISTE RÉCENTE === */
.recent-list {
    margin-top: 0.75rem;
    border-top: 1px solid var(--border);
    padding-top: 0.75rem;
}

.recent-list > strong {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 0.4rem;
}

.recent-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.35rem 0;
    border-bottom: 1px solid var(--border-light);
    color: var(--text);
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}
.recent-item:last-child { border-bottom: none; }

.delete-btn {
    background: transparent;
    color: var(--danger);
    border: none;
    padding: 2px 8px;
    font-size: 0.9rem;
    box-shadow: none;
    opacity: 0.6;
}
.delete-btn:hover { opacity: 1; background: rgba(255, 83, 112, 0.12); box-shadow: none; transform: none; }

/* === MODAL === */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(6px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    width: 90%;
    max-width: 370px;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    background: linear-gradient(145deg, #1f1f38, #282843);
    border: 1px solid var(--border);
    padding: 1.6rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg), 0 0 0 1px rgba(124, 77, 255, 0.18);
    animation: modalIn 0.2s ease;
}

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

.modal-content h3 { font-size: 1.05rem; color: var(--text); -webkit-text-fill-color: var(--text); }

/* === RÉSULTATS D'ANALYSE === */
.result-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1rem 1.1rem;
    margin-bottom: 0.8rem;
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.22);
    animation: viewIn 0.18s ease;
}

.dataset-title {
    font-size: 0.75rem;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    font-weight: 700;
    margin-bottom: 0.6rem;
}

.match-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-light);
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    gap: 0.5rem;
}
.match-item:last-child { border-bottom: none; }

.match-date {
    color: var(--text-muted);
    font-size: 0.82rem;
}

/* Badges par score */
.tag {
    display: inline-flex;
    align-items: center;
    font-size: 0.73rem;
    font-weight: 700;
    padding: 2px 9px;
    border-radius: var(--radius-pill);
    font-family: 'Segoe UI', sans-serif;
    white-space: nowrap;
    background: var(--border);
    color: var(--text-muted);
    border: 1px solid transparent;
}

.match-item.count-3 .tag {
    background: rgba(255, 183, 77, 0.15);
    color: var(--warning);
    border-color: rgba(255, 183, 77, 0.4);
}

.match-item.count-4 .tag {
    background: rgba(255, 112, 67, 0.15);
    color: #ff7043;
    border-color: rgba(255, 112, 67, 0.4);
}

.match-item.count-5 .tag,
.tag.exact {
    background: linear-gradient(135deg, var(--success), #2ecc71);
    color: #062012;
    border-color: transparent;
    box-shadow: 0 0 12px var(--success-glow);
}

/* === PARAMÈTRES === */
#back-to-main-btn {
    align-self: flex-start;
    font-size: 0.85rem;
    padding: 0.4rem 0.9rem;
}

/* === UTILITAIRES === */
.hidden { display: none !important; }

.error {
    color: var(--danger);
    font-size: 0.875rem;
    min-height: 1.1em;
}

.text-secondary {
    color: var(--text-muted);
    font-size: 0.875rem;
    line-height: 1.5;
}
