/*
 * Archivio13 — design system condiviso (sito pubblico + backoffice).
 * Palette e componenti in stile creepypasta: sfondi quasi neri,
 * accenti rosso sangue, titoli con il font "Rock Salt".
 */

:root {
    --a13-bg: #0b0b0d;
    --a13-bg-elevated: #161516;
    --a13-bg-elevated-2: #1d1b1c;
    --a13-border: #2a2626;
    --a13-border-strong: #5c1f1c;
    --a13-text: #c9c5c0;
    --a13-text-muted: #8a8480;
    --a13-text-dim: #6e6a66;
    --a13-red: #b9312c;
    --a13-red-bright: #d93a2f;
    --a13-red-glow: rgba(217, 58, 47, 0.55);
    --a13-radius: 10px;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Cantarell', sans-serif;
    margin: 0;
    background: var(--a13-bg);
    background-image:
        radial-gradient(ellipse at top, rgba(90, 20, 18, 0.12), transparent 60%),
        radial-gradient(ellipse at bottom, rgba(0, 0, 0, 0.6), transparent 60%);
    background-attachment: fixed;
    color: var(--a13-text);
}

h1, h2, h3 {
    font-family: 'Rock Salt', cursive;
    font-weight: normal;
    color: var(--a13-red);
    text-shadow: 0 0 8px var(--a13-red-glow);
}

a {
    color: var(--a13-red-bright);
}

/* ---------------------------------------------------------------- */
/* Bottoni — l'elemento distintivo del progetto: angoli "strappati", */
/* bagliore rosso al passaggio del mouse.                            */
/* ---------------------------------------------------------------- */

.btn {
    display: inline-block;
    font-family: 'Cantarell', sans-serif;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-size: 0.78rem;
    line-height: 1;
    color: #e8c9c7;
    background: linear-gradient(160deg, #1a1a1c 0%, #2b0f0f 100%);
    border: 1px solid var(--a13-border-strong);
    padding: 0.6rem 1.1rem;
    margin: 0.15rem 0;
    cursor: pointer;
    text-decoration: none;
    clip-path: polygon(7px 0, 100% 0, 100% calc(100% - 7px), calc(100% - 7px) 100%, 0 100%, 0 7px);
    transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.btn:hover {
    color: #fff;
    border-color: var(--a13-red-bright);
    box-shadow: 0 0 14px var(--a13-red-glow), inset 0 0 10px rgba(217, 58, 47, 0.15);
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-danger {
    background: linear-gradient(160deg, #1a1a1c 0%, #3d0a0a 100%);
    border-color: #7a1f1a;
    color: #f3b8b3;
}

.btn-danger:hover {
    border-color: #ff3b30;
    box-shadow: 0 0 16px rgba(255, 59, 48, 0.65);
}

/* ---------------------------------------------------------------- */
/* Form                                                              */
/* ---------------------------------------------------------------- */

input[type=text], input[type=file], select, textarea {
    width: 100%;
    padding: 0.5rem;
    box-sizing: border-box;
    background: var(--a13-bg-elevated);
    border: 1px solid var(--a13-border);
    color: var(--a13-text);
    font-family: inherit;
    font-size: 1rem;
}

input[type=text]:focus, select:focus, textarea:focus, .wysiwyg-editor:focus {
    outline: none;
    border-color: var(--a13-red-bright);
    box-shadow: 0 0 8px var(--a13-red-glow);
}

.field {
    margin-bottom: 1.2rem;
}

.field label {
    display: block;
    font-weight: bold;
    margin-bottom: 0.35rem;
    color: var(--a13-text);
}

.field .hint {
    display: block;
    color: var(--a13-text-dim);
    font-size: 0.85rem;
    margin-top: 0.3rem;
}

/* ---------------------------------------------------------------- */
/* Messaggi flash                                                    */
/* ---------------------------------------------------------------- */

.flash-message {
    padding: 0.75rem 1rem;
    border-radius: 2px;
    margin-bottom: 1rem;
    border: 1px solid transparent;
}

.flash-message.success {
    background: rgba(46, 125, 50, 0.15);
    border-color: #2e7d32;
    color: #a5d6a7;
}

.flash-message.error {
    background: rgba(217, 58, 47, 0.12);
    border-color: var(--a13-border-strong);
    color: #f3b8b3;
    list-style-position: inside;
}

/* ---------------------------------------------------------------- */
/* Tabelle (backoffice)                                              */
/* ---------------------------------------------------------------- */

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

th, td {
    text-align: left;
    padding: 0.6rem 0.5rem;
    border-bottom: 1px solid var(--a13-border);
}

th {
    color: var(--a13-text-muted);
    text-transform: uppercase;
    font-size: 0.78rem;
    letter-spacing: 0.04em;
}

form.inline {
    display: inline-block;
    margin: 0 0.25rem 0.25rem 0;
}

.thumb {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border: 1px solid var(--a13-border);
}

/* ---------------------------------------------------------------- */
/* Editor WYSIWYG (formattazione di base per il testo degli articoli) */
/* ---------------------------------------------------------------- */

.wysiwyg-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-bottom: 0.4rem;
}

.wysiwyg-toolbar button {
    font-family: 'Cantarell', sans-serif;
    font-size: 0.9rem;
    min-width: 2.2rem;
    padding: 0.35rem 0.5rem;
    background: var(--a13-bg-elevated-2);
    color: var(--a13-text);
    border: 1px solid var(--a13-border);
    cursor: pointer;
}

.wysiwyg-toolbar button:hover {
    border-color: var(--a13-red-bright);
    color: #fff;
}

.wysiwyg-toolbar button.is-active {
    border-color: var(--a13-red-bright);
    background: rgba(217, 58, 47, 0.18);
    color: #fff;
}

.wysiwyg-editor {
    width: 100%;
    min-height: 220px;
    padding: 0.6rem;
    background: var(--a13-bg-elevated);
    border: 1px solid var(--a13-border);
    color: var(--a13-text);
    line-height: 1.6;
    overflow-y: auto;
}

.wysiwyg-editor p {
    margin: 0 0 1em;
}

.wysiwyg-editor ul, .wysiwyg-editor ol {
    margin: 0 0 1em;
    padding-left: 1.5em;
}

.current-image {
    display: block;
    max-width: 320px;
    max-height: 200px;
    object-fit: cover;
    border: 1px solid var(--a13-border);
    margin-bottom: 0.5rem;
}

.checkbox-field {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: normal;
}

.checkbox-field input {
    width: auto;
}
