:root {
    color-scheme: light;

    --color-bg: #f4f5f7;
    --color-surface: #ffffff;
    --color-border: #e2e4e9;
    --color-text: #1f2430;
    --color-text-muted: #6b7280;
    --color-primary: #3b5bdb;
    --color-primary-hover: #2f4bc4;
    --color-primary-contrast: #ffffff;
    --color-danger: #d6336c;
    --color-success: #2f9e44;

    --radius-sm: 6px;
    --radius-md: 10px;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
    --shadow-md: 0 4px 14px rgba(16, 24, 40, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background-color: var(--color-bg);
    color: var(--color-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.5;
}

h1, h2, h3 {
    font-weight: 700;
    line-height: 1.25;
}

h1 {
    font-size: 1.75rem;
    margin: 0 0 1.25rem;
}

h2 {
    font-size: 1.25rem;
    margin: 2rem 0 1rem;
}

a {
    color: var(--color-primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Layout */

body > header {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 10;
}

body > header nav {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0.9rem 1.5rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.25rem;
}

body > header nav a {
    color: var(--color-text-muted);
    font-weight: 500;
    font-size: 0.925rem;
}

body > header nav a:first-child {
    color: var(--color-text);
    font-weight: 700;
    font-size: 1.05rem;
    margin-right: auto;
}

body > header nav a:hover {
    color: var(--color-primary);
    text-decoration: none;
}

main, body > h1, body > h2, body > form, body > dl, body > table, body > ul, body > nav, body > p {
    max-width: 1080px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

body > h1 {
    padding-top: 2rem;
}

/* Plain lists (not part of a dedicated component like .catalogue-list) */

ul:not([class]) {
    padding-left: 1.75rem;
    margin: 0 0 1.5rem;
}

ul:not([class]) li {
    margin-bottom: 0.75rem;
}

ul:not([class]) li p {
    margin: 0.35rem 0 0;
    color: var(--color-text-muted);
}

/* Flash messages */

.flash {
    max-width: 1080px;
    margin: 1.5rem auto 0;
    padding: 0.8rem 1.1rem;
    border-radius: var(--radius-sm);
    font-size: 0.925rem;
    font-weight: 500;
}

.flash-success {
    background: #ebfbee;
    color: var(--color-success);
    border: 1px solid #b2f2bb;
}

.flash-error {
    background: #fff0f6;
    color: var(--color-danger);
    border: 1px solid #fcc2d7;
}

/* Forms */

form {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    max-width: 480px;
}

form > div {
    margin-bottom: 1.1rem;
}

label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
    color: var(--color-text);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
select,
textarea {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 0.925rem;
    font-family: inherit;
}

input:focus, select:focus, textarea:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 1px;
}

button, input[type="submit"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--color-primary);
    color: var(--color-primary-contrast);
    font-size: 0.925rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

button:hover, input[type="submit"]:hover {
    background: var(--color-primary-hover);
}

.catalogue-filters button,
table form button {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

/* Tables */

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
}

th, td {
    text-align: left;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--color-border);
    font-size: 0.925rem;
}

th {
    background: #f8f9fb;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.03em;
}

tr:last-child td {
    border-bottom: none;
}

table form {
    background: none;
    border: none;
    box-shadow: none;
    padding: 0;
    margin: 0;
    display: inline-flex;
    gap: 0.4rem;
}

/* Definition lists (profil, admin, media detail) */

dl {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

dl > div {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

dt {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--color-text-muted);
    font-weight: 600;
}

dd {
    margin: 0;
    font-size: 0.975rem;
}

/* Badges */

.badge {
    display: inline-block;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: #e9ecef;
    color: var(--color-text-muted);
}

.badge-en-cours, .badge-en-attente {
    background: #fff3bf;
    color: #997404;
}

.badge-en-retard {
    background: #ffe3e3;
    color: #c92a2a;
}

.badge-termine, .badge-confirmee {
    background: #ebfbee;
    color: var(--color-success);
}

.badge-annulee {
    background: #f1f3f5;
    color: var(--color-text-muted);
}

/* Catalogue */

.catalogue-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    max-width: 1080px;
    margin: 2rem auto 1rem;
    padding: 0 1.5rem;
}

.catalogue-header h1 {
    margin: 0;
    padding: 0;
}

.catalogue-filters {
    max-width: 1080px;
    margin: 0 auto 1.5rem;
    padding: 1.25rem 1.5rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: flex-end;
}

.catalogue-list {
    max-width: 1080px;
    margin: 0 auto 2rem;
    padding: 0 1.5rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.25rem;
    list-style: none;
}

.catalogue-item {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    padding: 1.25rem 1.5rem 1.5rem;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.catalogue-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.catalogue-item h2 {
    margin: 0 0 0.6rem;
    font-size: 1.1rem;
}

.catalogue-item > p {
    margin: 0 0 1rem;
    color: var(--color-text-muted);
}

.catalogue-item dl {
    background: none;
    border: none;
    box-shadow: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.media-detail, .media-form-page {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    max-width: 1080px;
    margin: 2rem auto;
    padding: 1.5rem;
}
