/** Notes List View */
#notes-list {
    padding: 0;
}

#notes-list h1 {
    text-align: center;
    margin-bottom: 1rem;
    color: var(--text);
    display: none;
}

.notes-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-color);
}

.notes-count {
    color: var(--text-muted);
    font-size: 14px;
}

/* Empty State */
#empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
    font-size: 15px;
}

/* Note Items List */
#notes-items {
    display: flex;
    flex-direction: column;
}

.note-item {
    padding: 16px 0;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    transition: opacity 120ms ease-out, transform 120ms ease-out;
    height: 86px;
    box-sizing: border-box;
    overflow: hidden;
    flex-shrink: 0;
}

/* Note index items are taller so content isn't cramped */
.note-index-items .note-item {
    height: auto;
    min-height: 96px;
}

.note-item:last-child {
    border-bottom: none;
}

.note-item-content {
    flex: 1;
    cursor: pointer;
    min-width: 0;
}

.note-item-title {
    font-weight: 600;
    font-size: 17px;
    color: var(--text);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.note-item-preview {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.note-item-date {
    color: var(--text-muted);
    opacity: 0.7;
    font-size: 13px;
}

.note-item-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.note-more-btn {
    width: 32px;
    height: 32px;
}

.note-item--enter {
    opacity: 0;
    transform: translateY(4px);
}

/** Editor View */
#note-editor {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    border-top: 1px solid var(--border-color);
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 10px;
}

.editor-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
}

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

#save-indicator {
    color: var(--text-muted);
    font-size: 14px;
    display: block;
    padding: 4px 0 16px 0;
}

/* Title Input */
#note-title {
    width: 100%;
    padding: 12px 4px;
    margin-bottom: 16px;
    border: none;
    border-bottom: 1px solid var(--border-color);
    border-radius: 0;
    background: transparent;
    color: var(--text);
    font-size: 20px;
    font-weight: 600;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

#note-title:focus {
    outline: none;
    border-bottom-color: var(--accent);
}

#note-title::placeholder {
    color: var(--text-muted);
    opacity: 0.5;
}

/* Content Textarea */
#note-content {
    flex: 1;
    min-height: 0;
    width: 100%;
    box-sizing: border-box;
    border: none;
    border-radius: 0;
    outline: none;
    padding: 16px;
    background: var(--bg-light);
    color: var(--text);
    font-size: 16px;
    line-height: 1.6;
    scrollbar-color: hsl(0 0% 100% /0.2) hsl(0 0% 0% /0);
    scrollbar-gutter: stable both-edges;
    resize: none;
    margin-bottom: 0;
    overflow-y: auto;
}

#note-content:focus {
    outline: none;
}

/** Responsive */
@media (max-width: 640px) {
    #notes-list,
    #note-editor {
        max-width: 100%;
    }

    .editor-header {
        flex-direction: column;
        align-items: stretch;
    }

    .editor-actions {
        justify-content: space-between;
    }
}

/* ============================================================================
   NOTE WIDGET (homepage paginated version)
   ============================================================================ */

.note-widget-container {
    padding: 0;
    padding-top: 14px;
}

.note-widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding: 0 0 8px 0;
    border-bottom: 1px solid var(--border-color);
    gap: 12px;
    flex-wrap: wrap;
}

.note-widget-header h2 {
    font-size: 17px;
    color: var(--text);
    margin: 0;
    white-space: nowrap;
    flex-shrink: 0;
}

.note-heading-link {
    color: var(--text);
    cursor: pointer;
}

.note-heading-link:hover {
    opacity: 0.7;
}

.note-widget-items {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    max-height: 430px;
}

.note-widget-empty {
    padding: 1.25rem 0.75rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Nav button row */
.note-widget-nav-container {
    display: flex;
    align-items: center;
    padding: 8px 0;
    border-top: 1px solid var(--border-color);
    gap: 12px;
    width: 100%;
}

.note-widget-nav-container:empty {
    display: none;
}

.note-widget-nav-btn {
    flex: 1;
    font-size: 13px;
}

.note-widget-nav-btn:disabled {
    opacity: 0.3;
    cursor: default;
}

/* ============================================================================
   NOTE INDEX PAGE
   ============================================================================ */

.note-index-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    height: calc(100svh - 64px);
}

.note-index-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-color);
    gap: 12px;
    flex-wrap: wrap;
}

.note-index-header h1 {
    position: static;
    display: block;
    margin: 0;
    font-size: 20px;
}

.note-index-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.note-index-sort {
    padding: 6px 8px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    outline: none;
    cursor: pointer;
}

.note-index-sort:focus {
    border-color: var(--accent);
}

.note-index-count {
    color: var(--text-muted);
    font-size: 14px;
    padding: 8px 0 0 0;
}

.note-index-items {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.note-index-empty {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    gap: 1rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 15px;
}

.note-index-empty p {
    margin: 0;
}

/* ============================================================================
   NOTE DETAIL PAGE
   ============================================================================ */

.note-detail-container {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    height: calc(100svh - 64px);
}

.note-detail-container .share-btn {
    border: 1px solid var(--secondary);
    color: var(--secondary);
}

.note-detail-container .share-btn:hover {
    background: var(--secondary);
    color: var(--bg);
    border-color: var(--secondary);
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .note-item,
    .note-widget-new-btn,
    .note-index-new-btn,
    #back-btn {
        transition: none;
    }
}

/* Responsive */
@media (max-width: 640px) {
    .note-index-header {
        flex-direction: column;
        align-items: stretch;
    }

    .note-index-controls {
        justify-content: space-between;
    }
}
