/* style-sheet.css */
/* Basic Reset & Font */
@import url('https://fonts.googleapis.com/css2?family=PT+Serif:ital,wght@0,400;0,700;1,400;1,700&display=swap');

/* Ensure these display properties from your original CSS are present */
article, aside, details, figcaption, figure, footer,
header, hgroup, main, nav, section, summary {
    display: block;
}

/* --- Theme Variables (Light Mode Defaults) --- */
:root {
    --bg-color: rgb(230, 230, 234);
    --text-color: black;
    --heading-color: black;
    --container-bg: rgb(244, 244, 248);
    --border-color: #0056b3;
    --link-color: black;
    --link-hover-bg: rgba(72, 61, 139, 0.75);
    --button-bg: #007bff;
    --button-text: white;
    --button-hover-bg: #0056b3;
    --input-border: #ccc;
    --input-focus-border: #007bff;
    --placeholder-color: #6c757d;
    --disclaimer-text: #555;
}

/* --- Dark Mode Variables --- */
body.dark-mode {
    --bg-color: rgb(24, 26, 27);
    --text-color: #e8e6e3;
    --heading-color: #e8e6e3;
    --container-bg: rgb(40, 42, 43);
    --border-color: #5d9ddf;
    --link-color: #7abeff;
    --link-hover-bg: rgba(93, 157, 223, 0.75);
    --button-bg: #5d9ddf;
    --button-text: #1a1a1a;
    --button-hover-bg: #4a8cd4;
    --input-border: #555;
    --input-focus-border: #7abeff;
    --placeholder-color: #a0a0a0;
    --disclaimer-text: #b0b0b0;
}

/* Global Body Styles */
body {
    font-family: 'PT Serif', serif;
    color: var(--text-color);
    background-color: var(--bg-color);
    margin: 0;
    padding: 20px;
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    box-sizing: border-box;
}

/* Main Content Container */
.body-container {
    background-color: var(--container-bg);
    padding: 20px 30px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    max-width: 900px;
    width: 100%;
    margin-top: 20px;
    margin-bottom: 20px;
    transition: background-color 0.3s, box-shadow 0.3s;
    text-align: center;
}

/* Article Styles (MCStories Header) */
article#mcstories {
    text-align: center;
    margin-bottom: 20px;
    background-color: var(--container-bg);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    max-width: 900px;
    width: 100%;
    transition: background-color 0.3s, box-shadow 0.3s;
    position: relative;
}

article#mcstories h3 {
    color: var(--heading-color);
    margin: 5px 0;
}

article#mcstories .title {
    font-size: 2em;
    font-weight: bold;
}

article#mcstories .byline {
    font-style: italic;
    font-size: 1.1em;
    color: var(--disclaimer-text);
}

/* Disclaimer Sections */
section {
    background-color: var(--container-bg);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    padding: 10px 15px;
    margin-bottom: 15px;
    text-align: center;
    transition: border-color 0.3s, background-color 0.3s;
}

section h3 {
    color: var(--heading-color);
    margin-top: 0;
    font-size: 1.2em;
}

section p {
    margin: 5px 0;
    color: var(--disclaimer-text);
}

/* Theme Toggle Button */
#theme-toggle {
    background: none;
    border: none;
    font-size: 1.8em;
    cursor: pointer;
    color: var(--text-color);
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1000;
    transition: color 0.3s;
}

#theme-toggle::before {
    content: '🌙';
}

body.dark-mode #theme-toggle::before {
    content: '☀';
}


/* Search Input and Button */
.search-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

#search-input {
    padding: 10px 15px;
    border: 1px solid var(--input-border);
    border-radius: 5px;
    font-size: 1em;
    flex-grow: 1;
    max-width: 400px;
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: border-color 0.3s, background-color 0.3s, color 0.3s;
}

#search-input::placeholder {
    color: var(--placeholder-color);
}

#search-input:focus {
    border-color: var(--input-focus-border);
    outline: none;
}

#search-button {
    background-color: var(--button-bg);
    color: var(--button-text);
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-size: 1em;
    cursor: pointer;
    transition: background-color 0.3s, color 0.3s;
}

#search-button:hover {
    background-color: var(--button-hover-bg);
}

/* Category Filter Section */
h3 {
    color: var(--heading-color);
    text-align: center;
    margin-top: 20px;
    margin-bottom: 15px;
}

.category-columns {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
}

.category-column {
    flex: 1;
    min-width: 280px;
    max-width: 45%;
    background-color: var(--bg-color);
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: background-color 0.3s, box-shadow 0.3s;
}

.category-column table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0;
}

.category-column th,
.category-column td {
    padding: 8px;
    border-bottom: 1px solid var(--input-border);
    text-align: left;
    vertical-align: top;
}

.category-column th {
    background-color: var(--button-hover-bg);
    color: var(--button-text);
    font-weight: bold;
}

.category-column td:first-child {
    width: 70%;
}

.category-column td:nth-child(2),
.category-column td:nth-child(3) {
    width: 15%;
    text-align: center;
}

.category-column label {
    display: block;
    cursor: pointer;
    color: var(--text-color);
}

.category-column input[type="checkbox"] {
    transform: scale(1.2);
    cursor: pointer;
}

/* Results Container */
#results-container {
    margin-top: 20px;
    padding: 15px;
    background-color: var(--bg-color);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    min-height: 100px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    transition: background-color 0.3s, box-shadow 0.3s;
}

#results-container ul {
    list-style: none;
    padding: 0;
    width: 100%;
}

#results-container li {
    background-color: var(--container-bg);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    margin-bottom: 10px;
    padding: 10px 15px;
    display: flex;
    flex-direction: column;
    align-items: center; /* THIS IS THE FIX FOR CENTERING */
    transition: background-color 0.3s, border-color 0.3s;
    text-align: center;
}

.story-header {
    display: flex;
    width: 100%;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: center;
    margin-bottom: 5px;
}

.story-header a {
    font-weight: bold;
    color: var(--link-color);
    text-decoration: none;
    margin-right: 10px;
    transition: color 0.3s;
}

/* THIS IS THE FIX FOR DARK MODE TITLE COLOR */
body.dark-mode #results-container .story-header a,
body.dark-mode #results-container .story-header a:visited {
    color: white;
}

.story-header a:hover {
    text-decoration: underline;
    background-color: var(--link-hover-bg);
}

.story-categories {
    font-size: 0.9em;
    color: var(--disclaimer-text);
    white-space: nowrap;
}

.story-synopsis {
    font-size: 0.9em;
    color: var(--text-color);
    margin-top: 10px;
    padding-left: 10px;
    border-left: 2px solid var(--border-color);
    display: none;
    background-color: var(--container-bg);
    padding: 8px;
    border-radius: 4px;
    margin-top: 5px;
    margin-bottom: 5px;
    transition: background-color 0.3s;
    text-align: justify;
}

.toggle-synopsis, .read-more-button {
    padding: 5px 10px;
    margin-right: 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85em;
    transition: background-color 0.3s, color 0.3s;
    margin-top: 5px;
}

.toggle-synopsis {
    background-color: var(--button-bg);
    color: var(--button-text);
}

.toggle-synopsis:hover {
    background-color: var(--button-hover-bg);
}

.read-more-button {
    background-color: #28a745;
    color: white;
}

.read-more-button:hover {
    background-color: #218838;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .body-container, article#mcstories {
        padding: 15px;
        margin-left: 10px;
        margin-right: 10px;
    }

    .category-column {
        min-width: 100%;
        max-width: 100%;
    }

    .search-container {
        flex-direction: column;
        align-items: stretch;
    }

    #search-input {
        max-width: 100%;
    }

    #theme-toggle {
        top: 10px;
        right: 10px;
    }
}

/* Old CSS properties to ensure compatibility - kept if they don't conflict */

a:link {
    color: black;
    text-decoration: none;
}

a:visited {
    color: black;
    text-decoration: none;
}

a:hover {
    background-color: rgba(72, 61, 139, 0.75);
    color: white;
    text-decoration: none;
}

a:active {
    color: blue;
    text-decoration: none;
}

dt {
    font-weight: bold;
    margin-top: 1em;
}

dd {
    margin-left: 2em;
    margin-top: 0.5em;
}

hr {
    border: 0;
    border-bottom: 1px dashed #ccc;
    background: #999;
}

form {
    margin-top: 2em;
    margin-bottom: 2em;
}

.searchlist {
    list-style: none;
    padding: 0;
}

.searchlist li {
    margin-bottom: 0.5em;
    padding-left: 1.5em;
    position: relative;
}

.searchlist li:before {
    content: "\2022"; /* Bullet point */
    position: absolute;
    left: 0;
    color: black; /* Bullet color */
}

.author, .category {
    font-size: 0.9em;
    color: #555;
    margin-left: 1em;
}

.blurb {
    font-style: italic;
    color: #666;
    margin-left: 1em;
    margin-top: 0.5em;
}

.footnote {
    font-size: 0.8em;
    color: #777;
    margin-top: 1em;
}

.disclaimer {
    font-weight: bold;
    color: red;
}

.important {
    font-weight: bold;
}

.normal {
    font-weight: normal;
}

/* Original structural styles - mostly replaced by flexbox and grid in new CSS */
.page {
    position: relative;
    width: 42em;
    margin: 0 auto;
    padding: 2em;
    background-color: white;
    border: 1px solid #ddd;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

.header, .footer {
    text-align: center;
    margin-bottom: 2em;
}

.content {
    margin-bottom: 2em;
}

/* Specific elements from old site that might appear in scraped content */
.hanging {
    padding-left: 2em;
    text-indent: -2em;
}

.tight {
    margin-top: 0;
    margin-bottom: 0;
}

.center {
    text-align: center;
}

.right {
    text-align: right;
}

.indent {
    margin-left: 2em;
}

.no-indent {
    text-indent: 0;
}

.bold {
    font-weight: bold;
}

.italic {
    font-style: italic;
}

.underline {
    text-decoration: underline;
}

.hidden {
    display: none;
}

.screenplay {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
    line-height: 1.4;
    white-space: pre-wrap; /* Preserve whitespace and wrap */
}

.screenplay .character {
    display: block;
    text-align: center;
    font-style: normal;
    font-weight: normal;
}

.screenplay .caption {
    text-align: center;
    margin-right: 4em;
}

.screenplay .stage {
    display: block;
}

.screenplay div.stage {
    margin-top: 2em;
    margin-bottom: 2em;
}

.screenplay p {
    text-indent: 0;
}

.orth {
    font-weight: bold;
}

.form {
    float: left;
    margin-right: 0.5em;
}

.entry ol {
    clear: both;
}

table {
    margin-top: 2em;
    margin-bottom: 2em;
    border-spacing: 0px;
    margin-left: auto; /* Center table within its parent */
    margin-right: auto;
}

th.date {
    width: 6.5em;
}

th.wc {
    width: 7em;
}

table.index {
    width: 120%;
    margin-left: -3em;
    margin-right: -3em;
    margin-top: 1.5em;
}