/* CSS ENCICLOPEDIA MODERNA */
:root {
    --wiki-bg: #ffffff;
    --wiki-border: #eaecf0;
    --wiki-link: #3366cc;
    --wiki-link-hover: #002bb8;
    --wiki-text: #202122;
    --wiki-gray: #f8f9fa;
}

body, .wiki-body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif !important;
    background-color: #f6f6f6 !important;
    color: var(--wiki-text) !important;
    margin: 0;
    padding: 0;
    font-size: 15px;
    line-height: 1.6;
}

/* Forzatura stili enciclopedia per sovrascrivere inline vecchi */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Linux Libertine', 'Georgia', 'Times', serif !important;
    color: var(--wiki-text) !important;
    font-weight: normal !important;
    border-bottom: 1px solid var(--wiki-border);
    padding-bottom: 5px;
    margin-top: 1.5em;
    margin-bottom: 0.5em;
}

a {
    color: var(--wiki-link) !important;
    text-decoration: none;
}
a:hover {
    text-decoration: underline !important;
    color: var(--wiki-link-hover) !important;
}

.btn, button, input[type="submit"] {
    background-color: #f8f9fa !important;
    color: var(--wiki-text) !important;
    border: 1px solid #a2a9b1 !important;
    border-radius: 2px !important;
    padding: 5px 12px !important;
    font-weight: bold !important;
    font-family: sans-serif !important;
    cursor: pointer;
}
.btn:hover, button:hover, input[type="submit"]:hover {
    background-color: #ffffff !important;
    border-color: #a2a9b1 !important;
}

/* Tabelle stile Wikipedia */
table {
    background-color: #f8f9fa !important;
    border: 1px solid #a2a9b1 !important;
    border-collapse: collapse !important;
    color: var(--wiki-text) !important;
    width: 100% !important;
    margin: 1em 0 !important;
}
th, td {
    border: 1px solid #a2a9b1 !important;
    padding: 0.5em !important;
}
th {
    background-color: #eaecf0 !important;
    text-align: center !important;
}

/* Box contenuti */
.content-card, .donation-box, .alert {
    background-color: var(--wiki-bg) !important;
    border: 1px solid var(--wiki-border) !important;
    box-shadow: none !important;
    color: var(--wiki-text) !important;
    border-radius: 0 !important;
    padding: 20px !important;
}

/* Top Header */
.wiki-header {
    background-color: var(--wiki-bg);
    border-bottom: 1px solid var(--wiki-border);
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1000;
}
.wiki-brand {
    display: flex;
    align-items: center;
    text-decoration: none !important;
}
.wiki-logo {
    font-size: 2rem;
    color: var(--wiki-text) !important;
    margin-right: 15px;
}
.wiki-title {
    font-family: 'Linux Libertine', 'Georgia', 'Times', serif;
    font-size: 1.5rem;
    color: var(--wiki-text) !important;
    line-height: 1;
    border: none !important;
}
.wiki-subtitle {
    font-size: 0.8rem;
    color: #72777d !important;
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* Giant Search Bar */
.wiki-search-form {
    flex-grow: 1;
    max-width: 600px;
    margin: 0 30px;
    position: relative;
}
.wiki-search-input {
    width: 100%;
    padding: 8px 20px 8px 35px;
    border: 1px solid #a2a9b1;
    border-radius: 2px;
    font-size: 0.95rem;
    transition: border-color 0.2s;
    background: #ffffff;
    color: var(--wiki-text);
}
.wiki-search-input:focus {
    outline: none;
    border-color: var(--wiki-link);
    box-shadow: inset 0 0 0 1px var(--wiki-link);
}
.wiki-search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #72777d;
}
.wiki-search-btn {
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    background: #f8f9fa;
    border: 1px solid #a2a9b1;
    border-left: none;
    border-radius: 0 2px 2px 0;
    padding: 0 15px;
    cursor: pointer;
    color: var(--wiki-text);
    font-weight: 500;
}

/* Layout Principale */
.wiki-layout {
    display: flex;
    max-width: 1600px;
    margin: 0 auto;
}

/* Sidebar */
.wiki-sidebar {
    width: 250px;
    background: #f6f6f6;
    padding: 20px;
    border-right: 1px solid #c8ccd1;
    min-height: calc(100vh - 65px);
}
.sidebar-group {
    margin-bottom: 25px;
}
.sidebar-title {
    font-size: 0.85rem;
    color: #54595d !important;
    border-bottom: 1px solid #c8ccd1 !important;
    padding-bottom: 5px;
    margin-bottom: 10px;
    text-transform: uppercase;
    font-weight: bold;
    font-family: sans-serif;
    margin-top: 0 !important;
}
.sidebar-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.sidebar-list li {
    margin-bottom: 5px;
}
.sidebar-list a {
    color: var(--wiki-link) !important;
    text-decoration: none;
    font-size: 0.9rem;
    display: block;
    padding: 2px 0;
}
.sidebar-list a:hover {
    text-decoration: underline !important;
}

/* Area Contenuto */
.wiki-content {
    flex-grow: 1;
    background: var(--wiki-bg) !important;
    padding: 40px;
    border: 1px solid var(--wiki-border);
    margin: 20px;
    min-height: 100vh;
}
.page-title {
    font-family: 'Linux Libertine', 'Georgia', 'Times', serif;
    font-size: 2.5rem;
    border-bottom: 1px solid #a2a9b1;
    padding-bottom: 5px;
    margin-bottom: 20px;
    font-weight: normal;
}

@media (max-width: 992px) {
    .wiki-layout { flex-direction: column; }
    /* Sidebar nascosta come overlay su mobile */
    .wiki-sidebar { 
        display: none; 
        position: fixed;
        left: 0;
        top: 65px; 
        bottom: 0;
        width: 260px;
        min-height: auto;
        border-right: none;
        z-index: 2000;
        overflow-y: auto;
        box-shadow: 3px 0 10px rgba(0,0,0,0.3);
    }
    .wiki-sidebar.mobile-open {
        display: block !important;
    }
    .wiki-hamburger {
        display: block !important;
        background: none !important;
        border: none !important;
        font-size: 1.6rem;
        cursor: pointer;
        color: var(--wiki-text) !important;
        margin-right: 15px;
        padding: 5px !important;
    }
    .sidebar-group { flex: 1; margin-bottom: 25px; }
    .wiki-content { margin: 0; border: none; padding: 20px; }
    .wiki-search-form { display: none; }
}
.wiki-hamburger {
    display: none;
}

/* Stili specifici per la Home Page (Portali, Infobox, Citazioni) */
.wiki-intro {
    background-color: var(--wiki-gray);
    border-left: 4px solid var(--wiki-link);
    padding: 20px;
    margin-bottom: 30px;
    font-size: 1.1rem;
}

/* Portali (Categorie) */
.portal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
    margin-top: 30px;
}
.portal-box {
    border: 1px solid var(--wiki-border);
    background: #fff;
    margin-bottom: 15px;
}
.portal-header {
    background-color: #eaecf0;
    border-bottom: 1px solid #c8ccd1;
    padding: 8px 15px;
    font-weight: bold;
    display: flex;
    align-items: center;
    font-family: sans-serif;
}
.portal-header i {
    margin-right: 10px;
    color: #54595d;
}
.portal-content {
    padding: 15px;
}
.portal-list {
    list-style: none;
    padding: 0;
    margin: 0;
    columns: 2;
}
.portal-list li {
    margin-bottom: 8px;
    break-inside: avoid;
    font-size: 0.95em;
    display: flex;
    align-items: baseline;
}
.portal-list li i {
    margin-right: 8px;
    color: var(--wiki-link);
    font-size: 0.85em;
}

/* Scatola Frase del Giorno */
.quote-box {
    border: 1px solid #c8ccd1;
    background-color: #f8f9fa;
    padding: 25px;
    margin: 30px 0;
    text-align: center;
}
.quote-text {
    font-family: 'Linux Libertine', 'Georgia', 'Times', serif;
    font-size: 1.8rem;
    color: var(--wiki-text);
    margin-bottom: 10px;
}
.quote-translation {
    color: #54595d;
    font-style: italic;
}

/* Info box laterale */
.infobox {
    float: right;
    width: 300px;
    background: var(--wiki-gray);
    border: 1px solid var(--wiki-border);
    padding: 15px;
    margin: 0 0 20px 20px;
    font-size: 0.9rem;
}
.infobox-title {
    background: #eaecf0;
    text-align: center;
    font-weight: bold;
    padding: 8px;
    margin-bottom: 15px;
}
.infobox-row {
    display: flex;
    border-bottom: 1px solid var(--wiki-border);
    padding: 5px 0;
}
.infobox-label {
    font-weight: bold;
    width: 40%;
}
.infobox-value {
    width: 60%;
}

@media (max-width: 992px) {
    .infobox { float: none; width: 100%; margin: 20px 0; }
    .portal-list { columns: 1; }
}
