/* =============================================================================
   AidWiki - Wikipedia Style Design v31
   ============================================================================= */

:root {
    --wiki-blue: #0645ad;
    --wiki-blue-hover: #0b0080;
    --wiki-red: #ba0000;
    --wiki-green: #006400;
    --wiki-bg: #f6f6f6;
    --wiki-border: #a2a9b1;
    --wiki-content-bg: #ffffff;
    --wiki-header-bg: #f8f9fa;
    --wiki-text: #202122;
    --wiki-text-light: #54595d;
    --wiki-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* Base */
html {
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Lato, Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--wiki-text);
    background: var(--wiki-bg) !important;
    margin: 0;
    padding: 0;
}

a {
    color: var(--wiki-blue);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
    color: var(--wiki-blue-hover);
}

img {
    max-width: 100%;
    height: auto;
}

/* Typography */
h1, h2, h3, h4 {
    font-weight: normal;
    color: var(--wiki-text);
    border-bottom: 1px solid var(--wiki-border);
    padding-bottom: 0.25em;
    margin-top: 1em;
    margin-bottom: 0.5em;
}

h1 { font-size: 1.8em; }
h2 { font-size: 1.5em; }
h3 { font-size: 1.2em; border-bottom: none; }
h4 { font-size: 1em; border-bottom: none; }

p {
    margin: 0.5em 0;
    color: var(--wiki-text);
}

/* ===========================================
   LAYOUT
   =========================================== */

/* Hide side ads */
div[style*="min-width:960px"] {
    display: none !important;
}

/* Header */
#header {
    background: var(--wiki-content-bg);
    border-bottom: 1px solid var(--wiki-border);
    padding: 0;
}

#header .color-line {
    height: 3px;
    background: var(--wiki-blue);
}

#logo {
    padding: 10px 20px;
    background: transparent;
    float: none;
    width: auto;
    height: auto;
    margin: 0 !important;
}

#logo a {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--wiki-text);
}

#logo.light-version {
    background: transparent;
    border: none;
}

.small-logo { display: none; }

/* Main Wrapper */
#wrapper {
    max-width: 1200px;
    margin: 0 auto;
    background: var(--wiki-content-bg);
    border: 1px solid var(--wiki-border);
    border-top: none;
    min-height: calc(100vh - 100px);
}

/* Navigation Bar */
#wrapper > .do-margin-top.panel.text-center {
    background: var(--wiki-header-bg);
    border-bottom: 1px solid var(--wiki-border);
    margin: 0;
    padding: 0;
}

#wrapper > .do-margin-top.panel.text-center > .panel-body {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    justify-content: center;
    align-items: center;
    gap: 5px;
    padding: 10px 20px;
    border: none;
    background: transparent;
}

#wrapper > .do-margin-top.panel.text-center > .panel-body > a {
    display: inline-flex !important;
    align-items: center;
    padding: 6px 12px;
    color: var(--wiki-blue);
    font-size: 13px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 2px;
}

#wrapper > .do-margin-top.panel.text-center > .panel-body > a:hover {
    background: var(--wiki-content-bg);
    border-color: var(--wiki-border);
    text-decoration: none;
}

.nav-label {
    font-size: 13px !important;
    color: inherit !important;
}

.nav-label i {
    margin-right: 5px;
    color: var(--wiki-text-light);
}

/* Content */
.content {
    padding: 20px 30px;
}

.normalheader {
    padding: 0;
    margin: 0;
}

/* ===========================================
   GRID - Override Bootstrap 4 with !important
   =========================================== */

.row,
.panel-body:has([class*="col-"]) {
    display: flex !important;
    flex-wrap: wrap !important;
    margin-left: -10px !important;
    margin-right: -10px !important;
}

/* Fallback for browsers without :has() support */
.content > .panel > .panel-body,
.content > .hpanel > .panel-body,
.content .panel-body {
    display: flex !important;
    flex-wrap: wrap !important;
    margin-left: -10px !important;
    margin-right: -10px !important;
}

/* Allow headings to take full width */
.panel-body > h2,
.panel-body > h1,
.panel-body > h3,
.panel-body > .panel-heading {
    width: 100% !important;
    flex: 0 0 100% !important;
    max-width: 100% !important;
    padding-left: 10px !important;
    padding-right: 10px !important;
}

[class*="col-"] {
    padding-left: 10px !important;
    padding-right: 10px !important;
    margin-bottom: 20px;
}

/* Mobile first - all columns full width */
.col-md-3,
.col-md-4,
.col-md-6,
.col-md-8,
.col-md-12,
.col-lg-3,
.col-lg-4,
.col-lg-6,
.col-lg-8,
.col-lg-12 {
    position: relative;
    width: 100% !important;
    flex: 0 0 100% !important;
    max-width: 100% !important;
}

/* Medium screens and up */
@media (min-width: 768px) {
    .col-md-3 {
        width: 25% !important;
        flex: 0 0 25% !important;
        max-width: 25% !important;
    }
    .col-md-4 {
        width: 33.333333% !important;
        flex: 0 0 33.333333% !important;
        max-width: 33.333333% !important;
    }
    .col-md-6 {
        width: 50% !important;
        flex: 0 0 50% !important;
        max-width: 50% !important;
    }
    .col-md-8 {
        width: 66.666667% !important;
        flex: 0 0 66.666667% !important;
        max-width: 66.666667% !important;
    }
    .col-md-12 {
        width: 100% !important;
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }
}

/* Large screens */
@media (min-width: 992px) {
    .col-lg-3 {
        width: 25% !important;
        flex: 0 0 25% !important;
        max-width: 25% !important;
    }
    .col-lg-4 {
        width: 33.333333% !important;
        flex: 0 0 33.333333% !important;
        max-width: 33.333333% !important;
    }
    .col-lg-6 {
        width: 50% !important;
        flex: 0 0 50% !important;
        max-width: 50% !important;
    }
    .col-lg-8 {
        width: 66.666667% !important;
        flex: 0 0 66.666667% !important;
        max-width: 66.666667% !important;
    }
    .col-lg-offset-2 {
        margin-left: 16.666667% !important;
    }
}

/* ===========================================
   PANELS - Wikipedia Style
   =========================================== */

.panel, .hpanel {
    background: var(--wiki-content-bg);
    margin-bottom: 25px;
    border: none;
    border-radius: 0;
}

.panel-heading {
    font-size: 1.3em;
    font-weight: 600;
    padding: 0;
    margin: 0 0 12px;
    border: none;
    border-bottom: 2px solid var(--wiki-border);
    background: none;
    color: var(--wiki-text);
    padding-bottom: 8px;
}

.panel-heading::before {
    display: none;
}

.panel-body {
    padding: 0;
    border: none;
    background: none;
}

/* Article section panels - modern Wikipedia infobox style */
.hpanel {
    background: var(--wiki-content-bg);
    border: 1px solid var(--wiki-border);
    border-radius: 3px;
    margin-bottom: 20px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.hpanel .panel-body {
    padding: 16px 20px;
    background: var(--wiki-content-bg);
    border: none;
    font-size: 15px;
    line-height: 1.7;
}

.hpanel .panel-heading.hbuilt {
    padding: 12px 20px;
    margin: 0;
    background: linear-gradient(to bottom, #f9f9f9 0%, #eaecf0 100%);
    border: none;
    border-bottom: 1px solid var(--wiki-border);
    font-size: 1.1em;
    font-weight: 600;
    color: var(--wiki-text);
}

.hpanel .panel-footer {
    padding: 12px 20px;
    background: var(--wiki-header-bg);
    border-top: 1px solid var(--wiki-border);
    font-size: 14px;
}

/* Section number circle - modern style */
.numberCircle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #3366cc 0%, #2a4d8f 100%);
    color: #fff;
    border-radius: 50%;
    font-weight: 700;
    font-size: 16px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

/* Section headings in articles */
.hpanel .panel-heading h2,
.hpanel h2 {
    font-size: 1.4em;
    font-weight: 600;
    color: var(--wiki-text);
    margin: 0;
    padding: 0;
    border: none;
}

/* Filter items and search results */
.hpanel.filter-item {
    border-left: 3px solid var(--wiki-border);
    transition: border-color 0.2s;
}

.hpanel.filter-item:hover,
.hpanel.filter-item.active {
    border-left-color: var(--wiki-blue);
}

.hpanel.filter-item .panel-body {
    padding: 12px 16px;
}

/* ===========================================
   CARDS / BLOG BOXES - Wikipedia Style
   =========================================== */

.blog-box,
.hpanel.blog-box {
    background: var(--wiki-content-bg);
    border: 1px solid var(--wiki-border);
    border-radius: 3px;
    overflow: hidden;
    height: auto;
    display: flex;
    flex-direction: column;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    margin-bottom: 20px;
}

.blog-box:hover,
.hpanel.blog-box:hover {
    border-color: var(--wiki-blue);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Blog box header */
.blog-box .panel-heading,
.hpanel.blog-box .panel-heading {
    padding: 10px 15px;
    background: var(--wiki-header-bg);
    border-bottom: 1px solid var(--wiki-border);
    font-size: 12px;
    margin: 0;
}

.blog-box .panel-image,
.hpanel.blog-box .panel-image {
    position: relative;
    overflow: hidden;
    background: var(--wiki-header-bg);
}

.blog-box .panel-image img,
.hpanel.blog-box .panel-image img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
}

/* Title overlay on image */
.blog-box .panel-image .title,
.hpanel.blog-box .panel-image .title {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    padding: 30px 15px 15px;
}

.blog-box .panel-image .title h2,
.hpanel.blog-box .panel-image .title h2 {
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    border: none;
    padding: 0;
}

.blog-box .panel-image .title a,
.hpanel.blog-box .panel-image .title a {
    color: #fff;
}

.blog-box .panel-body,
.hpanel.blog-box .panel-body {
    padding: 15px;
    border: none;
    background: var(--wiki-content-bg);
    flex-grow: 1;
    font-size: 14px;
    line-height: 1.6;
    display: block !important;
    flex-wrap: nowrap !important;
    margin: 0 !important;
}

.blog-box .panel-body p,
.hpanel.blog-box .panel-body p {
    margin: 0;
    color: var(--wiki-text-light);
}

.blog-box .panel-body a,
.hpanel.blog-box .panel-body a {
    color: var(--wiki-blue);
}

.blog-box .panel-footer,
.hpanel.blog-box .panel-footer {
    padding: 10px 15px;
    background: var(--wiki-header-bg);
    border-top: 1px solid var(--wiki-border);
    font-size: 12px;
}

/* Grid container that holds blog boxes */
.col-lg-8.hpanel:has(.blog-box),
.hpanel:has(.blog-box.col-lg-4),
.col-lg-8.col-lg-offset-2.hpanel {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    display: flex !important;
    flex-wrap: wrap !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding: 0 !important;
}

/* Fix inline margin-left on category blog boxes */
.hpanel.blog-box.col-lg-4[style*="margin-left"],
.hpanel.blog-box[style*="margin-left"] {
    margin-left: 0 !important;
}

/* Category page grid */
.col-lg-8.col-lg-offset-2 > .hpanel.blog-box.col-lg-4,
.hpanel > .hpanel.blog-box.col-lg-4 {
    width: 33.333% !important;
    flex: 0 0 33.333% !important;
    max-width: 33.333% !important;
    margin-left: 0 !important;
    padding: 10px !important;
}

/* ===========================================
   FORMS - Wikipedia Style
   =========================================== */

.form-control {
    border: 1px solid var(--wiki-border);
    border-radius: 0;
    padding: 6px 8px;
    font-size: 13px;
    width: 100%;
    background: var(--wiki-content-bg);
}

.form-control:focus {
    border-color: var(--wiki-blue);
    outline: none;
    box-shadow: none;
}

.input-group {
    display: flex;
    max-width: 500px;
}

.input-group .form-control {
    border-right: none;
}

.input-group-btn .btn {
    border-radius: 0;
}

.btn {
    display: inline-block;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: bold;
    border: 1px solid var(--wiki-border);
    background: linear-gradient(to bottom, #fff 0%, #ddd 100%);
    color: var(--wiki-text);
    cursor: pointer;
}

.btn:hover {
    background: linear-gradient(to bottom, #fff 0%, #ccc 100%);
    border-color: #999;
}

.btn-primary {
    background: var(--wiki-blue);
    border-color: var(--wiki-blue);
    color: #fff;
}

.btn-primary:hover {
    background: var(--wiki-blue-hover);
}

.btn-default {
    background: linear-gradient(to bottom, #fff 0%, #ddd 100%);
    color: var(--wiki-text);
}

/* ===========================================
   BREADCRUMBS
   =========================================== */

.breadcrumb, .hbreadcrumb {
    list-style: none;
    padding: 8px 12px;
    margin: 0 0 15px;
    background: var(--wiki-header-bg);
    border: 1px solid var(--wiki-border);
    font-size: 12px;
    display: flex;
    flex-wrap: wrap;
}

.breadcrumb li, .hbreadcrumb li {
    display: inline-flex;
    align-items: center;
}

.breadcrumb li + li::before,
.hbreadcrumb li + li::before {
    content: ">";
    color: var(--wiki-text-light);
    padding: 0 8px;
}

#hbreadcrumb {
    margin: 0 0 15px;
}

/* ===========================================
   LIST GROUPS - Table of Contents style
   =========================================== */

.list-group {
    list-style: none;
    border: none;
    margin: 0;
    padding: 0;
    background: transparent;
}

.list-group-item {
    padding: 10px 0;
    border: none;
    border-bottom: 1px solid #eee;
    background: transparent;
    font-size: 14px;
    line-height: 1.5;
}

.list-group-item:last-child {
    border-bottom: none;
}

.list-group-item a {
    color: var(--wiki-blue);
}

.list-group-item:hover {
    background: transparent;
}

.list-group-item .font-extra-bold {
    color: var(--wiki-text-light);
    margin-right: 5px;
}

.list-group-item:last-child {
    border-bottom: none;
}

.list-group-item:hover {
    background: var(--wiki-header-bg);
}

/* ===========================================
   ARTICLE STYLES
   =========================================== */

.numberCircle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--wiki-blue);
    color: #fff;
    border-radius: 50%;
    font-weight: bold;
    font-size: 14px;
    margin-right: 10px;
}

.label {
    display: inline-block;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.label-default {
    background: #6c757d;
    color: #fff;
}

.label-primary { background: var(--wiki-blue); }
.label-success { background: #28a745; }
.label-warning { background: #ffc107; color: #000; }
.label-danger { background: #dc3545; }
.label-info { background: #17a2b8; }

dl { margin: 0 0 15px; }
dt {
    font-weight: bold;
    color: var(--wiki-text);
    margin-top: 10px;
    font-size: 13px;
}
dd {
    margin: 3px 0 0 20px;
    color: var(--wiki-text-light);
}

/* Tables - Wikipedia Style */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
    background: var(--wiki-content-bg);
}

th, td {
    padding: 8px 10px;
    text-align: left;
    border: 1px solid var(--wiki-border);
    font-size: 13px;
}

th {
    background: var(--wiki-header-bg);
    font-weight: bold;
}

/* Infobox style */
.infobox, .wikitable {
    float: right;
    clear: right;
    margin: 0 0 15px 15px;
    width: 280px;
    background: var(--wiki-header-bg);
    border: 1px solid var(--wiki-border);
    border-collapse: collapse;
}

.infobox th, .infobox td {
    padding: 5px 8px;
    vertical-align: top;
}

.infobox th {
    text-align: center;
    background: #c8ccd1;
}

/* ===========================================
   PAGINATION - Bootstrap 4 compatible
   =========================================== */

.pagination {
    display: flex !important;
    flex-wrap: nowrap !important;
    justify-content: center;
    align-items: center;
    list-style: none;
    padding: 0;
    margin: 20px auto;
    gap: 4px;
    width: auto !important;
    flex: none !important;
    max-width: none !important;
}

/* Bootstrap 4 pagination classes */
.pagination .page-item {
    margin: 0;
    flex: none !important;
    width: auto !important;
    max-width: none !important;
}

.pagination .page-link,
.pagination li a,
.pagination li span {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-width: auto;
    width: auto !important;
    height: 32px;
    padding: 6px 14px;
    color: var(--wiki-blue);
    background: var(--wiki-content-bg);
    border: 1px solid var(--wiki-border);
    font-size: 13px;
    font-weight: normal;
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
    flex: none !important;
    max-width: none !important;
}

.pagination .page-item.active .page-link,
.pagination li.active span,
.pagination li.active a {
    background: var(--wiki-blue);
    color: #fff;
    border-color: var(--wiki-blue);
}

.pagination .page-link:hover,
.pagination li a:hover {
    background: var(--wiki-header-bg);
    text-decoration: none;
    color: var(--wiki-blue-hover);
}

.pagination .page-item.disabled .page-link,
.pagination li.disabled span {
    color: var(--wiki-text-light);
    background: var(--wiki-header-bg);
    cursor: not-allowed;
}

/* ===========================================
   FOOTER
   =========================================== */

.footer, footer {
    background: var(--wiki-header-bg);
    border-top: 1px solid var(--wiki-border);
    color: var(--wiki-text-light);
    padding: 15px 30px;
    font-size: 12px;
}

.footer a {
    color: var(--wiki-blue);
}

/* ===========================================
   UTILITIES
   =========================================== */

.text-center { text-align: center; }
.text-primary { color: var(--wiki-blue) !important; }
.text-danger { color: var(--wiki-red) !important; }
.text-success { color: var(--wiki-green) !important; }
.text-muted { color: var(--wiki-text-light) !important; }

.font-12 { font-size: 12px; }
.font-14 { font-size: 14px; }
.font-16 { font-size: 16px; }
.font-18 { font-size: 18px; }

.font-light { font-weight: 300; }
.font-bold, .font-extra-bold { font-weight: bold; }

.m-b-xs { margin-bottom: 5px; }
.m-b-sm { margin-bottom: 10px; }
.m-t-lg { margin-top: 20px; }

.do-margin-top { margin-top: 15px; }
.do-margin-left { margin-left: 10px; }

.pull-right { float: right; }
.pull-left { float: left; }
.no-padding { padding: 0 !important; }

.img-responsive {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ===========================================
   RESPONSIVE
   =========================================== */

@media (max-width: 991px) {
    .col-lg-offset-2 { margin-left: 0 !important; }

    #wrapper {
        margin: 0;
        border-left: none;
        border-right: none;
    }
}

@media (max-width: 767px) {
    .content {
        padding: 15px;
    }

    /* Mobile navigation - horizontal scrollable */
    #wrapper > .do-margin-top.panel.text-center > .panel-body {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding: 8px 10px;
        gap: 5px;
        justify-content: flex-start;
    }

    #wrapper > .do-margin-top.panel.text-center > .panel-body > a {
        flex: 0 0 auto;
        white-space: nowrap;
        padding: 8px 12px;
        font-size: 12px;
        margin-bottom: 0;
    }

    /* Hide scrollbar but keep functionality */
    #wrapper > .do-margin-top.panel.text-center > .panel-body::-webkit-scrollbar {
        height: 0;
        display: none;
    }

    .col-md-3,
    .col-md-4 {
        width: 50% !important;
        flex: 0 0 50% !important;
        max-width: 50% !important;
    }

    h1 { font-size: 1.4em; }
    h2 { font-size: 1.2em; }

    .blog-box .panel-image img {
        height: 140px;
    }

    .infobox, .wikitable {
        float: none;
        width: 100%;
        margin: 15px 0;
    }
}

@media (max-width: 480px) {
    .col-md-3,
    .col-md-4 {
        width: 100% !important;
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }

    .input-group {
        flex-direction: column;
    }

    .input-group .form-control {
        border-right: 1px solid var(--wiki-border);
        margin-bottom: 5px;
    }

    .input-group-btn {
        width: 100%;
    }

    .input-group-btn .btn {
        width: 100%;
    }
}

/* ===========================================
   PRINT
   =========================================== */

@media print {
    body { background: #fff; }
    #header, .footer, .pagination { display: none; }
    #wrapper { box-shadow: none; border: none; margin: 0; }
}
