/* ============================================================
   Medico e Bambino - Stylesheet
   Rivista di formazione e aggiornamento pediatrico
   Fondata nel 1982
   ============================================================ */

/* Google Fonts loaded via <link> in layout */

:root {
    --meb-red: #C41018;
    --meb-red-light: #ED1C23;
    --meb-red-dark: #9B0D14;
    --meb-green: #019534;
    --meb-green-dark: #017a2b;
    --meb-navy: #1a2332;
    --meb-gray-900: #212529;
    --meb-gray-700: #495057;
    --meb-gray-500: #6c757d;
    --meb-gray-300: #ced4da;
    --meb-gray-100: #f4f5f7;
    --meb-border: #e0e0e0;
    --meb-serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
    --meb-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ---- BASE ---- */
body {
    font-family: var(--meb-sans);
    color: var(--meb-gray-900);
    background: #fff;
    font-size: 15px;
    line-height: 1.6;
}

a { color: var(--meb-red); }
a:hover { color: var(--meb-red-dark); }

/* ---- MASTHEAD ---- */
.meb-masthead {
    border-bottom: 3px solid var(--meb-red);
}

.meb-masthead-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.meb-logo img { height: 50px; }

.meb-tagline {
    font-family: var(--meb-serif);
    font-size: 13px;
    color: var(--meb-gray-500);
    line-height: 1.5;
}

.meb-tagline a {
    color: var(--meb-gray-700);
    font-weight: 600;
    text-decoration: none;
}

/* ---- USER BAR ---- */
.meb-userbar {
    background: var(--meb-red);
    font-size: 13px;
}

.meb-userbar-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    min-height: 32px;
    gap: 2px;
    flex-wrap: wrap;
}

.meb-userbar a {
    color: rgba(255,255,255,.9) !important;
    text-decoration: none;
    padding: 5px 10px;
}

.meb-userbar a:hover {
    background: rgba(0,0,0,.15);
    color: #fff !important;
}

.meb-username {
    font-weight: 700;
    font-size: 14px;
}

/* ---- LOGIN PANEL ---- */
.meb-login-panel {
    background: var(--meb-navy);
    padding: 20px;
    display: none;
}

.meb-login-panel.show { display: block; }

.meb-login-panel label {
    color: rgba(255,255,255,.6);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.meb-login-panel input[type="text"],
.meb-login-panel input[type="password"] {
    background: rgba(255,255,255,.1);
    border: 1px solid rgba(255,255,255,.2);
    color: #fff;
    border-radius: 4px;
    padding: 6px 12px;
    width: 100%;
}

.meb-login-panel input:focus {
    background: rgba(255,255,255,.15);
    border-color: var(--meb-red-light);
    outline: none;
}

/* ---- NAVIGATION ---- */
.meb-nav {
    background: var(--meb-gray-100);
    border-bottom: 1px solid var(--meb-border);
    font-size: 14px;
}

.meb-nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 40px;
    flex-wrap: wrap;
    gap: 8px;
}

.meb-nav-links {
    display: flex;
    gap: 2px;
    flex-wrap: wrap;
}

.meb-nav-links a {
    color: var(--meb-gray-700);
    text-decoration: none;
    padding: 7px 12px;
    font-weight: 500;
    border-radius: 4px;
}

.meb-nav-links a:hover {
    background: var(--meb-red);
    color: #fff;
}

.meb-search {
    display: flex;
    gap: 6px;
}

.meb-search input[type="search"] {
    border: 1px solid var(--meb-gray-300);
    border-radius: 18px;
    padding: 4px 14px;
    font-size: 13px;
    width: 180px;
    outline: none;
}

.meb-search input[type="search"]:focus {
    border-color: var(--meb-red);
}

.meb-search button {
    background: var(--meb-red);
    color: #fff;
    border: none;
    border-radius: 18px;
    padding: 4px 16px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}

.meb-search button:hover {
    background: var(--meb-red-dark);
}

/* ---- MAIN CONTAINER ---- */
.meb-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 16px;
}

/* ---- SECTION HEADERS ---- */
.meb-section-header {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding-bottom: 8px;
    margin-bottom: 16px;
    border-bottom: 2px solid var(--meb-red);
}

.meb-section-header.el {
    border-color: var(--meb-green);
}

.meb-section-header h2 {
    font-family: var(--meb-serif);
    font-size: 22px;
    font-weight: 700;
    margin: 0;
}

.meb-section-header h2 a {
    color: var(--meb-red);
    text-decoration: none;
}

.meb-section-header.el h2 a {
    color: var(--meb-green);
}

.meb-issue-date {
    font-size: 14px;
    color: var(--meb-gray-500);
    font-style: italic;
}

/* ---- HERO ---- */
.meb-hero {
    background: var(--meb-gray-100);
    border-radius: 6px;
    overflow: hidden;
}

.meb-hero-cover {
    width: 100%;
    height: auto;
    display: block;
}

.meb-hero-sfo {
    background: var(--meb-red);
    text-align: center;
    padding: 8px;
}

.meb-hero-sfo a {
    color: #fff;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
}

.meb-hero-sfo a:hover {
    text-decoration: underline;
    color: #fff;
}

.meb-hero-content {
    padding: 24px 28px;
}

.meb-hero-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--meb-red);
    margin-bottom: 12px;
}

.meb-hero-title {
    font-family: var(--meb-serif);
    font-size: 26px;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 8px;
}

.meb-hero-title a {
    color: var(--meb-gray-900);
    text-decoration: none;
}

.meb-hero-title a:hover {
    color: var(--meb-red);
}

.meb-hero-excerpt {
    font-size: 15px;
    color: var(--meb-gray-700);
    line-height: 1.5;
    margin-top: 8px;
}

.meb-hero-img {
    max-width: 200px;
    height: auto;
    float: right;
    margin: 0 0 8px 16px;
    border-radius: 4px;
}

/* ---- ARTICLE CARDS (grid) ---- */
.meb-card {
    height: 100%;
    border-radius: 6px;
    overflow: hidden;
    transition: box-shadow .2s;
    background: #fff;
    border: 1px solid var(--meb-border);
}

.meb-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,.1);
}

.meb-card.meb-free {
    border-left: 4px solid var(--meb-green);
}

.meb-card-img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    display: block;
}

.meb-card-body {
    padding: 12px 14px;
}

.meb-card h4 {
    font-family: var(--meb-serif);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
    margin: 0 0 4px;
}

.meb-card h4 a {
    color: var(--meb-gray-900);
    text-decoration: none;
}

.meb-card h4 a:hover {
    color: var(--meb-red);
}

/* Legacy article style (for non-homepage views) */
.meb-article {
    padding: 14px 0;
    border-bottom: 1px solid var(--meb-border);
    overflow: hidden;
}

.meb-article:last-child {
    border-bottom: none;
}

.meb-article-img {
    float: right;
    margin: 0 0 8px 14px;
    max-width: 130px;
}

.meb-article-img img {
    width: 100%;
    height: auto;
    border-radius: 3px;
}

.meb-categoria {
    font-family: var(--meb-sans);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .7px;
    color: var(--meb-red);
    margin-bottom: 3px;
}

/* Free article badge */
.meb-free-badge {
    display: inline-block;
    background: #e8f5e9;
    color: var(--meb-green-dark);
    font-family: var(--meb-sans);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    padding: 2px 7px;
    border-radius: 3px;
    margin-left: 6px;
    vertical-align: middle;
}

.meb-article.meb-free,
.meb-el-article.meb-free {
    border-left: 3px solid var(--meb-green);
    padding-left: 12px;
}

.meb-article h4 {
    font-family: var(--meb-serif);
    font-size: 16px;
    font-weight: 600;
    line-height: 1.35;
    margin: 0 0 4px;
}

.meb-article-featured h4 {
    font-size: 19px;
}

.meb-article h4 a {
    color: var(--meb-gray-900);
    text-decoration: none;
}

.meb-article h4 a:hover {
    color: var(--meb-red);
}

.meb-autore {
    font-size: 13px;
    color: var(--meb-gray-500);
    font-style: italic;
    margin-bottom: 2px;
}

.meb-note {
    font-size: 13px;
    color: var(--meb-gray-700);
    line-height: 1.5;
}

/* ---- EL ARTICLES ---- */
.meb-el-column {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .7px;
    color: var(--meb-green);
    padding: 10px 0 4px;
    margin-top: 6px;
    border-bottom: 1px solid #c8e6c9;
}

.meb-el-article {
    padding: 8px 0;
    border-bottom: 1px solid var(--meb-gray-100);
}

.meb-el-article h5 {
    font-family: var(--meb-serif);
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 2px;
    line-height: 1.35;
}

.meb-el-article h5 a {
    color: var(--meb-gray-900);
    text-decoration: none;
}

.meb-el-article h5 a:hover {
    color: var(--meb-green-dark);
}

.meb-el-article .meb-autore {
    font-size: 12px;
}

/* Issue navigation */
.meb-issue-nav { padding-top: 10px; }
.meb-issue-nav a {
    font-size: 13px;
    color: var(--meb-red);
    text-decoration: none;
    font-weight: 500;
}
.meb-issue-nav a:hover { text-decoration: underline; }

/* ---- SIDEBAR ---- */
.meb-sidebar {
    font-size: 14px;
}

.meb-sidebar-block {
    margin-bottom: 16px;
}

.meb-sidebar-block .card {
    border: 1px solid var(--meb-border);
    border-radius: 4px;
    overflow: hidden;
    box-shadow: none;
}

.meb-sidebar-block .card-img-top {
    border-radius: 0;
}

.meb-sidebar-block .card-title {
    font-family: var(--meb-serif);
    font-size: 14px;
    font-weight: 700;
    color: var(--meb-red);
}

.meb-sidebar-block .card-text {
    color: var(--meb-gray-700);
    line-height: 1.45;
    font-size: 13px;
}

.meb-sidebar-block .card-text p {
    margin-bottom: 4px;
}

.meb-sidebar-block .card-body {
    padding: 10px 12px;
}

.meb-sidebar h5 {
    font-family: var(--meb-serif);
    font-size: 15px;
    font-weight: 700;
    color: var(--meb-red);
    border-bottom: 2px solid var(--meb-red);
    padding-bottom: 5px;
}

.meb-banner {
    text-align: center;
    padding: 4px 0;
    margin-bottom: 12px;
}

.meb-banner img {
    max-width: 100%;
    border-radius: 3px;
}

/* ---- TASCABILI ---- */
.tascabili-div .col-md-3 img {
    width: 200px !important;
    height: auto !important;
    max-width: 100%;
    display: block !important;
}

.tascabili-div {
    border-bottom: 1px solid var(--meb-border);
    padding-bottom: 12px;
}

/* Links: remove underline, color the parts properly */
.tascabili-div > div > a {
    text-decoration: none;
    color: inherit;
}

.tascabili-div > div > a:hover {
    text-decoration: none;
}

.tascabili-div dt,
.tascabili-div .h4 {
    color: var(--meb-gray-900) !important;
    font-family: var(--meb-serif);
    font-size: 18px;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 6px;
}

.tascabili-div > div > a:hover dt {
    color: var(--meb-red) !important;
}

.tascabili-div dd {
    color: var(--meb-gray-700);
    margin-bottom: 2px;
}

.tascabili-div .meb-underline {
    color: var(--meb-red);
    font-weight: 500;
    text-decoration: none;
}

.tascabili-div > div > a:hover .meb-underline {
    text-decoration: underline;
}

/* "acquista ora" button */
.btn-outline-meb {
    display: inline-block;
    padding: 8px 24px;
    border: 2px solid var(--meb-red);
    color: var(--meb-red);
    background: #fff;
    border-radius: 4px;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: .5px;
    transition: all .15s;
}

.btn-outline-meb:hover {
    background: var(--meb-red);
    color: #fff;
    text-decoration: none;
}

/* Bootstrap 4->5 compat: data-toggle collapse */
[data-toggle="collapse"] { cursor: pointer; }

/* ---- ARTICLE FULL PAGE ---- */
article.meb-article-full {
    font-family: var(--meb-serif);
    font-size: 16px;
    line-height: 1.75;
}

/* ---- BIBLIOGRAPHY ---- */
.meb-bibliography {
    font-size: 13px;
    line-height: 1.6;
    color: var(--meb-gray-700);
}

/* ---- ARTICLE TOOLBAR ---- */
.meb-article-toolbar {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    justify-content: flex-end;
}

.meb-article-toolbar .btn {
    font-size: 12px;
    padding: 3px 10px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* ---- CITATION BOX ---- */
.meb-citation-box {
    background: var(--meb-gray-100);
    border: 1px solid var(--meb-border);
    border-left: 4px solid var(--meb-red);
    border-radius: 4px;
    padding: 14px 16px;
    margin-bottom: 16px;
    font-size: 13px;
}

.meb-citation-box .meb-citation-text {
    font-family: var(--meb-serif);
    font-size: 13px;
    line-height: 1.6;
    color: var(--meb-gray-700);
}

/* ---- PAYWALL ---- */
.meb-paywall {
    background: #fff9e6;
    border: 1px solid #e6cc80;
    border-radius: 6px;
    padding: 20px;
    margin: 20px 0;
    text-align: center;
}

.meb-paywall a {
    color: var(--meb-red);
    font-weight: 600;
}

/* ---- SEARCH ---- */
.meb-search-result {
    padding: 12px 0;
    border-bottom: 1px solid var(--meb-border);
}

.meb-search-result h5 {
    font-family: var(--meb-serif);
    font-size: 16px;
    font-weight: 600;
}

.meb-search-result h5 a {
    color: var(--meb-gray-900);
    text-decoration: none;
}

.meb-search-result h5 a:hover {
    color: var(--meb-red);
}

/* ---- ARCHIVE ---- */
.meb-archive-year { margin-bottom: 1.5rem; }

.meb-archive-year h3 {
    font-family: var(--meb-serif);
    font-size: 20px;
    font-weight: 700;
    color: var(--meb-red);
    border-bottom: 2px solid var(--meb-red);
    padding-bottom: 6px;
}

/* ---- ECM ---- */
.meb-quiz-question {
    background: var(--meb-gray-100);
    border-radius: 6px;
    padding: 16px;
    margin-bottom: 12px;
}

/* ---- PROFILE ---- */
.meb-profile-section {
    background: var(--meb-gray-100);
    border-radius: 6px;
    padding: 20px;
    margin-bottom: 20px;
}

/* ---- FLASH ---- */
.meb-flash { margin: 10px 0; }

/* ---- FOOTER ---- */
.meb-footer {
    background: var(--meb-navy);
    color: rgba(255,255,255,.65);
    margin-top: 40px;
    font-size: 13px;
}

.meb-footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 16px 20px;
}

.meb-footer a {
    color: rgba(255,255,255,.65);
}

.meb-footer a:hover { color: #fff; }

.meb-footer h6 {
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .7px;
    margin-bottom: 10px;
}

.meb-footer-brand {
    font-family: var(--meb-serif);
    font-size: 16px;
    color: #fff;
    font-weight: 700;
    margin-bottom: 6px;
}

.meb-footer hr {
    border-color: rgba(255,255,255,.12);
    margin: 20px 0 12px;
}

.meb-copyright {
    font-size: 11px;
    color: rgba(255,255,255,.35);
}

/* ---- UTILITY ---- */
.meb-bg-red { background-color: var(--meb-red) !important; }
.meb-bg-green { background-color: var(--meb-green) !important; }
.meb-text-red { color: var(--meb-red) !important; }
.meb-text-green { color: var(--meb-green) !important; }

/* ---- RESPONSIVE ---- */
@media (max-width: 991px) {
    .meb-hero-content {
        padding: 16px;
    }

    .meb-hero-title {
        font-size: 20px;
    }

    .meb-hero-img {
        float: none;
        margin: 8px 0;
        max-width: 140px;
    }

    .meb-card-img {
        height: 100px;
    }

    .meb-masthead-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .meb-cover-wrap {
        float: none;
        margin: 0 0 12px;
        max-width: 140px;
    }

    .meb-article-img {
        max-width: 100px;
    }

    .meb-sidebar {
        margin-top: 24px;
        padding-top: 24px;
        border-top: 2px solid var(--meb-border);
    }
}

@media (max-width: 575px) {
    .meb-userbar-inner {
        justify-content: center;
    }

    .meb-nav-inner {
        flex-direction: column;
        padding: 8px 16px;
    }

    .meb-article-img {
        float: none;
        margin: 0 0 8px;
        max-width: 160px;
    }
}

/* ---- PRINT ---- */
@media print {
    .meb-userbar, .meb-nav, .meb-sidebar, .meb-footer,
    .meb-banner, .meb-login-panel {
        display: none !important;
    }
}
