/* --- Font Definitions --- */
@font-face {
    font-family: 'Verdana';
    src: url('../fonts/Verdana.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Verdana';
    src: url('../fonts/Verdana-Bold.ttf') format('truetype');
    font-weight: bold;
    font-style: normal;
}

@font-face {
    font-family: 'Verdana';
    src: url('../fonts/Verdana-Italic.ttf') format('truetype');
    font-weight: normal;
    font-style: italic;
}

@font-face {
    font-family: 'Verdana';
    src: url('../fonts/Verdana-BoldItalic.ttf') format('truetype');
    font-weight: bold;
    font-style: italic;
}

/* --- Base Styles --- */
:root {
    /* Color Palette */
    --main-color: #990000;
    --light-bg-color: #F0EEE9;
    --dark-bg-color: #1a1a1a;
    --footer-bg-color: #000000;

    /* Light Mode Colors */
    --bg-color: var(--light-bg-color);
    --text-color: #333333;
    --link-color: #0000ff;
    --link-hover-color: #ff0000;
    --border-color: #cccccc;

    /* Colors for Dark Backgrounds (Header/Footer in Light Mode) */
    --text-color-on-main: #ffffff;
    --link-color-on-main: #eeeeee;
    --link-hover-on-main: #ffdddd;
    --text-color-on-footer: #dddddd;
    --link-color-on-footer: #bbbbbb;
    --link-hover-on-footer: #ffffff;

    /* Dark Mode Colors */
    --dark-mode-bg: var(--dark-bg-color);
    --dark-mode-text: #e0e0e0;
    --dark-mode-link: #F0EEE9;
    --dark-mode-link-hover: #ff9999;
    --dark-mode-border: #444444;
    --dark-mode-header-bg: #2b2b2b;
    --dark-mode-footer-bg: var(--footer-bg-color);

    /* Layout & Font */
    --max-width: 1200px;
    --font-stack: 'Verdana', sans-serif;
}

body.dark-mode {
    --bg-color: var(--dark-mode-bg);
    --text-color: var(--dark-mode-text);
    --link-color: var(--dark-mode-link);
    --link-hover-color: var(--dark-mode-link-hover);
    --border-color: var(--dark-mode-border);
    --header-bg-override: var(--dark-mode-header-bg);
    --footer-bg-override: var(--dark-mode-footer-bg);
    --text-color-on-main: var(--dark-mode-text);
    --link-color-on-main: var(--dark-mode-link);
    --link-hover-on-main: var(--dark-mode-link-hover);
    --text-color-on-footer: var(--dark-mode-text);
    --link-color-on-footer: var(--dark-mode-link);
    --link-hover-on-footer: var(--dark-mode-link-hover);
}

body {
    font-family: var(--font-stack);
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    font-size: 14px;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 15px;
    width: 100%;
    box-sizing: border-box;
}

a {
    color: var(--link-color);
    text-decoration: none;
}

a:hover {
    color: var(--link-hover-color);
    text-decoration: underline;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: bold;
}

.bi {
    vertical-align: middle;
}

/* --- Header Styles --- */
.site-header {
    background-color: var(--header-bg-override, var(--main-color));
    border-bottom: 1px solid var(--border-color);
    padding: 4px 0;
    width: 100%;
    color: var(--text-color-on-main);
}

.site-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: center;
}

.site-logo a {
    font-size: 1.2em;
    font-weight: bold;
    color: var(--text-color-on-main);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 5px;
}

.site-logo a:hover {
    text-decoration: none;
    color: var(--text-color-on-main);
}

.main-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
}

.main-nav li {
    margin-left: 20px;
}

.main-nav a {
    color: var(--link-color-on-main);
}

.main-nav a:hover {
    color: var(--link-hover-on-main);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-right a,
.header-right button {
    margin-left: 15px;
    color: var(--link-color-on-main);
}

.header-right a:hover,
.header-right button:hover {
     color: var(--link-hover-on-main);
}

.dark-mode-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    font-size: 1.2em;
}

.mobile-nav-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.8em;
    cursor: pointer;
    color: var(--text-color-on-main);
    padding: 0 10px 0 0;
    line-height: 1;
}

/* --- Footer Styles --- */
.site-footer {
    background-color: var(--footer-bg-override, var(--footer-bg-color));
    border-top: 1px solid var(--border-color);
    padding: 15px 0;
    margin-top: auto;
    font-size: 0.9em;
    color: var(--text-color-on-footer);
    width: 100%;
}

.site-footer .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.footer-links ul {
    list-style: none;
    padding: 0;
    margin: 0 0 10px 0;
    display: flex;
    flex-wrap: wrap;
}

.footer-links li {
    margin-right: 15px;
    margin-bottom: 5px;
}

.footer-links a {
    color: var(--link-color-on-footer);
}

.footer-links a:hover {
    color: var(--link-hover-on-footer);
}

.copyright {
     margin-top: 10px;
     width: 100%;
     text-align: center;
}

/* --- Main Content & Shared Components --- */
.main-content {
    flex-grow: 1;
    padding: 20px 0;
}

.message {
    padding: 10px 15px;
    margin-bottom: 15px;
    border: 1px solid;
    transition: opacity 0.5s ease-out;
}
.message.success {
    background-color: #dff0d8;
    border-color: #d6e9c6;
    color: #3c763d;
}
.message.error {
     background-color: #f2dede;
    border-color: #ebccd1;
    color: #a94442;
}

.button-link {
    display: inline-block;
    padding: 8px 15px;
    background-color: var(--main-color);
    color: var(--text-color-on-main);
    text-decoration: none;
    border-radius: 4px;
    margin: 10px 0;
}
.button-link:hover {
    opacity: 0.9;
    color: var(--text-color-on-main);
    text-decoration: none;
}
body.dark-mode .button-link {
     background-color: #770000;
}

.pagination {
    margin-top: 30px;
    text-align: center;
}
.pagination ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: inline-block;
}
.pagination li {
    display: inline-block;
    margin: 0 3px;
}
.pagination a, .pagination span {
    display: block;
    padding: 5px 10px;
    border: 1px solid var(--border-color);
    color: var(--link-color);
    text-decoration: none;
    background-color: var(--bg-color);
}
.pagination a:hover {
    background-color: #eee;
    color: var(--link-hover-color);
    text-decoration: none;
    border-color: #999;
}
body.dark-mode .pagination a:hover {
    background-color: #333;
}
.pagination .active span {
    background-color: var(--main-color);
    color: var(--text-color-on-main);
    border-color: var(--main-color);
    font-weight: bold;
}
body.dark-mode .pagination .active span {
     background-color: #770000;
     border-color: #770000;
}
.pagination .disabled span {
    color: #999;
    background-color: #f0f0f0;
    border-color: #ddd;
    cursor: default;
}
body.dark-mode .pagination .disabled span {
    color: #666;
    background-color: #222;
    border-color: #444;
}

/* --- Base Form Styles (Login/Register/Profile) --- */
.registration-form-container,
.login-form-container,
.user-form {
    max-width: 450px;
    margin: 30px auto;
    padding: 20px;
    border: 1px solid var(--border-color);
    background-color: rgba(0,0,0,0.02);
}

.user-form.nomw {
    max-width: 100%;
}

body.dark-mode .registration-form-container,
body.dark-mode .login-form-container,
body.dark-mode .user-form {
     background-color: rgba(255,255,255,0.04);
}

.registration-form-container h2,
.login-form-container h2 {
    margin-top: 0;
    margin-bottom: 20px;
    color: var(--main-color);
    text-align: center;
}
body.dark-mode .registration-form-container h2,
body.dark-mode .login-form-container h2 {
    color: #ffdddd;
}

.user-form .form-group {
    margin-bottom: 15px;
}
.user-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}
.user-form input[type="text"],
.user-form input[type="email"],
.user-form input[type="tel"],
.user-form input[type="password"] {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    box-sizing: border-box;
    font-family: var(--font-stack);
    font-size: 1em;
    background-color: var(--bg-color);
    color: var(--text-color);
}
.user-form input:focus {
     border-color: #555;
     outline: none;
}
body.dark-mode .user-form input:focus {
    border-color: #aaa;
}
.user-form button {
    padding: 10px 20px;
    background-color: var(--main-color);
    color: var(--text-color-on-main);
    border: none;
    cursor: pointer;
    font-size: 1em;
    font-family: var(--font-stack);
    font-weight: bold;
}
body.dark-mode .user-form button {
    background-color: #770000;
}
.user-form button:hover {
    opacity: 0.9;
}
.user-form small {
    display: block;
    font-size: 0.85em;
    color: #666;
    margin-top: 3px;
}
body.dark-mode .user-form small {
     color: #aaa;
}

/* --- Dashboard Form Fieldsets --- */
.form-fieldset {
    border: 1px solid var(--border-color);
    padding: 10px 15px 15px 15px;
    margin-bottom: 20px;
    border-radius: 4px;
}
.form-fieldset legend {
    font-size: 1.1em;
    font-weight: bold;
    padding: 0 10px;
    margin-left: 5px;
    width: auto;
}
.form-fieldset small {
    display: block;
    margin-bottom: 10px;
    font-size: 0.9em;
}

/* --- Page: Homepage --- */
.welcome-message {
    text-align: center;
    margin-bottom: 25px;
    padding: 15px;
    background-color: rgba(0,0,0,0.03);
    border: 1px solid var(--border-color);
}
body.dark-mode .welcome-message {
     background-color: rgba(255,255,255,0.05);
}
.welcome-message h1 {
    margin: 0 0 5px 0;
    font-size: 1.8em;
}
body.dark-mode .welcome-message h1 {
    color: #ffdddd;
}
.welcome-message p {
    margin: 0;
    font-size: 1.1em;
}

.search-section {
    margin-bottom: 30px;
}
.search-form {
    display: flex;
    max-width: 600px;
    margin: 0 auto;
}
.search-form input[type="text"] {
    flex-grow: 1;
    padding: 8px 12px;
    font-size: 1em;
    border: 1px solid var(--border-color);
    border-right: none;
    font-family: var(--font-stack);
    background-color: var(--bg-color);
    color: var(--text-color);
}
.search-form button {
    padding: 8px 15px;
    font-size: 1em;
    background-color: var(--main-color);
    color: var(--text-color-on-main);
    border: 1px solid var(--main-color);
    cursor: pointer;
    font-family: var(--font-stack);
}
body.dark-mode .search-form button {
    background-color: #770000;
    border-color: #770000;
}
.search-form button:hover {
    opacity: 0.9;
}

.category-section h2,
.story-list-section h2 {
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 5px;
    margin-bottom: 20px;
    font-size: 1.4em;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}
.category-card {
    border: 1px solid var(--border-color);
    padding: 5px;
    text-align: center;
    background-color: rgba(0,0,0,0.02);
    transition: none;
}
body.dark-mode .category-card {
     background-color: rgba(255,255,255,0.04);
}
.category-card:hover {
     transform: none;
     box-shadow: none;
     border-color: var(--border-color);
}
.category-card h3 {
    margin-top: 0;
    margin-bottom: 0;
    font-size: 1.1em;
}
.category-card h3 a {
     color: var(--main-color);
     text-decoration: none;
}
body.dark-mode .category-card h3 a {
     color: var(--dark-mode-link-hover);
}
.category-card h3 a:hover {
    text-decoration: underline;
}
.category-card p {
    font-size: 0.9em;
    margin-bottom: 0;
    color: #555;
}
body.dark-mode .category-card p {
     color: #bbb;
}

/* --- Page: Story & Category Listings --- */
.story-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
/* --- Story List Card Styles --- */
/* Remove default list styles */
.story-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* This is the new card container */
.story-item-card {
    display: block;
    background-color: rgba(0,0,0,0.02);
    border: 1px solid var(--border-color);
    margin-bottom: 15px;
    border-radius: 4px;
    transition: none; /* No hover effects as requested */
}
body.dark-mode .story-item-card {
     background-color: rgba(255,255,255,0.04);
}
.story-item-card:hover {
    /* No shadow or levitation */
    background-color: rgba(0,0,0,0.05); /* Optional: slight background change on hover */
}
body.dark-mode .story-item-card:hover {
     background-color: rgba(255,255,255,0.1);
}


/* The main link wrapper */
.story-card-link {
    display: flex;
    text-decoration: none;
    color: var(--text-color);
    padding: 10px;
}
.story-card-link:hover {
    text-decoration: none;
    color: var(--text-color);
}

/* 1. Image Box */
.story-card-image {
    width: 65px; /* Small fixed width */
    flex-shrink: 0; /* Don't let it shrink */
    margin-right: 15px;
}
.story-card-image img {
    width: 100%;
    height: 100%; /* This creates the "portrait" ratio */
    object-fit: cover; /* Cover ensures image fills the box */
    border: 1px solid var(--border-color);
    border-radius: 3px;
    background-color: #eee; /* Placeholder bg */
}

/* 2. Content Box */
.story-card-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}
.story-card-content h3 {
    margin-top: 0;
    margin-bottom: 3px;
    font-size: 1.15em;
    color: var(--main-color); /* Title is main color */
}
body.dark-mode .story-card-content h3 {
    color: var(--dark-mode-link-hover);
}
.story-card-link:hover h3 {
    text-decoration: underline; /* Underline title on card hover */
}

.story-card-content .story-meta {
    font-size: 0.85em;
    color: #666;
    margin-bottom: 8px;
}
body.dark-mode .story-card-content .story-meta {
     color: #aaa;
}
.story-card-content .story-meta .meta-author {
    font-weight: bold;
    color: var(--text-color);
}
body.dark-mode .story-card-content .story-meta .meta-author {
     color: var(--dark-mode-text);
}


/* 3. Stats Box */
.story-card-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 15px; /* Space between stat items */
    margin-top: 15px;
    font-size: 0.9em;
    color: #555;
}
body.dark-mode .story-card-stats {
    color: #bbb;
}
.story-card-stats span {
    display: flex;
    align-items: center;
}
.story-card-stats i {
    margin-right: 4px;
    font-size: 0.9em; /* Make icons slightly smaller than text */
}

/* Legacy style for "No stories" message */
.story-item {
    border-bottom: 1px dashed var(--border-color);
    padding: 10px 0;
    margin-bottom: 10px;
}

body.dark-mode .story-meta {
     color: #aaa;
}
.story-meta a {
    font-size: 1em;
}

.category-list {
    list-style: none;
    padding: 0;
    margin: 20px 0 0 0;
}
.category-item {
    border-bottom: 1px dashed var(--border-color);
    padding: 15px 0;
}
.category-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}
.category-item h2 {
    margin-top: 0;
    margin-bottom: 5px;
    font-size: 1.3em;
}
.category-item h2 a {
     color: var(--main-color);
     text-decoration: none;
}
body.dark-mode .category-item h2 a {
     color: var(--dark-mode-link-hover);
}
.category-item h2 a:hover {
    text-decoration: underline;
}
.category-item p {
    font-size: 0.95em;
    margin-bottom: 0;
    color: #555;
}
body.dark-mode .category-item p {
     color: #bbb;
}


/* --- Page: story.php --- */
.story-display {
    max-width: 800px;
    margin: 0 auto;
}
.story-content {
    margin-bottom: 30px;
}
.story-meta-full {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px dashed var(--border-color);
}
body.dark-mode .story-meta-full {
     color: #aaa;
}
.chapter-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 20px 0;
    padding: 10px;
    border: 1px solid var(--border-color);
    background-color: rgba(0,0,0,0.02);
}
body.dark-mode .chapter-navigation {
     background-color: rgba(255,255,255,0.04);
}
.chapter-navigation .nav-button {
    padding: 5px 10px;
    border: 1px solid var(--border-color);
    color: var(--link-color);
    text-decoration: none;
    background-color: var(--bg-color);
}
.chapter-navigation .nav-button:hover {
     background-color: #eee;
     color: var(--link-hover-color);
     border-color: #999;
}
body.dark-mode .chapter-navigation .nav-button {
    background-color: var(--dark-mode-bg);
    border-color: var(--dark-mode-border);
}
body.dark-mode .chapter-navigation .nav-button:hover {
    background-color: #333;
}
.chapter-navigation .nav-button.disabled {
    color: #999;
    background-color: #f0f0f0;
    cursor: default;
    border-color: #ddd;
}
body.dark-mode .chapter-navigation .nav-button.disabled {
    color: #666;
    background-color: #222;
    border-color: #444;
}
.chapter-navigation select {
    padding: 6px;
    font-family: var(--font-stack);
    font-size: 0.9em;
    border: 1px solid var(--border-color);
    max-width: 50%;
    background-color: var(--bg-color);
    color: var(--text-color);
}
body.dark-mode .chapter-navigation select {
    background-color: #333;
     color: var(--dark-mode-text);
}
.chapter-title h2 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 1.5em;
    text-align: center;
    color: var(--main-color);
}
body.dark-mode .chapter-title h2 {
    color: #ffdddd;
}
.story-text {
    line-height: 1.7;
    font-size: 1.05em;
}
.story-text p {
    margin-bottom: 1em;
}

/* --- Like & Comment Styles --- */
.story-actions {
    margin-bottom: 20px;
    padding-top: 10px;
    border-top: 1px dashed var(--border-color);
}
.like-button {
    padding: 8px 15px;
    background-color: #eee;
    border: 1px solid #ccc;
    cursor: pointer;
    font-family: var(--font-stack);
    font-size: 1em;
    border-radius: 4px;
}
body.dark-mode .like-button {
    background-color: #444;
    border-color: #666;
    color: var(--dark-mode-text);
}
.like-button:hover:not(:disabled) {
    background-color: #ddd;
}
body.dark-mode .like-button:hover:not(:disabled) {
    background-color: #555;
}
.like-button i {
    color: var(--main-color);
}
.like-button.liked {
    background-color: rgba(153, 0, 0, 0.1);
    border-color: var(--main-color);
    color: var(--main-color);
    font-weight: bold;
}
.like-button.liked i {
    color: var(--main-color);
}
body.dark-mode .like-button.liked {
    background-color: rgba(255, 221, 221, 0.1);
    border-color: #ff9999;
    color: #ff9999;
}
body.dark-mode .like-button.liked i {
     color: #ff9999;
}
.like-button:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}
.like-login-prompt {
    margin-left: 10px;
    font-size: 0.9em;
    color: #666;
}
body.dark-mode .like-login-prompt {
     color: #aaa;
}

.comments-section {
    margin-top: 30px;
    border-top: 2px solid var(--border-color);
    padding-top: 20px;
}
.comments-section h2, .comments-section h3 {
     margin-bottom: 15px;
}
.comment-form textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    margin-bottom: 10px;
    font-family: var(--font-stack);
    font-size: 1em;
    background-color: var(--bg-color);
    color: var(--text-color);
}
.comment-form button {
     padding: 10px 20px;
    background-color: var(--main-color);
    color: var(--text-color-on-main);
    border: none;
    cursor: pointer;
    font-size: 1em;
}
body.dark-mode .comment-form textarea {
    background-color: #333;
    color: var(--dark-mode-text);
}
body.dark-mode .comment-form button {
    background-color: #770000;
}

.comment-item {
    border: 1px solid var(--border-color);
    background-color: rgba(0,0,0,0.02);
    padding: 10px 15px;
    margin-bottom: 10px;
    border-radius: 4px;
    transition: opacity 0.3s ease-out;
}
body.dark-mode .comment-item {
    background-color: rgba(255,255,255,0.04);
}
.comment-meta {
    font-size: 0.9em;
    margin: 0 0 5px 0;
    color: #555;
    border-bottom: 1px dashed var(--border-color);
    padding-bottom: 5px;
    overflow: hidden;
}
body.dark-mode .comment-meta {
    color: #bbb;
}
.comment-meta strong {
    color: var(--text-color);
}
body.dark-mode .comment-meta strong {
    color: var(--dark-mode-text);
}
.comment-meta .comment-date {
    float: right;
    font-style: italic;
    font-size: 0.9em;
}
.comment-body {
    margin: 5px 0 0 0;
    word-wrap: break-word;
}
.comment-owner-actions {
    font-size: 0.85em;
    margin-top: 5px;
    text-align: right;
}
.comment-owner-actions a {
    margin-left: 10px;
    color: #777;
    text-decoration: none;
}
body.dark-mode .comment-owner-actions a {
     color: #aaa;
}
.comment-owner-actions a:hover {
    text-decoration: underline;
}
.comment-edit-form {
    display: none; /* HIDE BY DEFAULT IN CSS */
    margin-top: 10px;
}
.comment-edit-form textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    margin-bottom: 5px;
    font-family: var(--font-stack);
    font-size: 1em;
    background-color: var(--bg-color);
    color: var(--text-color);
}
body.dark-mode .comment-edit-form textarea {
    background-color: #333;
    color: var(--dark-mode-text);
}
.comment-edit-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}
.comment-edit-actions button {
    font-size: 0.9em;
    padding: 3px 8px;
    border: none;
    cursor: pointer;
    border-radius: 3px;
}
.comment-edit-actions .comment-save-btn {
    background-color: var(--main-color);
    color: var(--text-color-on-main);
}
body.dark-mode .comment-edit-actions .comment-save-btn {
    background-color: #770000;
}
.comment-edit-actions .comment-cancel-btn {
    background-color: #eee;
    color: #333;
}
body.dark-mode .comment-edit-actions .comment-cancel-btn {
    background-color: #555;
    color: #eee;
}
.edit-status-message {
    font-size: 0.9em;
    font-style: italic;
}
.comment-item.is-editing .comment-body,
.comment-item.is-editing .comment-owner-actions {
    display: none;
}
.comment-item.is-editing .comment-edit-form {
    display: block;
}

/* --- Dashboard Styles --- */
.dashboard-menu {
    background-color: #eee;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
    margin: -20px 0 20px 0;
}
body.dark-mode .dashboard-menu {
    background-color: #333;
}
.dashboard-menu .container {
    padding: 0 15px;
}
.dashboard-menu ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: flex-start; 
    flex-wrap: wrap;
}
.dashboard-menu li {
    margin: 0 10px 5px 0; 
}
.dashboard-menu a {
    text-decoration: none;
    color: var(--link-color);
    padding: 5px 10px;
    display: block;
    font-weight: normal;
    border: 1px solid transparent;
    border-radius: 4px; 
}
.dashboard-menu a i {
    margin-right: 4px;
}
.dashboard-menu a:hover {
    color: var(--link-hover-color);
    background-color: rgba(0,0,0,0.05);
    text-decoration: none;
}
body.dark-mode .dashboard-menu a:hover {
     background-color: rgba(255,255,255,0.1);
}
.dashboard-menu a.active {
    color: var(--main-color);
    font-weight: bold;
    border-color: var(--main-color);
    background-color: rgba(153,0,0,0.1);
}
body.dark-mode .dashboard-menu a.active {
     color: #ffdddd;
     border-color: #ffdddd;
     background-color: rgba(255,221,221,0.1);
}

.dashboard-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}
.dashboard-table th, .dashboard-table td {
    border: 1px solid var(--border-color);
    padding: 8px 10px;
    text-align: left;
}
.dashboard-table th {
    background-color: #f2f2f2;
    font-weight: bold;
}
body.dark-mode .dashboard-table th {
    background-color: #444;
}
body.dark-mode .dashboard-table tr:nth-child(even) {
    background-color: rgba(255,255,255,0.05);
}
.dashboard-table .actions {
    white-space: nowrap;
    width: 120px;
    text-align: center;
}
.dashboard-table .actions a {
    margin: 0 5px;
    font-size: 1.1em;
    text-decoration: none;
}
.dashboard-table .actions a:hover {
    text-decoration: none;
    opacity: 0.7;
}
.status-published {
    font-weight: bold;
    color: #28a745;
}
.status-draft {
    font-weight: normal;
    color: #6c757d;
}
body.dark-mode .status-published {
    color: #38c172;
}
body.dark-mode .status-draft {
    color: #adb5bd;
}

.create-story-form .form-group label,
.edit-story-form .form-group label,
.edit-chapter-form .form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}
.create-story-form .form-group input[type="text"],
.create-story-form .form-group select,
.create-story-form .form-group textarea,
.edit-story-form .form-group input[type="text"],
.edit-story-form .form-group select,
.edit-story-form .form-group textarea,
.edit-chapter-form .form-group textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    box-sizing: border-box;
    font-family: var(--font-stack);
    font-size: 1em;
    background-color: var(--bg-color);
    color: var(--text-color);
}
.create-story-form .form-group input[type="file"],
.edit-story-form .form-group input[type="file"] {
    padding: 3px;
}
.create-story-form .form-group label input[type="radio"],
.edit-story-form .form-group label input[type="radio"] {
    margin-right: 5px;
}
.create-story-form .form-group small,
.edit-story-form .form-group small {
    display: block;
    font-size: 0.85em;
    color: #666;
    margin-top: 3px;
}
body.dark-mode .create-story-form .form-group small,
body.dark-mode .edit-story-form .form-group small {
     color: #aaa;
}

.note-editor.note-frame {
    border: 1px solid var(--border-color);
}
body.dark-mode .note-editor.note-frame {
     border-color: var(--dark-mode-border);
}
body.dark-mode .note-editable {
    background-color: #2b2b2b;
    color: var(--dark-mode-text);
}
body.dark-mode .note-toolbar {
    background-color: #333;
}

.manage-story h3 {
    margin-top: 25px;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 5px;
}
.chapter-list-table td:first-child {
    width: 50px;
    text-align: center;
}
.chapter-list-table td:last-child {
    width: 150px;
    white-space: nowrap;
}
.chapter-list-table td a {
    text-decoration: none;
    padding: 2px 5px;
}
.chapter-list-table td a:hover {
     text-decoration: underline;
}


/* --- Notice Page Styles (Compact / Collapsible) --- */
.notice-list {
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.notice-item-compact {
    background-color: rgba(0,0,0,0.02);
    border-bottom: 1px solid var(--border-color);
}
.notice-item-compact:last-of-type {
    border-bottom: none;
}
body.dark-mode .notice-item-compact {
     background-color: rgba(255,255,255,0.04);
}

.notice-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px; /* Tighter padding */
    cursor: pointer;
    font-size: 1.1em;
    font-weight: bold;
    list-style: none; /* Hide the default triangle */
}
.notice-summary::-webkit-details-marker {
    display: none; /* Hide triangle in Chrome/Safari */
}
.notice-summary:hover {
    background-color: rgba(0,0,0,0.05);
}
body.dark-mode .notice-summary:hover {
     background-color: rgba(255,255,255,0.1);
}


.notice-title {
    color: var(--main-color);
}
body.dark-mode .notice-title {
    color: #ffdddd;
}

.notice-date {
    font-size: 0.9em;
    font-weight: normal;
    color: #666;
    white-space: nowrap; /* Keep date on one line */
    margin-left: 15px;
}
body.dark-mode .notice-date {
     color: #aaa;
}

.notice-content-compact {
    padding: 0 15px 15px 15px; /* Padding for the content */
    border-top: 1px dashed var(--border-color);
    line-height: 1.7;
}
.notice-content-compact p:last-child {
    margin-bottom: 0;
}



.static-page-content {
    max-width: 800px; /* Or use the default .container width */
    margin: 0 auto; /* Center the content */
}

.page-header {
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 20px;
}

.page-header h1 {
    font-size: 1.8em;
    color: var(--main-color);
}
body.dark-mode .page-header h1 {
    color: #ffdddd;
}

.page-body {
    line-height: 1.7;
    font-size: 1.05em;
}
.page-body p {
    margin-bottom: 1em;
}
.page-body ul, .page-body ol {
    margin-bottom: 1em;
    padding-left: 2em;
}
.page-body h2 {
    font-size: 1.4em;
    margin-top: 1.5em;
    margin-bottom: 0.5em;
}
.page-body h3 {
    font-size: 1.2em;
    margin-top: 1.2em;
    margin-bottom: 0.5em;
}


/* --- Add these styles to assets/css/style.css --- */

/* Replace your old .story-meta-full style with these new ones */
.story-header-grid {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
    border-bottom: 1px dashed var(--border-color);
    padding-bottom: 15px;
}
.story-header-image {
    flex-shrink: 0;
}
.story-header-image img {
    width: 100px; /* Portrait width */
    height: auto;
    object-fit: cover;
    border: 1px solid var(--border-color);
    border-radius: 3px;
    background-color: #eee;
}
.story-header-info {
    flex-grow: 1;
}
.story-header-info h1 {
    margin-top: 0;
    margin-bottom: 10px;
}
.story-header-meta {
    font-size: 0.9em;
    color: #666;
    line-height: 1.5;
}
body.dark-mode .story-header-meta {
     color: #aaa;
}

/* This is the "2nd row" for stats */
.story-meta-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
    font-size: 0.9em;
    color: #555;
}
body.dark-mode .story-meta-stats {
    color: #bbb;
}
.story-meta-stats span {
    display: flex;
    align-items: center;
}
.story-meta-stats i {
    margin-right: 4px;
}


/* --- FIX for Mobile Chapter Nav --- */
@media (max-width: 768px) {
    .chapter-navigation {
        flex-direction: column; /* Stack items vertically */
        align-items: stretch; /* Make items full-width */
        gap: 8px; /* Add space between stacked items */
    }
    .chapter-navigation select {
        max-width: 100%; /* Allow select to be full width */
        text-align: center;
    }
    .chapter-navigation .nav-button {
        text-align: center; /* Center text in buttons */
        padding: 8px 10px; /* Give buttons more touch area */
    }
    
    /* Make header image smaller on mobile */
    .story-header-image img {
        width: 80px;
        height: 112px;
    }
    .story-header-grid {
        gap: 15px;
    }
}

.author-bio {
    font-size: 1.05em;
    text-align: center;
    margin: -10px 0 30px 0;
    font-style: italic;
    color: #555;
}
body.dark-mode .author-bio {
    color: #bbb;
}

/* --- Add to assets/css/style.css --- */

/* Updated Story Actions for Report Button */
.story-actions {
    margin-bottom: 20px;
    padding-top: 10px;
    border-top: 1px dashed var(--border-color);
    /* New styles for flex layout */
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap; /* Wrap on small screens */
    gap: 10px;
}

.report-button {
    font-size: 0.85em;
    color: #777;
    text-decoration: none;
}
.report-button:hover {
    color: var(--main-color);
    text-decoration: underline;
}
.report-button i {
    font-size: 0.9em;
    margin-right: 3px;
}
body.dark-mode .report-button {
    color: #aaa;
}
body.dark-mode .report-button:hover {
    color: #ff9999;
}


/* Updated Comment Item Layout */
.comment-item {
    position: relative; /* Needed for absolute positioning of report button */
    border: 1px solid var(--border-color);
    background-color: rgba(0,0,0,0.02);
    padding: 10px 15px;
    margin-bottom: 10px;
    border-radius: 4px;
    transition: opacity 0.3s ease-out;
}
body.dark-mode .comment-item {
    background-color: rgba(255,255,255,0.04);
}

.comment-actions-row {
    display: flex;
    justify-content: space-between; /* Pushes owner actions and report button apart */
    align-items: center;
    margin-top: 5px;
}

.comment-owner-actions {
    font-size: 0.85em;
    /* text-align: right; (no longer needed) */
}
.comment-owner-actions a {
    margin-right: 10px; /* Use right margin instead of left */
    color: #777;
    text-decoration: none;
}
body.dark-mode .comment-owner-actions a {
     color: #aaa;
}
.comment-owner-actions a:hover {
    text-decoration: underline;
}

.comment-report-action {
    /* Aligns to the right */
}

/* Toggle visibility based on 'is-editing' class */
.comment-item.is-editing .comment-body,
.comment-item.is-editing .comment-actions-row { /* Hide the whole action row when editing */
    display: none;
}

/* --- Social Share Styles --- */
.social-share-container {
    padding: 15px;
    border-top: 1px dashed var(--border-color);
    border-bottom: 1px dashed var(--border-color);
    margin-bottom: 20px;
}
.social-share-container h6 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1em;
    font-weight: bold;
    color: var(--text-color);
}
.social-share-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.social-link {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.9em;
    font-family: var(--font-stack); /* Ensure font matches */
    font-weight: bold;
    color: #fff;
    border: none;
    cursor: pointer;
    transition: opacity 0.2s ease;
}
.social-link:hover {
    opacity: 0.85;
    text-decoration: none;
    color: #fff;
}
.social-link i {
    margin-right: 6px;
    font-size: 1.1em;
}

/* Brand Colors */
.social-link.facebook { background-color: #1877F2; }
.social-link.whatsapp { background-color: #25D366; }
.social-link.twitter  { background-color: #000000; }
.social-link.copy-link { 
    background-color: #6c757d; 
    color: #fff;
}
.social-link.copy-link:disabled {
    background-color: #28a745; /* Green for success */
    opacity: 1;
    cursor: default;
}


.stat-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}
.stat-card {
    position: relative;
    padding: 15px;
    background-color: rgba(0,0,0,0.02);
    border: 1px solid var(--border-color);
    border-radius: 4px;
}
body.dark-mode .stat-card {
     background-color: rgba(255,255,255,0.04);
}
.stat-card h4 {
    font-size: 1em;
    font-weight: bold;
    color: #666;
    margin-top: 0;
    margin-bottom: 5px;
    text-transform: uppercase;
}
body.dark-mode .stat-card h4 {
    color: #aaa;
}
.stat-card .stat-number {
    font-size: 2.2em;
    font-weight: bold;
    color: var(--text-color);
}
.stat-card i {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 2.5em;
    color: rgba(0,0,0,0.08);
}
body.dark-mode .stat-card i {
     color: rgba(255,255,255,0.1);
}

.dashboard-chart-container {
    background-color: rgba(0,0,0,0.02);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 25px;
}
body.dark-mode .dashboard-chart-container {
     background-color: rgba(255,255,255,0.04);
}
.dashboard-chart-container h3 {
    margin-top: 0;
    margin-bottom: 15px;
}

.story-management h3 {
    margin-top: 0;
    margin-bottom: 15px;
}
.dashboard-search-form {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
}
.dashboard-search-form form {
    display: flex;
    flex-grow: 1;
    max-width: 400px;
}
.dashboard-search-form input {
    flex-grow: 1;
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    font-family: var(--font-stack);
    background-color: var(--bg-color);
    color: var(--text-color);
}
.dashboard-search-form button {
    padding: 8px 12px;
    background-color: var(--main-color);
    color: var(--text-color-on-main);
    border: none;
    cursor: pointer;
    font-family: var(--font-stack);
}
.dashboard-search-form a {
    text-decoration: none;
}

/* --- Search Results Page Styles --- */
.search-results-grid {
    display: grid;
    grid-template-columns: 1fr; /* One column on mobile */
    gap: 20px;
    margin-top: 30px;
    border-top: 2px solid var(--border-color);
    padding-top: 20px;
}
@media (min-width: 768px) {
    .search-results-grid {
        grid-template-columns: 1fr 1fr; /* Two columns on desktop */
    }
}

.search-result-list h2 {
    font-size: 1.4em;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 5px;
    margin-bottom: 15px;
}
.search-result-list ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.search-result-list li {
    padding: 8px 0;
    border-bottom: 1px dashed var(--border-color);
}
.search-result-list li:last-child {
    border-bottom: none;
}
.search-result-list li a {
    font-size: 1.1em;
    font-weight: bold;
    text-decoration: none;
    color: var(--link-color);
}
.search-result-list li a:hover {
    color: var(--link-hover-color);
}
.search-result-list li i {
    margin-right: 8px;
    color: #888;
}

i.note-icon-close{
    color: #000 !important;
}

/* --- Writer CTA Section --- */
.writer-cta-section {
    background-color: var(--main-color);
    color: #fff;
    text-align: center;
    padding: 30px 20px;
    border-radius: 6px;
    margin: 30px 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
body.dark-mode .writer-cta-section {
    background-color: #5c0000; /* Darker red for dark mode */
}

.writer-cta-section h2 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #fff; /* Force white text */
    font-size: 1.8em;
}
body.dark-mode .writer-cta-section h2 {
    color: #fff;
}

.writer-cta-section p {
    font-size: 1.1em;
    margin-bottom: 20px;
    color: rgba(255, 255, 255, 0.9);
}

.btn-cta {
    display: inline-block;
    background-color: #fff;
    color: var(--main-color);
    padding: 12px 25px;
    font-size: 1.1em;
    font-weight: bold;
    text-decoration: none;
    border-radius: 30px; /* Pill shape */
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-cta:hover {
    text-decoration: none;
    color: var(--main-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}


/* --- Author Profile Header --- */
.author-profile-header {
    background-color: #f8f9fa;
    padding: 30px;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 30px;
    border: 1px solid var(--border-color);
}
body.dark-mode .author-profile-header {
    background-color: rgba(255,255,255,0.05);
}

.profile-avatar {
    width: 80px;
    height: 80px;
    background-color: var(--main-color);
    color: white;
    font-size: 2.5em;
    font-weight: bold;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 15px auto;
    text-transform: uppercase;
}

.profile-name {
    margin: 0 0 5px 0;
    font-size: 2em;
    color: var(--text-color);
}

.profile-meta {
    color: #666;
    font-size: 0.9em;
    margin-bottom: 20px;
}
body.dark-mode .profile-meta {
    color: #aaa;
}

.profile-stats-row {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 25px;
    border-top: 1px dashed #ccc;
    border-bottom: 1px dashed #ccc;
    padding: 15px 0;
}

.p-stat {
    display: flex;
    flex-direction: column;
}
.p-number {
    font-size: 1.4em;
    font-weight: bold;
    color: var(--main-color);
}
body.dark-mode .p-number {
    color: #ffdddd;
}
.p-label {
    font-size: 0.85em;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
body.dark-mode .p-label {
    color: #aaa;
}

/* Support Button Styles */
.btn-support {
    background-color: #fff;
    color: var(--main-color);
    border: 2px solid var(--main-color);
    padding: 10px 25px;
    font-size: 1em;
    border-radius: 30px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
}
.btn-support:hover {
    background-color: var(--main-color);
    color: #fff;
}
.btn-subscribed {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 10px 25px;
    font-size: 1em;
    border-radius: 30px;
    cursor: default;
}

/* --- FIX for Story Card Layout --- */
.story-item-card {
    /* No flex here, this is the wrapper */
    display: block; 
    margin-bottom: 15px;
}

.story-card-link {
    /* This MUST be flex to put image next to text */
    display: flex; 
    gap: 20px;
    text-decoration: none;
    color: var(--text-color);
    padding: 15px;
    background-color: rgba(0,0,0,0.02);
    border: 1px solid var(--border-color);
    border-radius: 6px;
}
.story-card-link:hover {
    text-decoration: none;
    background-color: rgba(0,0,0,0.04);
    color: var(--text-color);
}

.story-card-image {
    flex-shrink: 0; /* Don't let image shrink */
    width: 70px;
}
.story-card-image img {
    width: 100%;
    height: 100px; /* Portrait height */
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.story-card-content {
    flex-grow: 1; /* Take up remaining space */
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* --- Responsive Styles --- */
@media (min-width: 768px) {
    .site-footer .container {
        flex-wrap: nowrap;
    }
    .footer-links ul {
        margin-bottom: 0;
    }
    .copyright {
        width: auto;
        text-align: right;
        margin-top: 0;
    }
}

@media (min-width: 769px) {
    .story-list-section .story-list {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .site-header .container {
        flex-wrap: wrap;
        justify-content: space-between;
    }
    .mobile-nav-toggle {
        display: block;
    }
    .main-nav-container {
        display: none;
        width: 100%;
        order: 3;
        background-color: var(--header-bg-override, var(--main-color));
        border-top: 1px solid var(--border-color);
        margin-top: 4px;
        padding: 0px 0;
    }
    .main-nav-container.active {
        display: block;
    }
    .main-nav ul {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
    }
    .main-nav li {
        margin: 0;
        width: 100%;
        text-align: left;
        border-bottom: 1px solid var(--border-color);
    }
     .main-nav li:last-child {
        border-bottom: none;
    }
     .main-nav a {
        padding: 6px 10px;
        display: block;
    }
    .username-text {
        display: none;
    }
    .header-right a, .header-right button {
        margin-left: 10px;
    }
     .header-right {
         order: 2;
     }
     .header-left {
        order: 1;
     }
}