/* style.css - Générateur d'Acronymes - Thomas Dufranne */

:root {
    --color-primary:      #1e293b;
    --color-accent:       #4f46e5;
    --color-accent-hover: #4338ca;
    --color-bg-page:      #f8fafc;
    --color-card:         #ffffff;
    --color-text-body:    #475569;
    --color-text-muted:   #94a3b8;
    --color-border:       #e2e8f0;
    --color-border-focus: #4f46e5;
    --shadow-sm:   0 1px 3px 0 rgb(0 0 0 / 0.06), 0 1px 2px -1px rgb(0 0 0 / 0.04);
    --shadow-card: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --radius-sm: 8px;
    --radius-md: 12px;
    --transition: 0.2s ease-in-out;
}

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

body {
    font-family: "Inter", system-ui, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    background: var(--color-bg-page);
    color: var(--color-primary);
}

/* ---- layout ---- */

.wrapper {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1.25rem 4rem;
}

/* ---- header ---- */

.site-header {
    text-align: center;
    margin-bottom: 2.5rem;
    padding-top: 1.5rem;
}

.badge-ai {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #eef2ff;
    color: #4f46e5;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    padding: 3px 10px;
    border-radius: 99px;
    margin-bottom: 0.9rem;
}

.badge-ai::before {
    content: "";
    display: block;
    width: 6px;
    height: 6px;
    background: #4f46e5;
    border-radius: 50%;
}

.site-header h1 {
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: 700;
    color: var(--color-primary);
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
}

.site-header p {
    font-size: 0.95rem;
    color: var(--color-text-body);
    max-width: 480px;
    margin: 0 auto;
    line-height: 1.6;
}

/* ---- carte de saisie ---- */

.input-card {
    background: var(--color-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.input-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--color-primary);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 0.6rem;
}

textarea {
    width: 100%;
    min-height: 110px;
    resize: vertical;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 0.85rem 1rem;
    font-family: inherit;
    font-size: 0.92rem;
    color: var(--color-primary);
    line-height: 1.6;
    background: #fafbfc;
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}

textarea::placeholder {
    color: var(--color-text-muted);
}

textarea:focus {
    border-color: var(--color-border-focus);
    background: #fff;
    box-shadow: 0 0 0 3px rgb(79 70 229 / 0.12);
}

.input-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1rem;
    gap: 12px;
    flex-wrap: wrap;
}

.char-hint {
    font-size: 0.78rem;
    color: var(--color-text-muted);
}

/* bouton principal */

.btn-generate {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: var(--color-accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.65rem 1.3rem;
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background var(--transition), transform var(--transition), opacity var(--transition);
}

.btn-generate svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

.btn-generate:hover:not(:disabled) {
    background: var(--color-accent-hover);
    transform: translateY(-1px);
}

.btn-generate:active:not(:disabled) {
    transform: translateY(0);
}

.btn-generate:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* spinner */

.spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgb(255 255 255 / 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    flex-shrink: 0;
}

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

/* ---- erreur ---- */

.error-box {
    background: #fff0f4;
    border: 1px solid #fecdd3;
    border-radius: var(--radius-sm);
    padding: 0.8rem 1rem;
    font-size: 0.85rem;
    color: #be123c;
    margin-bottom: 1.5rem;
}

/* ---- en-tête résultats ---- */

.results-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 1.25rem;
}

.results-header h2 {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--color-text-muted);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.results-count {
    background: #eef2ff;
    color: var(--color-accent);
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 99px;
}

/* ---- liste de cartes ---- */

.cards-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2.5rem;
}

/* ---- carte acronyme ---- */

.acro-card {
    background: var(--color-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-card);
    padding: 1.25rem 1.4rem;
    animation: slideIn 0.3s ease-out both;
}

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

.card-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 0.7rem;
}

.card-badge {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #eef2ff;
    color: var(--color-accent);
    font-size: 0.72rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
}

.card-titles {
    flex: 1;
    min-width: 0;
}

.card-name {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--color-primary);
    letter-spacing: 0.02em;
    line-height: 1.2;
}

.card-meaning {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--color-accent);
    margin-top: 3px;
    line-height: 1.4;
}

.card-description {
    font-size: 0.88rem;
    color: var(--color-text-body);
    line-height: 1.65;
    padding-left: 38px;
    margin-bottom: 1rem;
}

.card-footer {
    display: flex;
    justify-content: flex-end;
}

.btn-copy {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: transparent;
    border: 1.5px solid var(--color-accent);
    color: var(--color-accent);
    border-radius: 6px;
    padding: 5px 12px;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.btn-copy svg {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
}

.btn-copy:hover {
    background: #eef2ff;
}

.btn-copy.copied {
    border-color: #16a34a;
    color: #16a34a;
    background: #f0fdf4;
}

/* ---- état vide ---- */

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--color-text-muted);
}

.empty-state svg {
    display: block;
    margin: 0 auto 1rem;
    opacity: 0.4;
}

.empty-state p {
    font-size: 0.88rem;
    line-height: 1.7;
}

/* ---- historique ---- */

#history-section {
    border-top: 1px solid var(--color-border);
    padding-top: 2rem;
    margin-top: 1rem;
}

.history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    gap: 12px;
}

.history-header h2 {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--color-text-muted);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.btn-clear {
    background: none;
    border: 1.5px solid var(--color-border);
    border-radius: 6px;
    padding: 4px 12px;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--color-text-muted);
    cursor: pointer;
    transition: border-color var(--transition), color var(--transition);
}

.btn-clear:hover {
    border-color: #be123c;
    color: #be123c;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.history-entry {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
}

.history-entry-meta {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-bottom: 6px;
}

.history-entry-description {
    font-size: 0.85rem;
    color: var(--color-text-body);
    font-style: italic;
    margin-bottom: 10px;
    border-left: 3px solid var(--color-border);
    padding-left: 10px;
    border-radius: 0;
}

.history-acronyms {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.history-tag {
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    border-radius: 4px;
    padding: 2px 9px;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--color-accent);
}

/* ---- desktop 1000px ---- */

@media (min-width: 1000px) {
    .wrapper {
        padding: 3rem 1.5rem 5rem;
    }

    .input-card {
        padding: 2rem;
    }

    .acro-card {
        padding: 1.5rem 1.75rem;
    }

    .card-description {
        padding-left: 38px;
    }
}
