/* notes.css — Clean Full-Width Notes Layout */

/* Page Container */
.notes-page {
    display: flex;
    flex-direction: column;
    gap: 0;
    height: 100%;
}

/* === Toolbar === */
.notes-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.notes-toolbar-left {
    flex: 1;
    min-width: 0;
}

.notes-toolbar-right {
    flex-shrink: 0;
}

/* Search Box */
.notes-search-box {
    position: relative;
    display: flex;
    align-items: center;
    max-width: 400px;
}

.notes-search-box i {
    position: absolute;
    left: 14px;
    color: var(--text-mute);
    font-size: 0.85rem;
    pointer-events: none;
}

.notes-search-box input {
    width: 100%;
    padding: 10px 14px 10px 40px;
    border: 1px solid var(--border);
    background: var(--bg-panel);
    border-radius: var(--radius-md);
    color: var(--text);
    font-size: 0.88rem;
    outline: none;
    transition: border-color 0.2s;
}

.notes-search-box input:focus {
    border-color: var(--primary);
}

.notes-search-box input::placeholder {
    color: var(--text-mute);
}

/* Add Button */
.notes-add-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.notes-add-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* === Folder Filter Bar === */
.notes-filter-bar {
    margin-bottom: 12px;
}

.notes-folder-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.folder-chip {
    padding: 6px 14px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    cursor: pointer;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    font-weight: 500;
}

.folder-chip:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.folder-chip.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.add-folder-btn {
    border: 1px dashed var(--border) !important;
    background: transparent !important;
    color: var(--text-mute) !important;
}

.add-folder-btn:hover {
    border-color: var(--primary) !important;
    color: var(--primary) !important;
}

/* === Quick Note Panel (Collapsible) === */
.quick-note-panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease, margin 0.35s ease, opacity 0.25s ease;
    opacity: 0;
    margin-bottom: 0;
}

.quick-note-panel.open {
    max-height: 400px;
    opacity: 1;
    margin-bottom: 16px;
}

.quick-note-inner {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.quick-note-row {
    display: grid;
    grid-template-columns: 1fr 220px;
    gap: 16px;
    margin-bottom: 14px;
}

.quick-note-fields {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.quick-note-fields .std-input,
.quick-note-fields .std-textarea {
    margin: 0;
}

.quick-note-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Folder Select (inside panel) */
.custom-folder-select {
    padding: 9px 12px;
    background: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text);
    transition: all 0.2s;
}

.custom-folder-select:hover {
    border-color: var(--border-hover);
}

.folder-dropdown {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    max-height: 200px;
    overflow-y: auto;
}

/* Toggle Button */
.icon-toggle-sm {
    padding: 9px 12px;
    border: 1px solid var(--border);
    background: var(--bg-main);
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    font-weight: 500;
    font-size: 0.82rem;
    white-space: nowrap;
}

.icon-toggle-sm:hover {
    background: var(--bg-secondary);
    border-color: var(--primary);
    color: var(--primary);
}

.icon-toggle-sm.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Due Date */
.quick-note-due {
    background: var(--bg-main);
    padding: 8px 10px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.quick-note-due label {
    font-size: 0.75rem;
    color: var(--danger);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 4px;
}

.quick-note-due .std-input {
    margin: 0;
    padding: 6px 8px;
    font-size: 0.82rem;
}

/* Actions */
.quick-note-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.quick-note-cancel {
    padding: 8px 18px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-mute);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.quick-note-cancel:hover {
    color: var(--text);
    border-color: var(--text-mute);
}

.quick-note-save {
    padding: 8px 22px;
    font-size: 0.85rem;
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* === Status Bar === */
.notes-status-bar {
    display: flex;
    align-items: center;
    margin-bottom: 14px;
}

.notes-count-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.notes-count-badge i {
    color: var(--primary);
    font-size: 0.85rem;
}

/* === Masonry Notes === */
.masonry-wrapper {
    column-count: 3;
    column-gap: 16px;
}

.note-item {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px;
    cursor: pointer;
    transition: all 0.25s ease;
    break-inside: avoid;
    margin-bottom: 16px;
    position: relative;
    box-shadow: var(--shadow-sm);
}

.note-item:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--border-hover);
}

.note-meta {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
    gap: 8px;
}

.tag {
    padding: 3px 10px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

.note-title {
    font-weight: 700;
    margin-bottom: 8px;
    display: block;
    color: var(--text);
    font-size: 1rem;
    line-height: 1.3;
}

/* Todo Items */
.todo-item {
    display: flex;
    gap: 10px;
    padding: 4px 0;
    align-items: flex-start;
}

.todo-box {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-hover);
    border-radius: 5px;
    flex-shrink: 0;
    margin-top: 2px;
    cursor: pointer;
    transition: all 0.2s;
}

.todo-item.done .todo-box {
    background: var(--success);
    border-color: var(--success);
    position: relative;
}

.todo-item.done .todo-box::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
}

.todo-text {
    flex: 1;
    color: var(--text-secondary);
    line-height: 1.5;
    font-size: 0.88rem;
}

.todo-item.done .todo-text {
    text-decoration: line-through;
    color: var(--text-mute);
}

.note-date {
    font-size: 0.72rem;
    color: var(--text-mute);
    margin-top: 12px;
    display: block;
    text-align: right;
    font-weight: 500;
}

/* Action Icons */
.action-icons {
    display: flex;
    gap: 8px;
    opacity: 0.4;
    transition: opacity 0.2s;
}

.note-item:hover .action-icons {
    opacity: 1;
}

.star-icon {
    font-size: 0.95rem;
    color: var(--text-mute);
    transition: all 0.2s;
}

.star-icon:hover {
    transform: scale(1.15);
    color: var(--warning);
}

.star-icon.active {
    color: var(--warning);
}

/* === Responsive === */
@media (max-width: 1200px) {
    .masonry-wrapper {
        column-count: 2;
    }
}

@media (max-width: 768px) {
    .notes-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .notes-search-box {
        max-width: 100%;
        width: 100%;
    }

    .notes-search-box input {
        width: 100%;
        font-size: 16px;
        /* Prevent iOS zoom on focus */
    }

    .notes-add-btn {
        width: 100%;
        justify-content: center;
    }

    .quick-note-row {
        grid-template-columns: 1fr;
    }

    .quick-note-panel.open {
        max-height: none;
        overflow-y: visible;
    }

    .masonry-wrapper {
        column-count: 1;
    }

    .notes-folder-chips {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 4px;
        -webkit-overflow-scrolling: touch;
    }

    .folder-chip {
        white-space: nowrap;
        flex-shrink: 0;
    }
}