/* Color Palette */
:root {
    --dark-bg: #002a36;
    --darker-bg: #00313d;
    --mid-dark: #093b4d;
    --light-text: #c7c0a7;
    --mid-light: #81a1a1;
    --green-accent: #859900;
    --purple-accent: #d33682;
    --orange-accent: #cb4b16;
    --red-accent: #dc322f;
    --cyan-accent: #2aa198;
    --font-serif: 'Baskerville URW', serif;
    --spacing: 1rem;
    --radius: 8px;
    --blue-light: #093b4d;
    --blue-dark: rgba(9, 59, 77, 0.8);
    --accent-light: rgba(133, 153, 0, 0.3);
    --accent-lighter: rgba(133, 153, 0, 0.2);
    --text-muted: rgba(199, 192, 167, 0.5);
}

/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
} 

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-serif);
    background: var(--dark-bg);
    color: var(--light-text);
    line-height: 1.6;
    min-height: 100vh;
}

/* Navigation Bar */
.navbar {
    background: var(--mid-dark);
    padding: 0.75rem 0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-content {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 calc(280px + 2rem) 0 2rem;
}

.nav-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--purple-accent);
    cursor: pointer;
}

.nav-title:hover {
    color: var(--light-text);
}

.nav-logo {
    height: 60px;
    width: auto;
    padding-left: 1.5rem;
    margin-right: auto;
    cursor: pointer;
    transition: filter 0.3s ease;
}

.nav-logo:hover {
    filter: drop-shadow(0 0 8px rgba(133, 153, 0, 0.8));
}

.nav-links {
    display: flex;
    gap: 3rem;
    margin-right: 0;
}

.nav-links a {
    color: var(--light-text);
    text-decoration: none;
    font-size: 1.8rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    transition: all 0.3s ease;
}

.nav-links a:hover {
    background: rgba(133, 153, 0, 0.2);
    color: var(--green-accent);
}

/* Sidebar Navigation */
.sidebar {
    position: fixed;
    left: 0;
    top: 80px;
    width: 280px;
    height: calc(100vh - 80px);
    background: var(--darker-bg);
    border-right: 2px solid var(--green-accent);
    padding: 2rem 0;
    z-index: 95;
    overflow-y: auto;
    display: none;
}

.sidebar.visible {
    display: block;
    transform: translateX(0);
}

.sidebar.active {
    transform: translateX(0);
}


.sidebar-header {
    padding: 0 1.5rem 1.5rem;
    border-bottom: 1px solid rgba(133, 153, 0, 0.2);
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
}

.project-name {
    font-size: 1.5rem;
    color: var(--green-accent);
    font-weight: 700;
    word-break: break-word;
    /* padding-top: 1.2rem; */
}

.sidebar-close {
    display: none;
    background: none;
    border: none;
    color: var(--light-text);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.sidebar-nav a {
    display: block;
    padding: 1rem 1.5rem;
    color: var(--light-text);
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 700;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.sidebar-nav a:hover {
    background: rgba(133, 153, 0, 0.15);
    color: var(--green-accent);
    border-left-color: var(--green-accent);
}

.sidebar-nav a.active {
    background: rgba(133, 153, 0, 0.2);
    color: var(--green-accent);
    border-left-color: var(--green-accent);
}

.sidebar-nav a.sidebar-child {
    padding-left: 3rem;
    font-size: 1rem;
    font-weight: 700;
    color: rgba(203, 75, 22, 0.8);
}

.sidebar-nav a.sidebar-child:hover {
    background: rgba(203, 75, 22, 0.15);
    color: var(--orange-accent);
    border-left-color: var(--orange-accent);
}

.sidebar-nav a.sidebar-child.active {
    background: rgba(203, 75, 22, 0.15);
    color: var(--orange-accent);
}

.sidebar-nav a.main-idea-link {
    color: var(--purple-accent);
}

.sidebar-nav a.main-idea-link:hover {
    color: var(--purple-accent);
    background: rgba(211, 54, 130, 0.15);
    border-left-color: var(--purple-accent);
}

.sidebar-nav a.plot-structure-link {
    color: var(--orange-accent);
}

.sidebar-nav a.plot-structure-link:hover {
    color: var(--orange-accent);
    background: rgba(203, 75, 22, 0.15);
    border-left-color: var(--orange-accent);
}

.sidebar-nav a.plot-chart-link {
    color: var(--cyan-accent);
}

.sidebar-nav a.plot-chart-link:hover {
    color: var(--cyan-accent);
    background: rgba(42, 161, 152, 0.15);
    border-left-color: var(--cyan-accent);
}

.sidebar-nav a.back-to-projects-link {
    color: var(--red-accent);
}

.sidebar-nav a.back-to-projects-link:hover {
    color: var(--red-accent);
    background: rgba(220, 50, 47, 0.15);
    border-left-color: var(--red-accent);
}

/* Sidebar Toggle Button */
.sidebar-toggle {
    position: fixed;
    left: 1rem;
    top: 1.2rem;
    width: 40px;
    height: 40px;
    background: var(--green-accent);
    color: var(--dark-bg);
    border: none;
    border-radius: var(--radius);
    font-size: 1.3rem;
    cursor: pointer;
    z-index: 96;
    transition: all 0.3s ease;
    display: none;
}

.sidebar-toggle:hover {
    background: #9db80d;
    transform: scale(1.05);
}

.sidebar.active ~ .sidebar-toggle {
    left: 290px;
}

/* Pages Container */
.page {
    display: none;
    animation: fadeIn 0.3s ease-in;
    min-height: calc(100vh - 80px);
    padding: 0 2rem 200px 2rem;
}

.page.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Container */
.container {
    max-width: 1000px;
    margin: 0 auto;
    padding-left: 0;
    padding-right: 0;
    padding-top: 2rem;
}

#home .container {
    position: relative;
    z-index: 10;
    
}

#home h1,
#home .subtitle {
    position: relative;
    z-index: 10;
}

/* Typography */
h1 {
    font-size: 4rem;
    font-weight: 700;
    color: var(--light-text);
    margin-bottom: 1rem;
    letter-spacing: 0.5px;
}

h2 {
    font-size: 2.5rem;
    font-weight: 500;
    color: var(--light-text);
    margin-bottom: 1rem;
    letter-spacing: 0.25px;
}

h3 {
    font-size: 2.8rem;
    font-weight: 500;
    color: var(--green-accent);
    margin-bottom: 1rem;
    letter-spacing: 0.15px;
}

.subtitle {
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--mid-light);
    margin-bottom: 2rem;
    letter-spacing: 0.3px;
}

.page-subtitle {
    font-size: 2rem;
    color: var(--mid-light);
    margin-bottom: 2rem;
    margin-top: -1rem;
}

p {
    font-size: 1.5rem;
    line-height: 1.8;
    color: var(--light-text);
    margin-bottom: 1.5rem;
}

/* Home Page */
.introduction-section {
    background: rgba(9, 59, 77, 0.8);
    padding: 2rem;
    border-radius: var(--radius);
    position: relative;
    z-index: 10;
    text-align: left;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
}

.home-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin: 2.5rem 0;
    align-items: stretch;
}

.introduction-section h1 {
    margin-bottom: 0.5rem;
}

.introduction-section .subtitle {
    margin-bottom: 1.5rem;
}

.carousel-section {
    position: relative;
    z-index: 10;
    overflow: hidden;
    border-radius: var(--radius);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
}

.carousel-container {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 400px;
}

.carousel-wrapper {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.carousel-track {
    display: flex;
    transition: transform 0.5s ease-in-out;
    height: 100%;
}

.carousel-slide {
    min-width: 100%;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.cta {
    text-align: center;
    padding: 0.5rem;
    margin-top: 0.5rem;
}

/* Buttons */
.btn-primary,
.btn-secondary {
    padding: 0.75rem 2rem;
    font-size: 1rem;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-family: var(--font-serif);
    font-weight: 600;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: var(--green-accent);
    color: white;
    padding: 1.5rem 4rem;
    font-size: 1.5rem;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
}

.btn-primary:hover {
    background: #9db80d;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(133, 153, 0, 0.3);
}

.btn-secondary {
    background: transparent;
    color: var(--green-accent);
    border: 2px solid var(--green-accent);
}

.btn-secondary:hover {
    background: var(--green-accent);
    color: var(--dark-bg);
}

/* Projects Page */
.projects-controls {
    display: flex;
    gap: 1rem;
    margin: 2rem 0;
}

.input-field {
    flex: 1;
    padding: 0.75rem;
    border: 2px solid var(--mid-dark);
    border-radius: var(--radius);
    background: var(--dark-bg);
    color: var(--light-text);
    font-family: var(--font-serif);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.input-field:focus {
    outline: none;
    border-color: var(--green-accent);
    background: var(--blue-dark);
    box-shadow: 0 0 8px var(--accent-lighter);
}

.input-field::placeholder {
    color: var(--text-muted);
}

.projects-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.project-card {
    background: var(--blue-light);
    padding: 1.5rem;
    border-radius: var(--radius);
    border: 2px solid var(--accent-light);
    transition: all 0.3s ease;
    cursor: pointer;
}

.project-card:hover {
    border-color: var(--green-accent);
    background: var(--blue-dark);
    box-shadow: 0 4px 12px var(--accent-lighter);
}

.project-card h3 {
    margin-bottom: 0.5rem;
    font-size: 1.3rem;
}

.project-card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    flex: 1;
    text-align: center;
}

.btn-delete {
    background: #8b3a3a;
    color: var(--light-text);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-family: var(--font-serif);
    transition: all 0.3s ease;
}

.btn-delete:hover {
    background: #a94545;
}

/* Forms */
.form-section {
    background: var(--blue-light);
    padding: 2rem;
    border-radius: var(--radius);
    margin: 2rem 0;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--light-text);
    font-size: 1.5rem;
}

.example-hint {
    display: block;
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
    color: var(--mid-light);
    font-style: italic;
}

.section-summary {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    color: var(--light-text);
    font-style: normal;
    font-weight: 300;
    line-height: 1.1;
}

.textarea-field {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--mid-dark);
    border-radius: var(--radius);
    background: var(--dark-bg);
    color: var(--light-text);
    font-family: var(--font-serif);
    font-size: 1rem;
    min-height: 100px;
    resize: vertical;
    transition: all 0.3s ease;
}

.textarea-field:focus {
    outline: none;
    border-color: var(--green-accent);
    background: var(--blue-dark);
    box-shadow: 0 0 8px var(--accent-lighter);
}

.textarea-field::placeholder {
    color: var(--text-muted);
}

select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--mid-dark);
    border-radius: var(--radius);
    background: var(--blue-dark);
    color: var(--light-text);
    font-family: var(--font-serif);
    font-size: 1rem;
    transition: all 0.3s ease;
}

select:focus {
    outline: none;
    border-color: var(--green-accent);
    background: var(--blue-dark);
}

select option {
    background: var(--darker-bg);
    color: var(--light-text);
}

/* Themes Container */
.themes-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.theme-input {
    width: 100%;
}

/* Conflict Section */
.conflict-section {
    background: transparent;
    padding: 0;
    border-radius: var(--radius);
    margin: 0;
}

.conflict-section h3 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

/* Plot Structure Grid */
.plot-structure-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

.structure-card {
    background: var(--blue-light);
    padding: 2rem;
    border-radius: var(--radius);
    border: 2px solid var(--accent-light);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.structure-card:hover {
    border-color: var(--green-accent);
    background: var(--blue-dark);
    transform: translateY(-4px);
    box-shadow: 0 6px 16px var(--accent-lighter);
}

.structure-card h2 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
}

.structure-card p {
    font-size: 1.4rem;
    color: var(--mid-light);
    margin-bottom: 1.5rem;
}

.structure-card .arrow {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 2rem;
    color: var(--green-accent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.structure-card:hover .arrow {
    opacity: 1;
}

/* Rising Actions */
.rising-action-item {
    background: transparent;
    padding: 1.5rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

.rising-action-item.empty-state {
    text-align: center;
    color: var(--mid-light);
    padding: 2rem;
}

.rising-action-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.rising-action-header h4 {
    color: var(--mid-light);
    font-size: 1.5rem;
}

.btn-remove {
    background: #8b3a3a;
    color: var(--light-text);
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.btn-remove:hover {
    background: #a94545;
}

/* Outline Page */
.plot-chart-layout {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 2rem;
    margin: 2rem 0;
}

.story-overview {
    background: var(--blue-light);
    padding: 1.5rem;
    border-radius: var(--radius);
    border: 2px solid var(--blue-dark);
    height: fit-content;
    position: sticky;
    top: 100px;
}

.story-overview h3 {
    margin-bottom: 1rem;
    font-size: 1.8rem;
}

.story-overview p {
    font-size: 1.2rem;
    margin-bottom: 0.75rem;
    color: var(--mid-light);
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
}

.story-overview strong {
    color: var(--light-text);
}

.plot-timeline {
    background: var(--blue-light);
    padding: 2rem;
    border-radius: var(--radius);
    border: 2px solid var(--blue-dark);
}

.plot-timeline h2 {
    margin-bottom: 2rem;
}

.timeline-item {
    padding: 1.5rem;
    background: var(--dark-bg);
    border-left: none;
    margin-bottom: 1.5rem;
    border-radius: 4px;
}

.timeline-item h4 {
    color: var(--mid-light);
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.timeline-item p {
    margin: 0.5rem 0;
    font-size: 1.2rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* Desktop Sidebar Layout */
@media (min-width: 1024px) {
    .sidebar.visible {
        display: block;
    }

    .sidebar-toggle {
        display: none !important;
    }

    .page {
        margin-left: 0;
    }

    body:has(.sidebar.visible) .page {
        margin-left: 280px;
    }

    .page-navigation {
        margin-left: 0;
        left: 0;
        right: 0;
    }

    body:has(.sidebar.visible) .page-navigation {
        left: 280px;
        right: 0;
    }
}

/* Responsive */
@media (max-width: 768px) {
    h1 {
        font-size: 2.5rem;
    }

    h2 {
        font-size: 1.8rem;
    }

    .home-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .nav-content {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-links {
        flex-wrap: wrap;
        gap: 1rem;
    }

    .projects-controls {
        flex-direction: column;
    }

    .projects-list {
        grid-template-columns: 1fr;
    }

    .plot-chart-layout {
        grid-template-columns: 1fr;
    }

    .story-overview {
        position: static;
    }

    .themes-container {
        grid-template-columns: 1fr;
    }

    /* Sidebar on mobile: overlay only */
    .sidebar {
        width: 280px;
        position: fixed;
        left: -280px;
        transition: left 0.3s ease;
    }

    .sidebar.visible {
        left: 0;
    }

    .sidebar-close {
        display: block;
    }

    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    #home .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .cta {
        margin-left: 1rem;
        margin-right: 1rem;
    }
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--mid-light);
}

.empty-state p {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
}

/* Page Navigation */
.page-navigation {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 2rem;
    background: var(--dark-bg);
    border-top: 1px solid rgba(133, 153, 0, 0.2);
    z-index: 99;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.page-navigation::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    height: 20px;
    background: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.25));
    mask-image: linear-gradient(to right, transparent, black 15%, black 85%, transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, black 15%, black 85%, transparent);
    z-index: 99;
}

.btn-nav {
    padding: 0.75rem 2rem;
    font-size: 1rem;
    border: 2px solid var(--green-accent);
    background: transparent;
    color: var(--green-accent);
    border-radius: var(--radius);
    cursor: pointer;
    font-family: var(--font-serif);
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-nav:hover:not(:disabled) {
    background: var(--green-accent);
    color: var(--dark-bg);
    transform: translateY(-2px);
}

.btn-nav:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    border-color: rgba(133, 153, 0, 0.4);
    color: rgba(199, 192, 167, 0.4);
}

.nav-spacer {
    flex: 1;
}

/* Custom Popup Modal */
.popup-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.popup-overlay.active {
    display: flex;
}

.popup-box {
    background: var(--mid-dark);
    padding: 2rem;
    border-radius: var(--radius);
    border: 2px solid var(--green-accent);
    max-width: 400px;
    width: 90%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    animation: popupSlideIn 0.3s ease;
}

@keyframes popupSlideIn {
    from {
        transform: translateY(-30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.popup-content {
    margin-bottom: 1.5rem;
}

.popup-content p {
    font-size: 1.2rem;
    color: var(--light-text);
    margin: 0;
}

.popup-btn {
    width: 100%;
    padding: 0.75rem 2rem;
    font-size: 1rem;
    border: 2px solid var(--green-accent);
    background: transparent;
    color: var(--green-accent);
    border-radius: var(--radius);
    cursor: pointer;
    font-family: var(--font-serif);
    font-weight: 500;
    transition: all 0.3s ease;
}

.popup-btn:hover {
    background: var(--green-accent);
    color: var(--dark-bg);
    transform: translateY(-2px);
}

.popup-buttons {
    display: flex;
    gap: 1rem;
}

.popup-buttons .popup-btn {
    flex: 1;
}

.popup-btn-cancel {
    border-color: var(--mid-light);
    color: var(--mid-light);
}

.popup-btn-cancel:hover {
    background: var(--mid-light);
    color: var(--dark-bg);
}

.popup-btn-confirm {
    border-color: #c44444;
    color: #ff6b6b;
}

.popup-btn-confirm:hover {
    background: #ff6b6b;
    color: var(--dark-bg);
    border-color: #ff6b6b;
}

@media (max-width: 768px) {
    .page {
        padding: 3rem 2rem 220px 2rem;
    }

    .page-navigation {
        flex-direction: column;
        padding: 1.5rem;
    }

    .btn-nav {
        width: 100%;
    }
}
