/* Reset and Base Styles - Parchment Theme */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Parchment Color Palette */
    --parchment-light: #f9f6f0;
    --parchment-medium: #f4ede1;
    --parchment-dark: #e8dcc8;
    --ink-dark: #2c2416;
    --ink-medium: #4a3f2e;
    --ink-light: #6b5d47;
    --sepia: #8b7355;
    --accent-gold: #c9a961;
    --accent-rust: #a0522d;
    --shadow: rgba(44, 36, 22, 0.1);
    --shadow-medium: rgba(44, 36, 22, 0.15);
    --shadow-dark: rgba(44, 36, 22, 0.25);
}

body {
    font-family: 'Lora', 'Georgia', 'Garamond', serif;
    line-height: 1.8;
    color: var(--ink-dark);
    background: linear-gradient(135deg, var(--parchment-light) 0%, var(--parchment-medium) 100%);
    background-attachment: fixed;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Headings use Merriweather for elegant writing aesthetic */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Merriweather', 'Georgia', serif;
    font-weight: 700;
}

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

/* Navigation - Parchment Theme */
.navbar {
    background: linear-gradient(180deg, var(--parchment-dark) 0%, var(--parchment-medium) 100%);
    color: var(--ink-dark);
    padding: 1.25rem 0;
    box-shadow: 0 4px 12px var(--shadow-medium);
    border-bottom: 2px solid var(--accent-gold);
    position: relative;
}

.navbar::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--sepia), transparent);
}

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

.logo {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--ink-dark);
    text-decoration: none;
    font-family: 'Merriweather', serif;
    letter-spacing: 0.5px;
    text-shadow: 1px 1px 2px var(--shadow);
    transition: color 0.3s ease;
}

.logo:hover {
    color: var(--accent-rust);
}

.nav-links {
    display: flex;
    gap: 2rem;
    font-family: 'Lora', serif;
}

.nav-links a {
    color: var(--ink-medium);
    text-decoration: none;
    margin-left: 0;
    transition: all 0.3s ease;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-weight: 500;
}

.nav-links a:hover {
    color: var(--accent-rust);
    background-color: var(--parchment-light);
    box-shadow: 0 2px 6px var(--shadow);
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem 0;
}

/* Hero Section - Parchment Theme */
.hero {
    background: linear-gradient(135deg, var(--parchment-dark) 0%, var(--parchment-medium) 100%);
    color: var(--ink-dark);
    padding: 5rem 0;
    text-align: center;
    border-bottom: 3px double var(--accent-gold);
    box-shadow: inset 0 -20px 40px var(--shadow);
    position: relative;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            var(--shadow) 2px,
            var(--shadow) 3px
        );
    opacity: 0.03;
    pointer-events: none;
}

.hero h1 {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    font-weight: 600;
    color: var(--ink-dark);
    text-shadow: 2px 2px 4px var(--shadow);
    font-family: 'Georgia', serif;
    letter-spacing: 1px;
}

.subtitle {
    font-size: 1.5rem;
    margin-bottom: 2.5rem;
    color: var(--ink-medium);
    font-style: italic;
}

.hero-buttons {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
}

/* Buttons - Parchment Theme */
.btn {
    display: inline-block;
    padding: 0.875rem 1.75rem;
    border: 2px solid var(--accent-gold);
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    font-size: 1.05rem;
    font-family: 'Georgia', serif;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px var(--shadow);
    position: relative;
    overflow: hidden;
    background-color: var(--parchment-light);
    color: var(--ink-dark);
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-gold) 0%, var(--accent-rust) 100%);
    color: var(--parchment-light);
    border-color: var(--accent-rust);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--accent-rust) 0%, var(--accent-gold) 100%);
    box-shadow: 0 6px 16px var(--shadow-dark);
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: var(--parchment-light);
    color: var(--ink-dark);
    border-color: var(--sepia);
}

.btn-secondary:hover {
    background-color: var(--parchment-dark);
    box-shadow: 0 6px 16px var(--shadow-dark);
    transform: translateY(-2px);
}

.btn-danger {
    background-color: #dc3545;
    color: white;
    border-color: #dc3545;
}

.btn-danger:hover {
    background-color: #c82333;
    border-color: #bd2130;
    box-shadow: 0 6px 16px rgba(220, 53, 69, 0.3);
    transform: translateY(-2px);
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.btn-block {
    display: block;
    width: 100%;
    text-align: center;
}

.btn-compact {
    padding: 0.4rem 0.6rem;
    font-size: 0.8rem;
    flex: 1;
    white-space: nowrap;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

.btn-large {
    padding: 1.25rem 2.5rem;
    font-size: 1.3rem;
}

/* Features Section - Parchment Theme */
.features {
    padding: 5rem 0;
    background: var(--parchment-light);
}

.features h2 {
    text-align: center;
    font-size: 2.75rem;
    margin-bottom: 3.5rem;
    color: var(--ink-dark);
    font-family: 'Georgia', serif;
    font-weight: 600;
    text-shadow: 1px 1px 2px var(--shadow);
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2.5rem;
}

.feature-card {
    padding: 2.5rem;
    background: linear-gradient(135deg, var(--parchment-medium) 0%, var(--parchment-light) 100%);
    border-radius: 12px;
    border: 2px solid var(--parchment-dark);
    box-shadow: 0 6px 20px var(--shadow-medium);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--accent-gold), var(--accent-rust), var(--accent-gold));
}

.feature-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 30px var(--shadow-dark);
    border-color: var(--accent-gold);
}
    transition: transform 0.3s;
}

.feature-card h3 {
    font-size: 1.65rem;
    margin-bottom: 1rem;
    color: var(--ink-dark);
    font-family: 'Georgia', serif;
    font-weight: 600;
}

.feature-card p {
    color: var(--ink-medium);
    line-height: 1.8;
    font-size: 1.05rem;
}

/* CTA Section - Parchment Theme */
.cta {
    padding: 5rem 0;
    text-align: center;
    background: linear-gradient(135deg, var(--parchment-dark) 0%, var(--parchment-medium) 100%);
    border-top: 3px double var(--accent-gold);
    box-shadow: inset 0 20px 40px var(--shadow);
}

.cta h2 {
    font-size: 2.75rem;
    margin-bottom: 1.5rem;
    color: var(--ink-dark);
    font-family: 'Georgia', serif;
    font-weight: 600;
    text-shadow: 1px 1px 2px var(--shadow);
}

.cta p {
    font-size: 1.25rem;
    color: var(--ink-medium);
    margin-bottom: 2rem;
    font-style: italic;
}

/* Dashboard - Parchment Theme */
.dashboard {
    background: linear-gradient(135deg, var(--parchment-light) 0%, var(--parchment-medium) 100%);
    padding: 3rem;
    border-radius: 12px;
    box-shadow: 0 8px 24px var(--shadow-medium);
    border: 2px solid var(--parchment-dark);
    position: relative;
}

.dashboard::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--accent-gold), var(--accent-rust), var(--accent-gold));
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--accent-gold);
}

.stories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
}

.story-card {
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--parchment-medium) 0%, var(--parchment-light) 100%);
    border-radius: 12px;
    border: 2px solid var(--parchment-dark);
    box-shadow: 0 6px 20px var(--shadow-medium);
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    flex-direction: column;
}

.story-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-gold), var(--accent-rust));
}

.story-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 30px var(--shadow-dark);
    border-color: var(--accent-gold);
}

.story-card h3 {
    margin-bottom: 0.75rem;
    font-family: 'Georgia', serif;
    font-size: 1.3rem;
    color: var(--ink-dark);
    min-height: 3.2rem;
    line-height: 1.6rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.story-card h3 a {
    color: var(--ink-dark);
    text-decoration: none;
    transition: color 0.3s ease;
}

.story-card h3 a:hover {
    color: var(--accent-rust);
}

.story-author {
    color: var(--ink-light);
    font-size: 0.9rem;
    font-style: italic;
    margin-bottom: 0.75rem;
}

.story-description {
    color: var(--ink-medium);
    margin-bottom: 1rem;
    line-height: 1.6;
    font-size: 0.95rem;
    flex-grow: 1;
}

.story-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    margin-top: auto;
    font-size: 0.85rem;
    color: var(--ink-light);
}

.story-actions {
    display: flex;
    gap: 0.75rem;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: 'Georgia', serif;
    box-shadow: 0 2px 6px var(--shadow);
    line-height: 1;
}

.badge-success {
    background: linear-gradient(135deg, #6b8e23, #556b2f);
    color: var(--parchment-light);
}

.badge-warning {
    background: linear-gradient(135deg, var(--accent-gold), var(--accent-rust));
    color: var(--ink-dark);
}

.badge-info {
    background: linear-gradient(135deg, var(--sepia), var(--ink-light));
    color: var(--parchment-light);
}

.badge-tags {
    background: linear-gradient(135deg, #8b7355, #6b5d52);
    color: var(--parchment-light);
    cursor: help;
    transition: all 0.2s;
}

.badge-tags:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px var(--shadow-medium);
}

.badge-series {
    background: linear-gradient(135deg, var(--accent-rust), var(--accent-gold));
    color: white;
    cursor: help;
    transition: all 0.2s;
}

.badge-series:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px var(--shadow-medium);
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-state h2 {
    margin-bottom: 1rem;
    color: #6c757d;
}

/* Editor */
.editor-container {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 2rem;
    min-height: calc(100vh - 200px);
    align-items: start;
}

.editor-sidebar {
    background-color: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow-y: auto;
}

.story-info h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.editor-actions {
    display: flex;
    gap: 0.4rem;
    margin: 1rem 0 1.5rem 0;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--parchment-dark);
    flex-wrap: nowrap;
}

.back-link {
    color: var(--accent-rust);
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 600;
    font-family: 'Georgia', serif;
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    background-color: var(--parchment-light);
    border: 2px solid var(--parchment-dark);
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px var(--shadow);
}

.back-link:hover {
    background-color: var(--parchment-dark);
    border-color: var(--accent-gold);
    color: var(--accent-gold);
    box-shadow: 0 4px 12px var(--shadow-medium);
    transform: translateX(-4px);
}

.tags-section {
    margin: 1.5rem 0;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--parchment-dark);
}

.tags-section h3 {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--ink-light);
    margin-bottom: 0.75rem;
}

.story-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    min-height: 2rem;
}

.no-tags {
    font-size: 0.85rem;
    color: var(--ink-light);
    font-style: italic;
}

.tag-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.6rem;
    background: linear-gradient(135deg, var(--accent-gold), var(--accent-rust));
    color: var(--ink-dark);
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    box-shadow: 0 2px 4px var(--shadow);
}

.tag-remove {
    background: none;
    border: none;
    color: var(--ink-dark);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    margin: 0;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.tag-remove:hover {
    opacity: 1;
}

.tag-selector {
    margin-top: 0.5rem;
}

.tag-select {
    width: 100%;
    padding: 0.5rem;
    border: 2px solid var(--parchment-dark);
    border-radius: 6px;
    background: var(--parchment-light);
    color: var(--ink-dark);
    font-family: 'Georgia', serif;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.tag-select:hover {
    border-color: var(--accent-gold);
}

.tag-select:focus {
    outline: none;
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 3px rgba(184, 134, 11, 0.1);
}

/* ============================================================================
   Series Section
   ============================================================================ */

.series-section {
    margin: 2rem 0;
    padding-top: 1.5rem;
    border-top: 2px solid var(--parchment-dark);
}

.series-section h3 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    color: var(--ink-dark);
}

.story-series {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
    min-height: 2rem;
}

.no-series {
    color: var(--ink-light);
    font-size: 0.9rem;
    font-style: italic;
}

.series-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: linear-gradient(135deg, var(--accent-rust), var(--accent-gold));
    color: white;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.2s;
}

.series-pill:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.series-name {
    font-weight: 600;
}

.series-remove {
    background: rgba(255, 255, 255, 0.3);
    border: none;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    opacity: 0.8;
}

.series-remove:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.5);
}

.series-add-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.series-input-row {
    display: flex;
    gap: 0.5rem;
}

.series-input {
    padding: 0.5rem;
    border: 2px solid var(--parchment-dark);
    border-radius: 6px;
    background: var(--parchment-light);
    color: var(--ink-dark);
    font-size: 0.85rem;
    transition: all 0.2s;
}

#seriesNameInput {
    flex: 1;
}

#seriesPositionInput {
    width: 70px;
}

.series-input:focus {
    outline: none;
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 3px rgba(184, 134, 11, 0.1);
}

#addSeriesBtn {
    width: 100%;
}

.drafts-section {
    margin: 2rem 0;
}

.drafts-list {
    list-style: none;
    max-height: 400px; /* ~5 drafts at ~80px each */
    overflow-y: auto;
    padding-right: 0.5rem;
}

.drafts-list::-webkit-scrollbar {
    width: 6px;
}

.drafts-list::-webkit-scrollbar-track {
    background: var(--parchment-light);
    border-radius: 3px;
}

.drafts-list::-webkit-scrollbar-thumb {
    background: var(--parchment-dark);
    border-radius: 3px;
}

.drafts-list::-webkit-scrollbar-thumb:hover {
    background: var(--accent-gold);
}

.draft-item {
    margin-bottom: 0.5rem;
}

.draft-item a {
    display: block;
    padding: 0.75rem;
    background-color: #f8f9fa;
    border-radius: 4px;
    text-decoration: none;
    color: #333;
    transition: background-color 0.3s;
}

.draft-item a:hover, .draft-item.active a {
    background-color: #e9ecef;
}

.draft-item strong {
    display: block;
}

.draft-date, .draft-words {
    font-size: 0.85rem;
    color: #6c757d;
    margin-right: 0.5rem;
}

.editor-main {
    background-color: white;
    padding: 2rem;
    padding-bottom: 3rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    margin-bottom: 2rem;
}

.editor-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e9ecef;
}

.draft-title-input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 1.2rem;
    margin-right: 1rem;
}

#editor {
    flex: 1;
    min-height: 400px;
}

.editor-notes {
    margin-top: 1rem;
    margin-bottom: 3rem;
    padding-top: 1rem;
    padding-bottom: 2rem;
    border-top: 1px solid #e9ecef;
}

.editor-notes label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--ink-dark);
    font-weight: 500;
}

.editor-notes textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--parchment-dark);
    border-radius: 8px;
    resize: vertical;
    min-height: 80px;
    font-family: 'Georgia', serif;
    background: var(--parchment-light);
    color: var(--ink-dark);
}

/* Draft View Page */
.draft-view {
    padding: 2rem 0;
    margin-bottom: 3rem;
}

.draft-header {
    background: linear-gradient(135deg, var(--parchment-light) 0%, var(--parchment-medium) 100%);
    padding: 2.5rem;
    border-radius: 12px;
    border: 2px solid var(--parchment-dark);
    box-shadow: 0 6px 20px var(--shadow-medium);
    margin-bottom: 2rem;
}

.draft-header h1 {
    margin: 1rem 0;
    color: var(--ink-dark);
    font-family: 'Merriweather', serif;
}

.draft-meta {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin: 1rem 0;
    color: var(--ink-medium);
}

.draft-version {
    font-weight: 600;
    color: var(--accent-rust);
}

.draft-controls {
    margin-top: 1.5rem;
    display: flex;
    gap: 1rem;
    align-items: center;
}

.draft-notes-display {
    background: var(--parchment-light);
    padding: 2rem;
    border-radius: 12px;
    border: 2px solid var(--parchment-dark);
    margin-bottom: 2rem;
    box-shadow: 0 4px 12px var(--shadow);
}

.draft-notes-display h3 {
    color: var(--ink-dark);
    margin-bottom: 1rem;
    font-family: 'Merriweather', serif;
}

.draft-notes-display p {
    color: var(--ink-medium);
    line-height: 1.8;
}

.draft-content {
    background: white;
    padding: 3rem;
    border-radius: 12px;
    box-shadow: 0 6px 20px var(--shadow-medium);
    margin-bottom: 3rem;
    min-height: 400px;
    line-height: 1.8;
    font-size: 1.1rem;
}

.draft-content p {
    margin-bottom: 1.5rem;
}

/* Footer - Parchment Theme */
.footer {
    background: linear-gradient(180deg, var(--parchment-medium) 0%, var(--parchment-dark) 100%);
    color: var(--ink-dark);
    padding: 2.5rem 0;
    text-align: center;
    border-top: 3px double var(--accent-gold);
    box-shadow: 0 -4px 12px var(--shadow-medium);
    margin-top: 4rem;
}

.footer p {
    font-family: 'Georgia', serif;
    font-size: 1.05rem;
}

.footer a {
    color: var(--accent-rust);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.footer a:hover {
    color: var(--accent-gold);
    text-decoration: underline;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: white;
    margin: 10% auto;
    padding: 2rem;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
}

.close {
    float: right;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: #667eea;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.75rem;
    font-weight: 600;
    color: var(--ink-dark);
    font-family: 'Georgia', serif;
    font-size: 1.05rem;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group textarea {
    width: 100%;
    padding: 0.875rem;
    border: 2px solid var(--parchment-dark);
    border-radius: 8px;
    background-color: var(--parchment-light);
    color: var(--ink-dark);
    font-family: 'Georgia', serif;
    font-size: 1.05rem;
    transition: all 0.3s ease;
    box-shadow: inset 0 2px 4px var(--shadow);
}

.form-group input[type="text"]:focus,
.form-group input[type="email"]:focus,
.form-group input[type="password"]:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 3px rgba(201, 169, 97, 0.2), inset 0 2px 4px var(--shadow);
}

/* Auth Pages - Parchment Theme */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 200px);
    padding: 3rem 0;
}

.auth-card {
    background: linear-gradient(135deg, var(--parchment-light) 0%, var(--parchment-medium) 100%);
    padding: 3.5rem;
    border-radius: 16px;
    box-shadow: 0 12px 40px var(--shadow-dark);
    width: 100%;
    max-width: 500px;
    border: 3px solid var(--parchment-dark);
    position: relative;
}

.auth-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, var(--accent-gold), var(--accent-rust), var(--accent-gold));
    border-radius: 16px 16px 0 0;
}

.auth-card h1 {
    text-align: center;
    margin-bottom: 2.5rem;
    color: var(--ink-dark);
    font-family: 'Georgia', serif;
    font-size: 2.25rem;
    font-weight: 600;
    text-shadow: 1px 1px 2px var(--shadow);
}

.auth-form {
    margin-bottom: 2rem;
}

.auth-form .form-group {
    margin-bottom: 1.75rem;
}

.auth-form small {
    display: block;
    margin-top: 0.5rem;
    color: var(--ink-light);
    font-size: 0.95rem;
    font-style: italic;
}

.auth-link {
    text-align: center;
    color: var(--ink-medium);
    font-size: 1.05rem;
}

.auth-link a {
    color: var(--accent-rust);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.auth-link a:hover {
    color: var(--accent-gold);
    text-decoration: underline;
}

/* Public Reading Interface - Parchment Theme */
/* Note: Public stories page now uses .dashboard-header and .story-card for consistency */

/* Read Story Page */
.read-story-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 0;
}

.story-header {
    margin-bottom: 3rem;
}

.story-title {
    font-size: 2.5rem;
    margin: 1rem 0;
    color: #2c3e50;
}

.story-byline {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: #6c757d;
    font-size: 1rem;
}

.story-byline .author {
    font-weight: bold;
}

.story-tags-display {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
    align-items: center;
}

.story-tag-link {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    background: linear-gradient(135deg, var(--accent-gold), var(--accent-rust));
    color: var(--ink-dark);
    text-decoration: none;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: 0 2px 4px var(--shadow);
    transition: all 0.2s;
}

.story-tag-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px var(--shadow-medium);
}

.more-tags {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    background: linear-gradient(135deg, #8b7355, #6b5d52);
    color: var(--parchment-light);
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: help;
    box-shadow: 0 2px 4px var(--shadow);
    transition: all 0.2s;
}

.more-tags:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px var(--shadow-medium);
}

.story-series-display {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
    align-items: center;
}

.story-series-link {
    display: inline-block;
    padding: 0.4rem 0.85rem;
    background: linear-gradient(135deg, var(--accent-rust), var(--accent-gold));
    color: white;
    text-decoration: none;
    border-radius: 14px;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 2px 4px var(--shadow);
    transition: all 0.2s;
}

.story-series-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px var(--shadow-medium);
    color: white;
}

.story-content {
    background-color: white;
    padding: 3rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 3rem;
    line-height: 1.8;
    font-size: 1.1rem;
}

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

/* Add paragraph spacing in the editor */
.ql-editor p {
    margin-bottom: 1rem;
}

.ql-editor p:last-child {
    margin-bottom: 0;
}

.story-content h1,
.story-content h2,
.story-content h3 {
    margin-top: 2rem;
    margin-bottom: 1rem;
}

/* Comments Section - Enhanced Parchment Theme */
.comments-section {
    background: linear-gradient(135deg, var(--parchment-light) 0%, var(--parchment-medium) 100%);
    padding: 3rem;
    border-radius: 16px;
    box-shadow: 0 8px 24px var(--shadow-medium);
    border: 2px solid var(--parchment-dark);
    margin-top: 3rem;
    position: relative;
}

.comments-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--accent-gold), var(--accent-rust), var(--accent-gold));
    border-radius: 16px 16px 0 0;
}

.comments-section h2 {
    margin-bottom: 0.75rem;
    color: var(--ink-dark);
    font-family: 'Merriweather', serif;
    font-size: 2rem;
}

.comments-intro {
    color: var(--ink-medium);
    font-size: 1.1rem;
    margin-bottom: 2rem;
    font-style: italic;
}

.comment-form {
    margin-bottom: 3rem;
    padding: 2.5rem;
    background: var(--parchment-light);
    border-radius: 12px;
    border: 2px solid var(--parchment-dark);
    box-shadow: 0 4px 12px var(--shadow);
}

/* Comment Editor (Quill) Styling */
.comment-editor {
    background-color: var(--parchment-light);
    border: 2px solid var(--parchment-dark);
    border-radius: 8px;
    box-shadow: inset 0 2px 4px var(--shadow);
    transition: all 0.3s ease;
    min-height: 250px;
    margin-bottom: 0.5rem;
}

.comment-editor:focus-within {
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 3px rgba(201, 169, 97, 0.2), inset 0 2px 4px var(--shadow);
}

.comment-editor .ql-toolbar {
    background: linear-gradient(135deg, var(--parchment-medium) 0%, var(--parchment-light) 100%);
    border: none;
    border-bottom: 2px solid var(--parchment-dark);
    border-radius: 8px 8px 0 0;
    padding: 1rem;
}

.comment-editor .ql-container {
    border: none;
    font-family: 'Lora', serif;
    font-size: 1.1rem;
    min-height: 200px;
}

.comment-editor .ql-editor {
    min-height: 200px;
    padding: 1.25rem;
    color: var(--ink-dark);
    line-height: 1.8;
}

.comment-editor .ql-editor.ql-blank::before {
    color: var(--ink-light);
    font-style: italic;
}

/* Quill toolbar button styling */
.comment-editor .ql-toolbar button {
    color: var(--ink-dark);
}

.comment-editor .ql-toolbar button:hover {
    color: var(--accent-gold);
}

.comment-editor .ql-toolbar button.ql-active {
    color: var(--accent-rust);
}

.comment-editor .ql-stroke {
    stroke: var(--ink-dark);
}

.comment-editor .ql-toolbar button:hover .ql-stroke {
    stroke: var(--accent-gold);
}

.comment-editor .ql-toolbar button.ql-active .ql-stroke {
    stroke: var(--accent-rust);
}

.comment-editor .ql-fill {
    fill: var(--ink-dark);
}

.comment-editor .ql-toolbar button:hover .ql-fill {
    fill: var(--accent-gold);
}

.comment-editor .ql-toolbar button.ql-active .ql-fill {
    fill: var(--accent-rust);
}

.form-hint {
    display: block;
    margin-top: 0.5rem;
    color: var(--ink-light);
    font-size: 0.95rem;
    font-style: italic;
}

.checkbox-label {
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
    cursor: pointer;
    padding: 1rem;
    background: var(--parchment-medium);
    border-radius: 8px;
    border: 2px solid var(--parchment-dark);
    transition: all 0.3s ease;
}

.checkbox-label:hover {
    background: var(--parchment-dark);
    border-color: var(--accent-gold);
}

.checkbox-label input[type="checkbox"] {
    margin-right: 0.75rem;
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.checkbox-label span {
    color: var(--ink-dark);
    font-size: 1.05rem;
    font-weight: 500;
}

.comments-list {
    margin-top: 3rem;
}

.comment {
    padding: 2rem;
    background: linear-gradient(135deg, var(--parchment-medium) 0%, var(--parchment-light) 100%);
    border-radius: 12px;
    border: 2px solid var(--parchment-dark);
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 12px var(--shadow);
    transition: all 0.3s ease;
}

.comment:hover {
    box-shadow: 0 6px 20px var(--shadow-medium);
    transform: translateY(-2px);
}

.comment.proofreading-comment {
    background: linear-gradient(135deg, #e8f4f8 0%, #d4e9f0 100%);
    border-left: 5px solid var(--sepia);
}

.comment-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--parchment-dark);
}

.comment-header strong {
    color: var(--ink-dark);
    font-family: 'Merriweather', serif;
    font-size: 1.1rem;
}

.comment-date {
    color: var(--ink-light);
    font-size: 0.95rem;
    font-style: italic;
}

.comment-content {
    color: var(--ink-dark);
    line-height: 1.8;
    font-size: 1.05rem;
    white-space: pre-wrap;
}

.no-comments {
    text-align: center;
    color: var(--ink-light);
    padding: 3rem;
    font-size: 1.1rem;
    font-style: italic;
}

.form-input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #dee2e6;
    border-radius: 4px;
}

/* Diff/Compare View - Parchment Theme */
.compare-header {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--accent-gold);
}

.compare-header h1 {
    margin-top: 1rem;
    color: var(--ink-dark);
    font-family: 'Merriweather', serif;
}

.version-selector {
    display: flex;
    gap: 1.5rem;
    align-items: flex-end;
    margin-bottom: 2.5rem;
    padding: 2rem;
    background: linear-gradient(135deg, var(--parchment-medium) 0%, var(--parchment-light) 100%);
    border-radius: 12px;
    border: 2px solid var(--parchment-dark);
    box-shadow: 0 4px 12px var(--shadow-medium);
}

.selector-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.selector-group label {
    font-weight: 600;
    color: var(--ink-dark);
    font-family: 'Merriweather', serif;
    font-size: 1.05rem;
}

.version-select {
    padding: 0.75rem;
    border: 2px solid var(--parchment-dark);
    border-radius: 8px;
    background-color: var(--parchment-light);
    color: var(--ink-dark);
    font-family: 'Lora', serif;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.version-select:focus {
    outline: none;
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 3px rgba(201, 169, 97, 0.2);
}

.diff-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.diff-panel {
    background: linear-gradient(135deg, var(--parchment-light) 0%, var(--parchment-medium) 100%);
    border: 2px solid var(--parchment-dark);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 6px 20px var(--shadow-medium);
}

.diff-header {
    background: linear-gradient(135deg, var(--parchment-dark) 0%, var(--parchment-medium) 100%);
    padding: 1.5rem;
    border-bottom: 2px solid var(--accent-gold);
}

.diff-header h3 {
    margin: 0 0 0.5rem 0;
    color: var(--ink-dark);
    font-family: 'Merriweather', serif;
    font-size: 1.5rem;
}

.diff-date {
    color: var(--ink-light);
    font-size: 0.95rem;
    font-style: italic;
}

.diff-content {
    padding: 2rem;
    min-height: 400px;
    max-height: 800px;
    overflow-y: auto;
    line-height: 1.8;
    font-family: 'Lora', serif;
    font-size: 1.05rem;
    color: var(--ink-dark);
}

.diff-content p {
    margin-bottom: 1rem;
}

/* Diff highlighting */
.diff-added {
    background-color: rgba(144, 238, 144, 0.3);
    border-left: 3px solid #90ee90;
    padding-left: 0.5rem;
}

.diff-removed {
    background-color: rgba(255, 182, 193, 0.3);
    border-left: 3px solid #ffb6c1;
    padding-left: 0.5rem;
    text-decoration: line-through;
}

.diff-modified {
    background-color: rgba(255, 255, 153, 0.3);
    border-left: 3px solid #ffff99;
    padding-left: 0.5rem;
}

.diff-legend {
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--parchment-medium) 0%, var(--parchment-light) 100%);
    border-radius: 12px;
    border: 2px solid var(--parchment-dark);
    box-shadow: 0 4px 12px var(--shadow-medium);
}

.diff-legend h3 {
    margin-bottom: 1rem;
    color: var(--ink-dark);
    font-family: 'Merriweather', serif;
}

.legend-items {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.legend-color {
    width: 40px;
    height: 24px;
    border-radius: 4px;
    border: 1px solid var(--ink-light);
}

.legend-color.added {
    background-color: rgba(144, 238, 144, 0.5);
    border-left: 3px solid #90ee90;
}

.legend-color.removed {
    background-color: rgba(255, 182, 193, 0.5);
    border-left: 3px solid #ffb6c1;
}

.legend-color.modified {
    background-color: rgba(255, 255, 153, 0.5);
    border-left: 3px solid #ffff99;
}

/* Responsive diff view */
@media (max-width: 768px) {
    .container {
        padding: 0 24px;
    }

    .diff-container {
        grid-template-columns: 1fr;
    }

    .version-selector {
        flex-direction: column;
        align-items: stretch;
    }
}

/* Inline Comments */
.inline-comment-popup {
    position: absolute;
    z-index: 1000;
    background: linear-gradient(135deg, var(--parchment-medium) 0%, var(--parchment-light) 100%);
    border: 2px solid var(--accent-gold);
    border-radius: 8px;
    padding: 0.5rem;
    box-shadow: 0 6px 20px var(--shadow-dark);
}

.inline-comment-popup .btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.95rem;
    white-space: nowrap;
}

/* Modal for inline comments */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(44, 36, 22, 0.7);
    align-items: center;
    justify-content: center;
    overflow-y: auto;
}

.modal-content {
    background: linear-gradient(135deg, var(--parchment-light) 0%, var(--parchment-medium) 100%);
    border: 3px solid var(--accent-gold);
    border-radius: 16px;
    width: 90%;
    max-width: 700px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px var(--shadow-dark);
    position: relative;
    margin: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem;
    border-bottom: 2px solid var(--accent-gold);
    background: linear-gradient(135deg, var(--parchment-dark) 0%, var(--parchment-medium) 100%);
    border-radius: 13px 13px 0 0;
}

.modal-header h3 {
    margin: 0;
    color: var(--ink-dark);
    font-family: 'Merriweather', serif;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--ink-dark);
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background-color: var(--accent-rust);
    color: var(--parchment-light);
    transform: rotate(90deg);
}

.modal-body {
    padding: 2rem;
}

.selected-text-preview {
    background: var(--parchment-dark);
    border-left: 4px solid var(--accent-gold);
    padding: 1.5rem;
    margin-bottom: 2rem;
    border-radius: 8px;
}

.selected-text-preview strong {
    display: block;
    margin-bottom: 0.75rem;
    color: var(--ink-dark);
    font-family: 'Merriweather', serif;
}

.text-preview {
    color: var(--ink-medium);
    font-style: italic;
    line-height: 1.6;
    margin: 0;
}

/* Inline comment indicators in story content */
.story-content .has-inline-comment {
    background-color: rgba(201, 169, 97, 0.15);
    border-bottom: 2px dotted var(--accent-gold);
    cursor: pointer;
    transition: all 0.3s ease;
}

.story-content .has-inline-comment:hover {
    background-color: rgba(201, 169, 97, 0.3);
}

/* Grammar Check Modal */
.grammar-modal-content {
    max-width: 900px;
    max-height: 75vh;
    margin: auto;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Prevent double scrollbars */
}

.grammar-modal-content .modal-header {
    flex-shrink: 0;
    padding: 1.5rem 2rem;
}

.grammar-modal-content .modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 2rem;
    min-height: 0; /* Important for flexbox scrolling */
}

.grammar-modal-content .modal-footer {
    flex-shrink: 0;
    padding: 1rem 2rem;
    border-top: 2px solid var(--parchment-dark);
    background: var(--parchment-light);
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.grammar-results {
    /* Results container - scrolling handled by modal-body */
}

.grammar-loading {
    text-align: center;
    color: var(--ink-medium);
    font-style: italic;
    padding: 2rem;
}

.grammar-error {
    color: var(--accent-rust);
    padding: 1rem;
    background: rgba(160, 82, 45, 0.1);
    border-radius: 8px;
    border-left: 4px solid var(--accent-rust);
}

.grammar-success {
    text-align: center;
    padding: 2rem;
    background: rgba(144, 238, 144, 0.2);
    border-radius: 8px;
    border: 2px solid #90ee90;
}

.grammar-success h5 {
    color: #2d5016;
    margin-bottom: 0.5rem;
    font-family: 'Merriweather', serif;
}

.grammar-summary {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--parchment-dark);
    border-radius: 8px;
    border-left: 4px solid var(--accent-gold);
}

.grammar-summary h5 {
    margin: 0;
    color: var(--ink-dark);
    font-family: 'Merriweather', serif;
}

.grammar-matches {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.grammar-match {
    padding: 2rem;
    background: var(--parchment-light);
    border: 2px solid var(--parchment-dark);
    border-radius: 12px;
    transition: all 0.3s ease;
}

.grammar-match:hover {
    box-shadow: 0 6px 16px var(--shadow-medium);
    transform: translateY(-2px);
    border-color: var(--accent-gold);
}

.match-header {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 0.75rem;
}

.match-number {
    background: var(--accent-gold);
    color: var(--ink-dark);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
}

.match-category {
    background: var(--parchment-dark);
    color: var(--ink-medium);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    text-transform: uppercase;
}

.match-message {
    color: var(--ink-dark);
    font-size: 1.1rem;
    margin-bottom: 1rem;
    line-height: 1.7;
    font-weight: 500;
}

.match-original {
    background: #fff3cd;
    border: 2px solid #ffc107;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 1rem;
}

.match-original strong {
    color: #856404;
    margin-right: 0.5rem;
}

.original-text {
    font-family: 'Lora', serif;
    font-weight: 600;
    color: #856404;
    background: #fff;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    border: 1px solid #ffc107;
}

.match-context {
    background: var(--parchment-medium);
    padding: 1rem 1.25rem;
    border-radius: 8px;
    font-family: 'Lora', serif;
    font-style: italic;
    color: var(--ink-medium);
    margin-bottom: 1rem;
    border-left: 4px solid var(--accent-rust);
    font-size: 1.05rem;
    line-height: 1.6;
}

.match-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.match-suggestions strong {
    color: var(--ink-dark);
    font-family: 'Merriweather', serif;
    font-size: 1.05rem;
    margin-right: 0.5rem;
}

.replacement {
    background: linear-gradient(135deg, #90ee90 0%, #7ed97e 100%);
    color: #2d5016;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1.05rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid #7ed97e;
}

.replacement:hover {
    background: linear-gradient(135deg, #7ed97e 0%, #6bc96b 100%);
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.grammar-match.accepted {
    opacity: 0.6;
    background: #e8f5e9;
    border-color: #4caf50;
}

.grammar-match.rejected {
    opacity: 0.5;
    background: #fafafa;
    border-color: #ccc;
}

.grammar-match.accepted .replacement,
.grammar-match.rejected .replacement {
    pointer-events: none;
    opacity: 0.5;
}

