/* ==========================================================================
   SRE Engine — common.css
   Styles de base sur les éléments HTML natifs + classes utilitaires.
   Dépend des variables CSS définies dans la feuille de style principale
   (:root { --color-*, --radius-*, --shadow-*, --font-sans, ... }).
   ========================================================================== */

/* --------------------------------------------------------------------------
   Typographie
   -------------------------------------------------------------------------- */

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.25;
    color: var(--color-text);
    margin-bottom: .5rem;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.15rem; }
h4 { font-size: 1rem; }
h5, h6 { font-size: 0.9rem; }

p {
    color: var(--color-text);
}

small {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

strong, b {
    font-weight: 700;
}

hr {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: 1.5rem 0;
}

blockquote {
    margin: 0 0 1rem;
    padding: 0.5rem 1rem;
    border-left: 3px solid var(--color-accent);
    background: var(--color-bg);
    color: var(--color-text-muted);
}

code, pre {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.85em;
}

code {
    padding: 0.15rem 0.4rem;
    border-radius: var(--radius-sm);
    background: var(--color-bg);
    color: var(--color-text);
}

pre {
    padding: 1rem;
    border-radius: var(--radius-md);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    overflow-x: auto;
}

pre code {
    padding: 0;
    background: none;
}

ol {
    margin: 0 0 1rem;
    padding-left: 1.25rem;
}

ol li, ul.plain li {
    margin-bottom: 0.35rem;
}

img, svg {
    max-width: 100%;
    display: block;
}

/* --------------------------------------------------------------------------
   Formulaires
   -------------------------------------------------------------------------- */

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

label .optional {
    font-weight: 400;
    color: var(--color-text-muted);
}

input,
select,
textarea {
    width: 100%;
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--color-text);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 0.55rem 0.75rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:hover,
select:hover,
textarea:hover {
    border-color: #d1d5db;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

input:disabled,
select:disabled,
textarea:disabled {
    background: var(--color-bg);
    color: var(--color-text-muted);
    cursor: not-allowed;
}

input.has-error,
select.has-error,
textarea.has-error {
    border-color: var(--color-danger);
}

input.has-error:focus,
select.has-error:focus,
textarea.has-error:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

textarea {
    resize: vertical;
    min-height: 6rem;
}

fieldset {
    border: none;
    padding: 0;
    margin: 0 0 1.25rem;
}

.form-group {
    margin-bottom: 1.1rem;
}

.form-hint {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.78rem;
    color: var(--color-text-muted);
}

.form-error {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.78rem;
    color: var(--color-danger);
}

.form-actions {
    display: flex;
    gap: 0.6rem;
    margin-top: 1.25rem;
}

/* --------------------------------------------------------------------------
   Tableaux
   -------------------------------------------------------------------------- */

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

thead th {
    text-align: left;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--color-text-muted);
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--color-border);
}

tbody td {
    padding: 0.7rem 0.75rem;
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text);
    vertical-align: middle;
}

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

tbody tr:hover {
    background: var(--color-bg);
}

table.table-compact th,
table.table-compact td {
    padding: 0.45rem 0.6rem;
}

/* --------------------------------------------------------------------------
   Variantes de badges (complètent .badge de la feuille principale)
   -------------------------------------------------------------------------- */

.badge-success {
    background: var(--color-success-bg);
    color: #166534;
}

.badge-danger {
    background: var(--color-danger-bg);
    color: #991b1b;
}

.badge-warning {
    background: var(--color-warning-bg);
    color: #92400e;
}

.badge-info {
    background: var(--color-info-bg);
    color: #1e40af;
}

/* --------------------------------------------------------------------------
   Utilitaires : espacement (marge/padding, échelle 0 à 6)
   -------------------------------------------------------------------------- */

.m-0 { margin: 0; }
.mt-1 { margin-top: 0.25rem; } .mt-2 { margin-top: 0.5rem; } .mt-3 { margin-top: 0.75rem; } .mt-4 { margin-top: 1rem; } .mt-6 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.25rem; } .mb-2 { margin-bottom: 0.5rem; } .mb-3 { margin-bottom: 0.75rem; } .mb-4 { margin-bottom: 1rem; } .mb-6 { margin-bottom: 1.5rem; }
.ml-1 { margin-left: 0.25rem; } .ml-2 { margin-left: 0.5rem; }
.mr-1 { margin-right: 0.25rem; } .mr-2 { margin-right: 0.5rem; }

.mi-auto { margin-inline: auto; }

.p-0 { padding: 0; }
.p-1 { padding: 0.25rem; } .p-2 { padding: 0.5rem; } .p-3 { padding: 0.75rem; } .p-4 { padding: 1rem; } .p-6 { padding: 1.5rem; }

/* --------------------------------------------------------------------------
   Utilitaires : flexbox
   -------------------------------------------------------------------------- */

.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }

.gap-1 { gap: 0.25rem; } .gap-2 { gap: 0.5rem; } .gap-3 { gap: 0.75rem; } .gap-4 { gap: 1rem; }

/* --------------------------------------------------------------------------
   Utilitaires : texte
   -------------------------------------------------------------------------- */

.text-muted { color: var(--color-text-muted); }
.text-danger { color: var(--color-danger); }
.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }
.text-accent { color: var(--color-accent); }

.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.85rem; }
.text-lg { font-size: 1.1rem; }

.font-bold { font-weight: 700; }
.font-medium { font-weight: 600; }
.font-normal { font-weight: 400; }

.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Utilitaires : layout & apparence
   -------------------------------------------------------------------------- */

.hidden { display: none; }
.block { display: block; }
.inline-block { display: inline-block; }

.w-full { width: 100%; }
.max-w-sm { max-width: 24rem; }
.max-w-md { max-width: 32rem; }
.max-w-lg { max-width: 48rem; }

.rounded-sm { border-radius: var(--radius-sm); }
.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }

.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }

.border { border: 1px solid var(--color-border); }
.border-t { border-top: 1px solid var(--color-border); }
.border-b { border-bottom: 1px solid var(--color-border); }

.bg-surface { background: var(--color-surface); }
.bg-muted { background: var(--color-bg); }

.circle {
    display: block;
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #000;
}
.circle.red {
    background: var(--color-danger);
}
.circle.green {
    background: var(--color-success);
}