body, html {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: "Consolas", "Courier New", "DejaVu Sans Mono", monospace;
}

#home-link {
    text-decoration: none;
}

#container {
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
}

#background-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('/moon.png');
    background-size: cover;
    background-position: center;
    opacity: 0.1;
    z-index: -1;
    display: none;
}

#header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    flex-wrap: wrap;
}

#title {
    font-size: 24px;
    font-weight: bold;
    margin: 0;
}

#nav-links {
    display: flex;
    align-items: center;
}

#project {
    font-size: 16px;
    margin-right: 15px;
}

#notes {
    flex-grow: 1;
    background-color: transparent;
    border: none;
    outline: none;
    resize: none;
    font-family: inherit;
    font-size: 16px;
    line-height: 1.1em;
    padding: 20px;
}

#aboutLink, #tipsLink, #projectsLink {
    text-decoration: underline;
    cursor: pointer;
    margin-left: 15px;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7); /* Darker, more opaque background */
    overflow: auto;
}

.modal-content {
    margin: 5vh auto;
    padding: 20px;
    border: 1px solid;
    width: 80%;
    max-width: 650px;
    max-height: 90vh;
    overflow-y: auto;
    opacity: 1; /* Ensure content is fully opaque */
}

.close {
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

#projectList {
    list-style-type: none;
    padding: 0;
    margin: 20px 0;
}

#tipsModal ul li {
    margin-bottom: 15px;
}

#tipsModal ul ul {
    margin-top: 10px;
}

.theme-example {
    display: inline-block;
    padding: 2px 5px;
    border-radius: 3px;
    margin: 2px;
}

#donationModal .modal-content {
    text-align: center;
}

#donationModal .smiley {
    font-size: 48px;
    margin: 20px 0;
}

.donation-link {
    margin-top: 20px;
    padding: 10px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
}

.donation-link a {
    font-weight: bold;
}

#menu-toggle {
    display: none;
    font-size: 24px;
    cursor: pointer;
}

#dropdown-menu {
    display: none;
    position: absolute;
    right: 20px;
    top: 60px;
    padding: 15px;
    z-index: 1000;
    border-radius: 8px;
    min-width: 200px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

#dropdown-menu a {
    display: block;
    padding: 12px 15px;
    color: inherit;
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

#dropdown-menu a:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.dropdown-item {
    padding: 12px 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.dropdown-item label {
    font-size: 14px;
    white-space: nowrap;
}

#mobileThemeSelector {
    flex: 1;
    padding: 6px 10px;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid currentColor;
    border-radius: 4px;
    color: inherit;
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
}

/* Theme Selector Styling */
#themeSelector {
    padding: 8px 12px;
    margin: 0 15px;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid currentColor;
    border-radius: 6px;
    color: inherit;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    transition: all 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 16px;
    padding-right: 32px;
}

#themeSelector:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

#themeSelector:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.2);
}

/* Project Management Modal Improvements */
#projectsModal .modal-content {
    max-width: 500px;
    padding: 30px;
}

#projectList li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    margin-bottom: 8px;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    transition: background-color 0.2s ease;
}

#projectList li:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.project-name {
    cursor: pointer;
    flex: 1;
    font-size: 15px;
}

.project-name.current {
    font-weight: bold;
}

/* Button Styling */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    transition: all 0.2s ease;
    font-weight: 500;
    text-decoration: none !important;
}

.btn-primary {
    background-color: rgba(255, 255, 255, 0.2);
    color: inherit;
    border: 1px solid currentColor;
}

.btn-primary:hover {
    background-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-danger {
    background-color: rgba(220, 53, 69, 0.2);
    color: #ff6b7a;
    border: 1px solid #ff6b7a;
    padding: 6px 12px;
    font-size: 13px;
}

.btn-danger:hover {
    background-color: rgba(220, 53, 69, 0.3);
    transform: translateY(-1px);
    color: #ff6b7a;
}

.btn-danger:active {
    transform: translateY(0);
}

.btn-small {
    padding: 4px 10px;
    font-size: 12px;
}

/* Inline delete confirmation */
.delete-actions {
    display: flex;
    gap: 5px;
    align-items: center;
}

.delete-actions .btn {
    white-space: nowrap;
}

/* Create Project Section */
.create-project-section {
    margin-bottom: 25px;
    padding: 20px;
    background-color: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.create-project-section h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 16px;
    font-weight: 500;
}

.create-project-form {
    display: flex;
    gap: 10px;
    align-items: center;
}

#newProjectName {
    flex: 1;
    padding: 10px 15px;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid currentColor;
    border-radius: 6px;
    color: inherit;
    font-family: inherit;
    font-size: 14px;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

#newProjectName:focus {
    outline: none;
    background-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.2);
}

#newProjectName::placeholder {
    color: currentColor;
    opacity: 0.5;
}

/* Projects List Header */
.projects-list-header {
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 16px;
    font-weight: 500;
    opacity: 0.8;
}

/* Confirmation Modal */
.confirm-modal {
    background-color: inherit; /* Use theme background */
    opacity: 1;
    max-width: 400px;
    text-align: center;
}

.confirm-modal h2 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #ff6b7a;
}

.confirm-modal p {
    margin-bottom: 25px;
}

.confirm-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.confirm-buttons .btn {
    min-width: 100px;
}

#localStorage-warning {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: #ff9800;
    color: #000;
    font-weight: bold;
    text-align: center;
    padding: 10px;
    z-index: 1000;
}

#header-quote {
    font-size: 13px;
    padding: 7px 20px;
    text-align: right;
    font-style: italic;
    max-width: 50%;
    margin-left: auto;
    margin-right: 20px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    position: fixed;
    bottom: 10px;
    right: 10px;
    background-color: rgba(0, 0, 0, 0.075);
    border-radius: 5px;
    z-index: 1000;
}

#header-quote q {
    margin-right: 5px;
}

#header-quote .quote-author {
    font-style: normal;
    display: inline;
}

/* Mobile adjustments */
@media (max-width: 600px) {
    #nav-links {
        display: none;
    }
    
    #menu-toggle {
        display: block;
    }
    
    #dropdown-menu.show {
        display: block;
    }
    
    #header-quote {
        display: none;
    }
    
    #themeSelector {
        display: none;
    }
    
    .create-project-form {
        flex-direction: column;
        gap: 8px;
    }
    
    #newProjectName {
        width: 100%;
    }
    
    .btn-primary {
        width: 100%;
    }
    
    .modal-content {
        width: 95%;
        max-width: 95%;
        padding: 15px;
    }
}

.mobile .mobile-hidden {
    display: none;
}

/* Theme-specific styles */
.theme-moon {
    background-color: #202020;
    color: #A0D6A0;
}

.theme-moon #background-image {
    display: block;
}

.theme-moon ::selection {
    background-color: #A0D6A0;
    color: #202020;
}

.theme-moon .theme-dropdown-menu {
    background-color: rgba(0, 0, 0, 0.9);
}

.theme-light {
    background-color: #f0f0f0;
    color: #333333;
}

.theme-light ::selection {
    background-color: #333333;
    color: #f0f0f0;
}

.theme-light .theme-dropdown-menu {
    background-color: rgba(255, 255, 255, 0.95);
    border: 1px solid #333333;
}

.theme-light #dropdown-menu {
    background-color: rgba(255, 255, 255, 0.95);
    border: 1px solid #333333;
}

.theme-sunset {
    background-color: #2c1e2e;
    color: #ffa07a;
}

.theme-sunset ::selection {
    background-color: #ffa07a;
    color: #2c1e2e;
}

.theme-sunset .theme-dropdown-menu {
    background-color: rgba(44, 30, 46, 0.95);
}

.theme-sunrise {
    background-color: #fdf5e6;
    color: #d45500;
}

.theme-sunrise ::selection {
    background-color: #d45500;
    color: #fdf5e6;
}

.theme-sunrise .theme-dropdown-menu {
    background-color: rgba(255, 218, 185, 0.95);
    border: 1px solid #d45500;
}

.theme-sunrise #dropdown-menu {
    background-color: rgba(255, 218, 185, 0.95);
    border: 1px solid #d45500;
}

.theme-dark {
    background-color: #1a1a1a;
    color: #c0c0c0;
}

.theme-dark ::selection {
    background-color: #c0c0c0;
    color: #1a1a1a;
}

.theme-dark .theme-dropdown-menu {
    background-color: rgba(0, 0, 0, 0.9);
}

.theme-ocean {
    background-color: #1a3b5c;
    color: #e0f0ff;
}

.theme-ocean #header {
    background-color: #2c5c8c;
}

.theme-ocean .modal-content {
    background-color: #2c5c8c;
    border-color: #e0f0ff;
}

.theme-ocean a, .theme-ocean .close {
    color: #e0f0ff;
}

.theme-ocean ::selection {
    background: #4d7eae;
    color: #ffffff;
}

.theme-ocean .theme-dropdown-menu {
    background-color: rgba(44, 92, 140, 0.95);
}

/* Retro theme with CRT scanlines */
.theme-retro {
    font-family: 'Share Tech Mono', monospace;
    background-color: #0a0a0a;
    color: #33ff33;
    position: relative;
}

/* CRT scanline effect */
.theme-retro::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.4) 0px,
        rgba(0, 0, 0, 0.4) 2px,
        transparent 2px,
        transparent 4px
    );
    pointer-events: none;
    z-index: 1;
}

/* Ensure content is above scanlines */
.theme-retro #container {
    position: relative;
    z-index: 2;
}

.theme-retro #notes {
    font-family: 'Share Tech Mono', monospace;
    font-size: 16px;
    line-height: 1.3em;
    text-shadow: 0 0 1px #33ff3380;
    letter-spacing: 0.02em;
}

.theme-retro #title {
    font-size: 24px;
}

.theme-retro .modal-content {
    font-size: 16px;
}

.theme-retro #themeDropdownBtn,
.theme-retro .theme-option,
.theme-retro .btn-link,
.theme-retro #aboutLink, 
.theme-retro #tipsLink, 
.theme-retro #projectsLink,
.theme-retro #project,
.theme-retro #userEmail {
    font-size: 16px;
}

.theme-retro .auth-input,
.theme-retro .auth-tab {
    font-size: 16px;
}

.theme-retro .btn {
    font-size: 14px;
}

.theme-retro .dropdown-item,
.theme-retro #dropdown-menu a {
    font-size: 16px;
}

.theme-retro ::selection {
    background-color: #33ff33;
    color: #0a0a0a;
    text-shadow: none;
}

.theme-retro .theme-dropdown-menu {
    background-color: rgba(10, 10, 10, 0.95);
}

.theme-ember {
    background-color: #1a0f0a;
    color: #ff8c42;
}

.theme-ember ::selection {
    background-color: #ff8c42;
    color: #1a0f0a;
}

.theme-ember .theme-dropdown-menu {
    background-color: rgba(26, 15, 10, 0.95);
}

.theme-forest {
    background-color: #1a2f1a;
    color: #90ee90;
}

.theme-forest ::selection {
    background-color: #90ee90;
    color: #1a2f1a;
}

.theme-forest .theme-dropdown-menu {
    background-color: rgba(26, 47, 26, 0.95);
}

.theme-lavender {
    background-color: #2a1f3d;
    color: #e6d5f5;
}

.theme-lavender ::selection {
    background-color: #e6d5f5;
    color: #2a1f3d;
}

.theme-lavender .theme-dropdown-menu {
    background-color: rgba(42, 31, 61, 0.95);
}

/* Theme-specific fonts */
.theme-ember, .theme-ember #notes {
    font-family: 'Cutive Mono', monospace;
}

.theme-forest, .theme-forest #notes {
    font-family: 'Space Mono', monospace;
}

.theme-lavender, .theme-lavender #notes {
    font-family: 'IBM Plex Mono', monospace;
}

/* Auth UI Styles */
.auth-status {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-right: 15px;
}

.btn-link {
    background: none;
    border: none;
    color: inherit;
    text-decoration: underline;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    padding: 0;
}

.btn-link:hover {
    opacity: 0.8;
}

#userEmail {
    font-size: 14px;
    opacity: 0.8;
    margin-right: 8px;
}

.auth-modal {
    max-width: 400px;
}

#authTabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.auth-tab {
    flex: 1;
    padding: 12px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: inherit;
    cursor: pointer;
    font-family: inherit;
    font-size: 16px;
    transition: all 0.2s ease;
}

.auth-tab:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.auth-tab.active {
    border-bottom-color: currentColor;
    font-weight: 500;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.auth-form h2 {
    margin: 0 0 5px 0;
}

.auth-description {
    margin: 0 0 10px 0;
    opacity: 0.7;
    font-size: 14px;
}

.auth-input {
    padding: 12px 15px;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid currentColor;
    border-radius: 6px;
    color: inherit;
    font-family: inherit;
    font-size: 14px;
    transition: all 0.2s ease;
}

.auth-input:focus {
    outline: none;
    background-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.2);
}

.auth-error {
    color: #ff6b7a;
    font-size: 13px;
    min-height: 18px;
}

.auth-submit {
    margin-top: 10px;
}

@media (max-width: 600px) {
    .auth-status {
        display: none;
    }
}

/* Custom Theme Selector */
.theme-selector-container {
    position: relative;
    margin: 0 15px;
}

.theme-dropdown-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid currentColor;
    border-radius: 6px;
    color: inherit;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    transition: all 0.2s ease;
}

.theme-dropdown-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.dropdown-arrow {
    font-size: 10px;
    transition: transform 0.2s ease;
}

.theme-dropdown-btn.open .dropdown-arrow {
    transform: rotate(180deg);
}

.theme-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 5px);
    right: 0;
    min-width: 120px;
    background-color: rgba(0, 0, 0, 0.9);
    border: 1px solid currentColor;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    overflow: hidden;
}

.theme-dropdown-menu.show {
    display: block;
}

.theme-option {
    padding: 10px 15px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    font-size: 14px;
}

.theme-option:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.theme-option.active {
    background-color: rgba(255, 255, 255, 0.15);
    font-weight: 500;
}

@media (max-width: 600px) {
    .theme-selector-container {
        display: none;
    }
}


/* Contenteditable editor styles */
#notes {
    background-color: transparent;
    border: none;
    outline: none;
    resize: none;
    overflow-y: auto;
    font-family: inherit;
    font-size: 16px;
    line-height: 1.3em;
    padding: 20px;
    white-space: pre-wrap;
    word-wrap: break-word;
    -webkit-overflow-scrolling: touch; /* iOS momentum scrolling */
}

#notes[contenteditable] {
    cursor: text;
}

/* Mobile override for #notes - must come after base styles */
@media (max-width: 600px) {
    #notes {
        font-size: 16px; /* Keep at 16px to prevent iOS zoom on focus */
    }
}



/* List items get padding and positioning */
.line.list-bullet,
.line.list-plus,
.line.list-star,
.line.list-number {
    position: relative;
    padding-left: 1.8em; /* Reduced spacing: bullet + ~1 char space */
    tab-size: 4; /* Set tab width to 4 characters */
}

.line.list-bullet::before {
    content: "- ";
    position: absolute;
    left: 0.3em;
}

.line.list-plus::before {
    content: "+ ";
    position: absolute;
    left: 0.3em;
}

.line.list-star::before {
    content: "* ";
    position: absolute;
    left: 0.3em;
}

.line.list-number::before {
    content: attr(data-number) ". ";
    position: absolute;
    left: 0.3em;
}

/* Indents only apply to list items */
.line.list-bullet.indent-1,
.line.list-plus.indent-1,
.line.list-star.indent-1,
.line.list-number.indent-1 { padding-left: 3.8em; }

.line.list-bullet.indent-2,
.line.list-plus.indent-2,
.line.list-star.indent-2,
.line.list-number.indent-2 { padding-left: 5.8em; }

.line.list-bullet.indent-3,
.line.list-plus.indent-3,
.line.list-star.indent-3,
.line.list-number.indent-3 { padding-left: 7.8em; }

.line.list-bullet.indent-4,
.line.list-plus.indent-4,
.line.list-star.indent-4,
.line.list-number.indent-4 { padding-left: 9.8em; }

.line.list-bullet.indent-5,
.line.list-plus.indent-5,
.line.list-star.indent-5,
.line.list-number.indent-5 { padding-left: 11.8em; }

/* Indent bullets further right at each level */
.line.list-bullet.indent-1::before,
.line.list-plus.indent-1::before,
.line.list-star.indent-1::before,
.line.list-number.indent-1::before { left: 2.3em; }

.line.list-bullet.indent-2::before,
.line.list-plus.indent-2::before,
.line.list-star.indent-2::before,
.line.list-number.indent-2::before { left: 4.3em; }

.line.list-bullet.indent-3::before,
.line.list-plus.indent-3::before,
.line.list-star.indent-3::before,
.line.list-number.indent-3::before { left: 6.3em; }

.line.list-bullet.indent-4::before,
.line.list-plus.indent-4::before,
.line.list-star.indent-4::before,
.line.list-number.indent-4::before { left: 8.3em; }

.line.list-bullet.indent-5::before,
.line.list-plus.indent-5::before,
.line.list-star.indent-5::before,
.line.list-number.indent-5::before { left: 10.3em; }

/* Set tab width for regular lines too */
.line {
    min-height: 1.3em;
    tab-size: 4;
    -moz-tab-size: 4;
}


.sign-in-prompt {
    text-align: center;
    padding: 20px;
}

.sign-in-prompt h3 {
    margin-top: 0;
    margin-bottom: 15px;
}

.sign-in-prompt ul {
    list-style-position: inside;
    padding: 0;
    margin: 20px 0;
}

.sign-in-prompt li {
    margin-bottom: 10px;
}