/* Add at the top of the file */
.stats-banner {
    background-color: #54595d;
    color: white;
    text-align: center;
    padding: 10px;
    font-weight: bold;
    letter-spacing: 1px;
}

body {
    font-family: sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    background-color: #f6f6f6;
    color: #202122;
}

#container {
    max-width: 900px;
    margin: 20px auto;
    background-color: #fff;
    border: 1px solid #a7d7f9;
    padding: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #a2a9b1;
    padding-bottom: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
}

header .logo {
    display: flex;
    align-items: center;
    gap: 10px; /* Space between logo, title, and tagline */
}

header h1 {
    margin: 0;
    font-size: 1.8em;
    color: #000;
    font-weight: normal; /* More like Wikipedia */
}

header .tagline {
    font-size: 0.9em;
    color: #54595d;
    margin-left: 5px; /* Slight separation from title */
}

#search-form {
    display: flex;
    margin-top: 10px; /* Add some space if it wraps */
    align-items: center;
    gap: 8px;
}

#search-input {
    padding: 8px 10px;
    border: 1px solid #a2a9b1;
    border-right: none;
    font-size: 1em;
    min-width: 200px;
}

#search-form button {
    padding: 8px 15px;
    border: 1px solid #a2a9b1;
    background-color: #f8f9fa;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.2s;
}

#search-form button:hover {
    background-color: #e9ecef;
}

.solar-mode {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.95em;
    color: #202122;
    margin-left: 4px;
}

#content-area {
    padding: 10px;
}

#content-area h2 {
    font-size: 1.6em;
    border-bottom: 1px solid #a2a9b1;
    padding-bottom: 5px;
    margin-bottom: 15px;
    font-weight: normal;
}

#content-area h3 {
    font-size: 1.3em;
    margin-top: 25px;
    padding-bottom: 3px;
    border-bottom: 1px solid #eaecf0;
}

#content-area p {
    margin-bottom: 1em;
}

#content-area a.internal-link {
    color: #3366cc;
    text-decoration: none;
    cursor: pointer; /* Indicate it's clickable */
}

#content-area a.internal-link:hover {
    text-decoration: underline;
}

footer {
    margin-top: 30px;
    padding-top: 10px;
    border-top: 1px solid #a2a9b1;
    font-size: 0.8em;
    color: #54595d;
    text-align: center;
}

/* Infobox styling like Wikipedia */
.infobox {
    float: right;
    margin: 0 0 1em 1em;
    padding: 0.2em;
    border: 1px solid #a2a9b1;
    background-color: #f8f9fa;
    font-size: 0.9em;
    width: 220px;
    clear: right;
}

.infobox-title {
    text-align: center;
    font-size: 1.2em;
    font-weight: bold;
    padding: 0.2em;
    background-color: #eaecf0;
}

.infobox-image {
    text-align: center;
    padding: 0.3em 0;
}

.infobox-image img {
    width: 100%;
    height: auto;
    border: 1px solid #a2a9b1;
}

.infobox .caption {
    font-size: 0.9em;
    color: #54595d;
    margin-top: 0.3em;
}

.infobox table {
    width: 100%;
    border-collapse: collapse;
}

.infobox th, .infobox td {
    border-top: 1px solid #a2a9b1;
    padding: 0.2em 0.4em;
    vertical-align: top;
    text-align: left;
}

.infobox th {
    background-color: #eaecf0;
    width: 40%;
}

.section-image {
    max-width: 512px;
    margin: 0 0 1em 1em;
}

.section-image img {
    width: 100%;
    height: auto;
    border: 1px solid #a2a9b1;
}

.section-image .caption {
    font-size: 0.9em;
    color: #54595d;
    margin-top: 0.3em;
    text-align: center;
}

/* Table of contents styling */
.toc {
    display: table;
    border: 1px solid #a2a9b1;
    background-color: #f8f9fa;
    padding: 7px;
    margin: 1em 0;
    min-width: 50%;
}

.toc-title {
    text-align: center;
    font-weight: bold;
    margin-bottom: 0.5em;
}

#toc-list {
    margin: 0.3em 0 0 1em;
    padding: 0;
    list-style-type: decimal;
    list-style-position: inside;
}

#toc-list a {
    color: #3366cc;
    text-decoration: none;
}

#toc-list a:hover {
    text-decoration: underline;
}

/* References styling */
.references {
    font-size: 0.9em;
}

.references li {
    margin-bottom: 0.5em;
}

/* Add styles for highlighted infobox fields (like birth/death dates) */
.infobox th.highlight, .infobox td.highlight {
    background-color: #eaf3ff;
    font-weight: bold;
}

.lifespan {
    color: #72777d;
    font-size: 0.95em;
    display: block;
    margin-top: 3px;
}

#factory-reset-btn {
    padding: 8px 12px;
    border: 1px solid #a2a9b1;
    background-color: #fff;
    color: #b33;
    cursor: pointer;
    font-size: 0.95em;
    margin-left: 6px;
    transition: background-color 0.15s;
}
#factory-reset-btn:hover {
    background-color: #fff5f5;
}

/* Basic responsiveness */
@media (max-width: 700px) {
    header {
        flex-direction: column;
        align-items: flex-start;
    }
    #search-form {
        width: 100%;
        margin-top: 15px;
    }
    #search-input {
        flex-grow: 1; /* Make input take available space */
    }
    header .logo {
        flex-direction: column; /* Stack logo, title, tagline vertically */
        align-items: flex-start;
        gap: 5px;
    }
    .infobox {
        float: none;
        width: 100%;
        margin: 1em 0;
    }
}

/* Add new styles for loading and error states */
.loading-state {
    text-align: center;
    padding: 2em;
}

.loading-steps {
    max-width: 400px;
    margin: 2em auto;
    text-align: left;
    background: #f8f9fa;
    padding: 1em;
    border: 1px solid #a2a9b1;
    border-radius: 4px;
}

.loading-steps p {
    margin: 0.5em 0;
    color: #54595d;
}

.error-state {
    text-align: center;
    padding: 2em;
    background: #fee7e6;
    border: 1px solid #d33;
    border-radius: 4px;
    margin: 1em 0;
}

.error-state button {
    margin-top: 1em;
    padding: 0.5em 1em;
    background: #fff;
    border: 1px solid #a2a9b1;
    border-radius: 4px;
    cursor: pointer;
}

.error-state button:hover {
    background: #f8f9fa;
}