/* ============================================================
   main.css — foglio di stile globale del portale UNIMORE
   Tutti gli stili del sito devono essere definiti qui.
   Non usare <style> nei template né attributi style="" inline.
   ============================================================ */

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

body {
    font-family: 'Segoe UI', Arial, Helvetica, sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    color: #333;
    background: #f0f2f5;
}

a { color: #003087; text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- Site header ------------------------------------------ */
.site-header {
    background: #003087;
    color: #fff;
    padding: 0 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,.25);
}
.header-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 56px;
    gap: 1rem;
}
.site-title { font-size: 1.05rem; font-weight: 600; color: #fff; }
.header-nav { display: flex; gap: 1.2rem; align-items: center; }
.header-nav a { color: #cdd9f5; font-size: .9rem; }
.header-nav a:hover { color: #fff; text-decoration: none; }

/* --- Main content ----------------------------------------- */
.main-content {
    max-width: 1100px;
    margin: 2rem auto;
    padding: 0 1rem;
}

/* --- Site footer ------------------------------------------ */
.site-footer {
    text-align: center;
    padding: 1.2rem;
    font-size: .85rem;
    color: #888;
    border-top: 1px solid #ddd;
    margin-top: 3rem;
    background: #fff;
}

/* --- Cards ------------------------------------------------ */
.card {
    background: #fff;
    border-radius: 6px;
    padding: 2rem;
    box-shadow: 0 1px 4px rgba(0,0,0,.1);
    margin-bottom: 1.5rem;
}
.card--narrow { max-width: 540px; margin-left: auto; margin-right: auto; }
.card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .75rem;
    margin-bottom: 1.25rem;
}
.card__title { font-size: 1.4rem; color: #003087; margin-bottom: 1rem; }
.card__header .card__title { margin-bottom: 0; }

/* --- Section title ---------------------------------------- */
.section-title {
    font-size: 1.1rem;
    color: #003087;
    margin: 1.5rem 0 .75rem;
    border-bottom: 1px solid #e0e4ef;
    padding-bottom: .3rem;
}

/* --- Alerts ----------------------------------------------- */
.messagelist { list-style: none; margin-bottom: 1.25rem; }
.message {
    padding: .75rem 1rem;
    border-radius: 4px;
    margin-bottom: .5rem;
    font-size: .95rem;
}
.message--success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.message--error   { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.message--warning { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; }
.message--info    { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }

.alert {
    padding: .85rem 1.1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    font-size: .95rem;
}
.alert--info    { background: #e8f4fd; color: #1a5276; border-left: 4px solid #3498db; }
.alert--warning { background: #fef9e7; color: #6e4c07; border-left: 4px solid #f39c12; }
.alert--danger  { background: #fdedec; color: #922b21; border-left: 4px solid #e74c3c; }

/* --- Buttons ---------------------------------------------- */
.btn {
    display: inline-block;
    padding: .5rem 1.2rem;
    border-radius: 4px;
    font-size: .95rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: opacity .15s;
    text-decoration: none;
    white-space: nowrap;
}
.btn:hover { opacity: .88; text-decoration: none; }
.btn--primary   { background: #003087; color: #fff; }
.btn--secondary { background: #6c757d; color: #fff; }
.btn--danger    { background: #c0392b; color: #fff; }
.btn--doc       { background: #1a6e35; color: #fff; }
.btn--google    { background: #db4437; color: #fff; }
.btn--small     { padding: .3rem .75rem; font-size: .85rem; }
.btn-link {
    background: none; border: none; cursor: pointer;
    color: #cdd9f5; font-size: .9rem; padding: 0;
}
.btn-link:hover { color: #fff; }

/* --- Inline form (for logout button) ---------------------- */
.inline-form { display: inline; }

/* --- Forms ------------------------------------------------ */
.field { margin-bottom: .9rem; }
.field label { display: block; font-weight: 600; margin-bottom: .3rem; font-size: .9rem; color: #555; }
.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field input[type="tel"],
.field select,
.field textarea {
    width: 100%;
    padding: .45rem .7rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: .95rem;
    transition: border-color .15s;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: #003087;
    box-shadow: 0 0 0 2px rgba(0,48,135,.15);
}
.field--small { max-width: 120px; }
.field-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.field-row .field { flex: 1; min-width: 140px; }
.field-error, .field-errors li {
    color: #c0392b; font-size: .85rem; display: block; margin-top: .2rem;
}
.field-errors { list-style: none; }
.field-help { color: #888; font-size: .82rem; margin-top: .2rem; }

/* Radio / checkbox inline */
.field ul { list-style: none; }
.field ul li label { display: inline; font-weight: normal; }

/* Fieldset */
.fieldset {
    border: 1px solid #e0e4ef;
    border-radius: 5px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.2rem;
}
.fieldset legend { font-weight: 600; color: #003087; padding: 0 .5rem; font-size: .95rem; }

/* --- Action row ------------------------------------------- */
.action-row {
    display: flex;
    gap: .75rem;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 1.5rem;
}

/* --- Data table ------------------------------------------- */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .95rem;
    margin-bottom: 1rem;
}
.data-table th, .data-table td {
    padding: .55rem .85rem;
    border: 1px solid #e0e4ef;
    vertical-align: top;
}
.data-table thead th {
    background: #eef1f8;
    font-weight: 600;
    color: #003087;
}
.data-table tbody tr:nth-child(even) { background: #f8f9fd; }
.data-table th { text-align: left; width: 30%; }

/* --- Badges ----------------------------------------------- */
.badge {
    display: inline-block;
    padding: .25em .7em;
    border-radius: 12px;
    font-size: .8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .03em;
}
.badge--b { background: #f0f2f5; color: #555; border: 1px solid #ccc; }
.badge--c { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; }
.badge--a { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.badge--r { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }

/* --- Actions cell ----------------------------------------- */
.actions-cell { white-space: nowrap; }
.actions-cell .btn { margin-right: .3rem; }

/* --- Formset ---------------------------------------------- */
.formset { display: flex; flex-direction: column; gap: 1.25rem; }
.formset__item {
    border: 1px solid #dde2f0;
    border-radius: 5px;
    padding: 1rem 1.25rem;
    background: #f8f9fd;
}
.formset__item-title { font-size: 1rem; color: #003087; margin-bottom: .75rem; }
.field--delete { margin-top: .5rem; }
.field--delete label { font-weight: normal; color: #c0392b; }

/* --- Doc links -------------------------------------------- */
.doc-links { display: flex; gap: .75rem; flex-wrap: wrap; margin-bottom: 1rem; }

/* --- Auth links ------------------------------------------- */
.auth-links { margin-top: 1rem; font-size: .9rem; text-align: center; }
.social-login { margin-top: 1.5rem; text-align: center; }
.social-login p { margin-bottom: .5rem; color: #666; font-size: .9rem; }

/* --- Empty state ------------------------------------------ */
.empty-state { color: #888; font-style: italic; padding: 1rem 0; }

/* --- Filter bar ------------------------------------------- */
.filter-bar {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
    padding: .75rem 1rem;
    background: #f0f2f5;
    border-radius: 4px;
    font-size: .9rem;
}
.filter-bar select {
    padding: .35rem .6rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: .9rem;
}
