/* =============================================== */
/* --- Cheekypubs Stories Site Styles --- */
/* =============================================== */

/* General Body Styles */
body {
    background-color: #ffe3e0; /* Peachy Pink */
    color: #5C4033; /* Dark Brown */
    font-family: Arial, sans-serif;
    margin: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header Styles */
.header {
    background-color: #FFF;
    padding: 2px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #A52A2A; /* Dark Crimson */
    overflow: visible;
}

.logo a {
    display: inline-block;
}

.logo img {
    height: 66px;
}

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

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

.nav-links a {
    text-decoration: none;
    color: #5C4033; /* Dark Brown */
    font-weight: bold;
    transition: color 0.3s;
}

.nav-links a:hover {
    color: #228B22; /* Leafy Green */
}

/* External link style */
.nav-links a.external-link {
    color: #228B22;
}

.nav-links a.external-link:hover {
    color: #A52A2A;
}

a {
    color: #228B22; /* Leafy Green */
    font-weight: bold;
    transition: color 0.3s;
}

/* Main Content Styles */
.main-content {
    flex: 1;
    padding: 20px;
}

/* Footer Styles */
.footer {
    background-color: #FFF;
    text-align: center;
    padding: 15px 20px;
    border-top: 2px solid #A52A2A; /* Dark Crimson */
    font-size: 0.9em;
    color: #5C4033; /* Dark Brown */
}

/* Footer Admin Link - subtle styling */
.footer .admin-link {
    margin-top: 10px;
    font-size: 0.75em;
    opacity: 0.5;
}

.footer .admin-link a {
    color: #999;
    text-decoration: none;
    font-weight: normal;
}

.footer .admin-link a:hover {
    color: #5C4033;
    opacity: 1;
}

/* --- Footer Social Links --- */
.social-links {
    text-align: center;
    margin-bottom: 15px;
}

.social-links a {
    display: inline-block;
    margin: 0 10px;
}

.social-links img {
    width: 32px;
    height: 32px;
    vertical-align: middle;
    opacity: 0.8;
    transition: opacity 0.3s;
}

.social-links a:hover img {
    opacity: 1.0;
}

/* --- Hamburger Menu Styles --- */

.hamburger-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    z-index: 1001;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    width: 40px;
    height: 40px;
    box-sizing: border-box;
    flex-shrink: 0;
}

.hamburger-line {
    display: block;
    width: 24px;
    height: 3px;
    background-color: #5C4033;
    border-radius: 2px;
    transition: transform 0.3s, opacity 0.3s;
}

.hamburger-btn.active .hamburger-line:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.hamburger-btn.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.hamburger-btn.active .hamburger-line:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

.hamburger-btn svg {
    fill: #5C4033; /* Dark Brown */
}

/* --- Global Content Box --- */
.content-box {
    background-color: #fff;
    border: 2px solid #A52A2A;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.05);
    box-sizing: border-box;
}

.content-box h1,
.content-box h2,
.content-box h3 {
    color: #5C4033;
}

.content-box h1:first-child,
.content-box h2:first-child,
.content-box h3:first-child {
    margin-top: 0;
}

.content-box:last-child {
    margin-bottom: 0;
}

/* --- Global Page Width Container --- */
.page-container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 20px;
}

/* =============================================== */
/* --- Stories Page Styles --- */
/* =============================================== */

.stories-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.stories-container {
    display: flex;
    gap: 30px;
}

/* Sidebar Styles */
.stories-sidebar {
    flex: 0 0 250px;
    background-color: #fff;
    border: 2px solid #A52A2A;
    border-radius: 8px;
    padding: 20px;
    height: fit-content;
    position: sticky;
    top: 20px;
}

.sidebar-section {
    margin-bottom: 25px;
}

.sidebar-section:last-child {
    margin-bottom: 0;
}

.sidebar-section h3 {
    color: #5C4033;
    margin: 0 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
    font-size: 1.1em;
}

.author-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.author-list li {
    margin-bottom: 8px;
}

.author-list li.active a {
    color: #A52A2A;
    font-weight: bold;
}

.author-list a {
    color: #5C4033;
    text-decoration: none;
    font-size: 0.95em;
    display: block;
    padding: 5px 0;
    transition: color 0.2s;
}

.author-list a:hover {
    color: #228B22;
}

.author-list .count,
.tag-cloud .count {
    color: #999;
    font-size: 0.85em;
    font-weight: normal;
}

.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    display: inline-block;
    background-color: #f5f5f5;
    color: #5C4033;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 0.85em;
    text-decoration: none;
    border: 1px solid #ddd;
    transition: all 0.2s;
}

.tag:hover {
    background-color: #A52A2A;
    color: #fff;
    border-color: #A52A2A;
}

.submit-link-btn {
    display: block;
    text-align: center;
    background-color: #228B22;
    color: #fff !important;
    padding: 12px 20px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: bold;
    transition: background-color 0.3s;
}

.submit-link-btn:hover {
    background-color: #A52A2A;
}

/* Mobile Sidebar Toggle */
.sidebar-toggle {
    display: none;
    width: 100%;
    padding: 12px 20px;
    margin-bottom: 15px;
    background-color: #fff;
    border: 2px solid #A52A2A;
    border-radius: 8px;
    font-weight: bold;
    color: #5C4033;
    cursor: pointer;
    align-items: center;
    justify-content: space-between;
}

.sidebar-toggle svg {
    transition: transform 0.3s;
}

.sidebar-toggle.active svg {
    transform: rotate(180deg);
}

/* Main Stories List */
.stories-main {
    flex: 1;
    min-width: 0;
}

.stories-main h1 {
    color: #A52A2A;
    margin: 0 0 20px 0;
}

.filter-notice {
    background-color: #f9f9f9;
    padding: 10px 15px;
    border-radius: 5px;
    margin-bottom: 20px;
    font-size: 0.95em;
}

.clear-filter {
    margin-left: 10px;
    color: #228B22;
    text-decoration: none;
}

.clear-filter:hover {
    text-decoration: underline;
}

.story-list {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.story-preview {
    background-color: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 20px;
    transition: box-shadow 0.2s;
}

.story-preview:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.story-title {
    margin: 0 0 10px 0;
    font-size: 1.3em;
}

.story-title a {
    color: #A52A2A;
    text-decoration: none;
}

.story-title a:hover {
    text-decoration: underline;
}

.story-meta {
    font-size: 0.9em;
    color: #777;
    margin-bottom: 10px;
}

.story-meta .story-author {
    margin-right: 15px;
}

.story-meta .story-author a {
    color: #228B22;
    text-decoration: none;
}

.story-meta .story-author a:hover {
    text-decoration: underline;
}

.story-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.story-excerpt {
    color: #5C4033;
    line-height: 1.6;
    margin: 0 0 15px 0;
}

.read-more {
    color: #228B22;
    text-decoration: none;
    font-weight: bold;
    font-size: 0.9em;
}

.read-more:hover {
    text-decoration: underline;
}

/* Individual Story Page */
.story {
    max-width: 800px;
    margin: 0 auto;
}

.story-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.story-header h1 {
    color: #A52A2A;
    margin: 0 0 15px 0;
}

.story-content {
    line-height: 1.8;
    font-size: 1.05em;
}

.story-content h2 {
    color: #5C4033;
    margin-top: 30px;
}

.story-content p {
    margin-bottom: 1.5em;
}

.story-content img {
    max-width: 100%;
    border-radius: 8px;
    margin: 20px 0;
}

.story-content em {
    font-style: italic;
}

.story-content hr {
    border: none;
    border-top: 2px solid #eee;
    margin: 30px 0;
}

.story-footer {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.back-link {
    color: #228B22;
    text-decoration: none;
    font-weight: bold;
}

.back-link:hover {
    text-decoration: underline;
}

/* Stories Pagination */
.stories-pagination {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.pagination-btn {
    padding: 8px 16px;
    border: 2px solid #A52A2A;
    border-radius: 5px;
    color: #A52A2A;
    text-decoration: none;
    font-weight: bold;
    transition: all 0.2s;
}

.pagination-btn:hover:not(.disabled) {
    background-color: #A52A2A;
    color: #fff;
}

.pagination-btn.disabled {
    border-color: #ddd;
    color: #ddd;
    cursor: not-allowed;
}

.page-numbers {
    display: flex;
    gap: 5px;
}

.page-num {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 3px;
    color: #5C4033;
    text-decoration: none;
    transition: all 0.2s;
}

.page-num:hover:not(.current) {
    background-color: #f5f5f5;
}

.page-num.current {
    background-color: #A52A2A;
    color: #fff;
    border-color: #A52A2A;
}

/* =============================================== */
/* --- Story Submission Page Styles --- */
/* =============================================== */

.submit-page {
    max-width: 800px;
    margin: 0 auto;
}

.submit-page h1 {
    color: #A52A2A;
    margin-bottom: 30px;
}

.password-gate {
    text-align: center;
    padding: 60px 20px;
}

.password-container {
    max-width: 400px;
    margin: 0 auto;
    background-color: #fff;
    border: 2px solid #A52A2A;
    border-radius: 8px;
    padding: 40px;
}

.password-container h2 {
    color: #5C4033;
    margin: 0 0 15px 0;
}

.password-form {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.password-form input {
    flex: 1;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1em;
}

.password-form input.error {
    border-color: #A52A2A;
}

.error-message {
    color: #A52A2A;
    margin-top: 15px;
    font-size: 0.9em;
}

.submission-form {
    background-color: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 30px;
}

.form-intro {
    margin-bottom: 30px;
    color: #666;
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #5C4033;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="number"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1em;
    font-family: inherit;
    box-sizing: border-box;
}

.form-group select {
    background-color: #fff;
    cursor: pointer;
}

.form-group input[type="number"] {
    max-width: 120px;
}

.form-group textarea {
    resize: vertical;
    min-height: 300px;
    line-height: 1.6;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #228B22;
    box-shadow: 0 0 0 2px rgba(34, 139, 34, 0.1);
}

/* Radio button group styling */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 5px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
    cursor: pointer;
    font-weight: normal;
    transition: border-color 0.2s, background-color 0.2s;
}

.radio-label:hover {
    border-color: #228B22;
}

.radio-label input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: #228B22;
}

.radio-label input[type="radio"]:checked + span {
    color: #228B22;
    font-weight: bold;
}

.chapter-type-group {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 25px;
}

.chapter-type-group > label {
    margin-bottom: 12px;
    font-size: 1.1em;
}

.form-hint {
    display: block;
    margin-top: 5px;
    font-size: 0.85em;
    color: #999;
}

.form-hint a {
    color: #228B22;
}

.form-note {
    margin-top: 12px;
    padding: 12px 15px;
    background-color: #f8f9fa;
    border-left: 3px solid #228B22;
    border-radius: 4px;
    font-size: 0.9em;
    color: #5C4033;
    line-height: 1.6;
}

.form-note a {
    color: #228B22;
}

.form-note code {
    display: inline-block;
    margin-top: 8px;
    padding: 6px 10px;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9em;
    color: #A52A2A;
}

.form-actions {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.btn-primary {
    padding: 14px 30px;
    background-color: #228B22;
    color: #fff;
    border: none;
    border-radius: 5px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s;
}

.btn-primary:hover:not(:disabled) {
    background-color: #A52A2A;
}

.btn-primary:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.btn-secondary {
    padding: 12px 24px;
    background-color: #fff;
    color: #A52A2A;
    border: 2px solid #A52A2A;
    border-radius: 5px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-secondary:hover {
    background-color: #A52A2A;
    color: #fff;
}

.submission-success,
.submission-error {
    text-align: center;
    padding: 40px;
}

.submission-success h2 {
    color: #228B22;
}

.submission-error h2 {
    color: #A52A2A;
}

/* =============================================== */
/* --- Mobile & Responsive Styles --- */
/* =============================================== */

@media (max-width: 768px) {
    /* --- Header & Navigation --- */
    .header .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        width: 100%;
        background-color: #fff;
        box-shadow: 0 4px 12px rgba(0,0,0,0.15);
        border-top: 2px solid #A52A2A;
        z-index: 1000;
    }

    .header .nav-links.active {
        display: block;
    }

    .header .nav-links ul {
        flex-direction: column;
        padding: 0;
        margin: 0;
        width: 100%;
    }

    .header .nav-links li {
        margin: 0;
        width: 100%;
        border-bottom: 1px solid #eee;
    }
    
    .header .nav-links li:last-child {
        border-bottom: none;
    }
    
    .header .nav-links a {
        display: block;
        padding: 15px 20px;
        width: auto;
        text-align: center;
    }

    .header .hamburger-btn {
        display: flex;
    }
    
    .header {
        position: relative;
    }
}

@media (max-width: 900px) {
    .stories-container {
        flex-direction: column;
    }
    
    .stories-sidebar {
        position: static;
        flex: none;
        width: 100%;
        display: none;
        max-width: 100%;
        box-sizing: border-box;
        overflow-x: hidden;
    }
    
    .stories-sidebar.active {
        display: block;
    }
    
    .sidebar-toggle {
        display: flex;
    }
    
    .tag-cloud {
        max-width: 100%;
        overflow-x: hidden;
    }
    
    .author-list {
        max-width: 100%;
        overflow-x: hidden;
    }
}

@media (max-width: 600px) {
    .story-preview {
        padding: 15px;
    }
    
    .story-title {
        font-size: 1.1em;
    }
    
    .story-meta {
        display: flex;
        flex-direction: column;
        gap: 5px;
    }
    
    .story-meta .story-author {
        margin-right: 0;
    }
    
    .pagination-controls {
        flex-direction: column;
    }
    
    .page-numbers {
        order: -1;
    }
    
    .password-form {
        flex-direction: column;
    }
    
    .submission-form {
        padding: 15px;
    }
    
    /* Unified mobile left-right margins for all containers */
    .page-container {
        padding-left: 5px;
        padding-right: 5px;
        box-sizing: border-box;
        max-width: 100%;
    }
    
    .stories-page {
        padding-left: 5px;
        padding-right: 5px;
        box-sizing: border-box;
        max-width: 100%;
    }
    
    .main-content {
        padding-top: 20px;
        padding-bottom: 20px;
        padding-left: 5px;
        padding-right: 5px;
        box-sizing: border-box;
        max-width: 100%;
    }
    
    .content-box {
        padding: 15px;
        box-sizing: border-box;
        max-width: 100%;
        overflow-x: hidden;
    }
    
    .stories-sidebar {
        margin: 0;
        box-sizing: border-box;
    }
    
    /* Submit info page mobile fixes */
    .submit-info {
        max-width: 100%;
    }
    
    .submit-info h2 {
        font-size: 1.1em;
    }
    
    .email-highlight a {
        font-size: 1em;
        padding: 12px 20px;
        word-break: break-all;
    }
    
    .format-examples {
        padding: 15px;
    }
    
    .format-example {
        display: flex;
        flex-direction: column;
        gap: 5px;
    }
    
    .format-example code {
        font-size: 0.85em;
        word-break: break-all;
        margin-right: 0;
    }
    
    .submit-cta {
        padding: 20px 15px;
    }
    
    .submit-cta .btn-primary {
        display: block;
        width: 100%;
        text-align: center;
        box-sizing: border-box;
    }
    
    .submit-checklist li {
        padding: 10px 12px;
    }
}

/* =============================================== */
/* --- Multi-Chapter Story Styles --- */
/* =============================================== */

/* Chapter badge on story listing */
.chapter-badge {
    display: inline-block;
    background-color: #228B22;
    color: white;
    font-size: 0.55em;
    font-weight: normal;
    padding: 3px 8px;
    border-radius: 12px;
    margin-left: 10px;
    vertical-align: middle;
}

/* Chapter indicator in story header */
.chapter-indicator {
    display: inline-block;
    background-color: #A52A2A;
    color: white;
    font-size: 0.5em;
    font-weight: normal;
    padding: 4px 10px;
    border-radius: 15px;
    margin-left: 12px;
    vertical-align: middle;
}

/* Chapter navigation at bottom of story */
.chapter-navigation {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid #A52A2A;
}

.chapter-navigation h3 {
    margin: 0 0 15px 0;
    color: #A52A2A;
    font-size: 1.1em;
}

.chapter-list {
    list-style: none;
    padding: 0;
    margin: 0 0 20px 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.chapter-list li {
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
    overflow: hidden;
}

.chapter-list li a {
    display: block;
    padding: 8px 15px;
    color: #228B22;
    text-decoration: none;
    font-weight: normal;
    transition: background-color 0.2s, color 0.2s;
}

.chapter-list li a:hover {
    background-color: #228B22;
    color: white;
}

.chapter-list li.current-chapter {
    background-color: #A52A2A;
    border-color: #A52A2A;
}

.chapter-list li.current-chapter a {
    color: white;
    font-weight: bold;
}

.chapter-list li.current-chapter a:hover {
    background-color: #A52A2A;
}

/* Prev/Next chapter buttons */
.chapter-nav-buttons {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    margin-top: 15px;
}

.chapter-prev,
.chapter-next {
    display: inline-block;
    padding: 10px 20px;
    background-color: #228B22;
    color: white !important;
    text-decoration: none;
    border-radius: 5px;
    font-weight: bold;
    transition: background-color 0.2s;
}

.chapter-prev:hover,
.chapter-next:hover {
    background-color: #1a6b1a;
    text-decoration: none;
}

.chapter-next {
    margin-left: auto;
}

/* Chapter title below main title */
.chapter-title {
    font-size: 1.3em;
    font-style: italic;
    color: #666;
    margin: -5px 0 15px 0;
}

/* Responsive chapter styles */
@media (max-width: 600px) {
    .chapter-badge {
        font-size: 0.5em;
        padding: 2px 6px;
    }
    
    .chapter-indicator {
        display: block;
        margin: 10px 0 0 0;
        width: fit-content;
    }
    
    .chapter-list {
        flex-direction: column;
    }
    
    .chapter-nav-buttons {
        flex-direction: column;
    }
    
    .chapter-next {
        margin-left: 0;
    }
}

/* =============================================== */
/* --- Submit Info Page Styles --- */
/* =============================================== */

.submit-info {
    max-width: 700px;
    margin: 0 auto;
}

.submit-info .intro {
    font-size: 1.1em;
    color: #5C4033;
    margin-bottom: 30px;
}

.submit-info h2 {
    color: #A52A2A;
    margin-top: 30px;
    margin-bottom: 15px;
    font-size: 1.3em;
}

.email-highlight {
    text-align: center;
    margin: 20px 0;
}

.email-highlight a {
    font-size: 1.4em;
    color: #228B22;
    text-decoration: none;
    padding: 15px 30px;
    background-color: #f8f9fa;
    border-radius: 8px;
    display: inline-block;
}

.email-highlight a:hover {
    background-color: #e9ecef;
}

.submit-checklist {
    list-style: none;
    padding: 0;
    margin: 20px 0;
}

.submit-checklist li {
    padding: 12px 15px;
    background-color: #fff;
    border-left: 3px solid #228B22;
    margin-bottom: 10px;
    border-radius: 0 5px 5px 0;
}

.submit-checklist li strong {
    color: #A52A2A;
}

.format-examples {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin: 15px 0;
}

.format-example {
    margin-bottom: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.format-example:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.format-example code {
    background-color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-family: monospace;
    color: #A52A2A;
    margin-right: 10px;
}

.submit-cta {
    text-align: center;
    margin-top: 40px;
    padding: 30px;
    background-color: #f8f9fa;
    border-radius: 10px;
}

.submit-cta p {
    font-size: 1.2em;
    margin-bottom: 20px;
    color: #5C4033;
}
