/* ============================================================================
   SMART FOLDERS
   ============================================================================ */

/* Smart folder filter items in sidebar */
.tasks-filter-item.smart-folder-filter .smart-folder-gear-icon {
    color: var(--text-tertiary);
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.tasks-filter-item.smart-folder-filter:hover .smart-folder-gear-icon {
    opacity: 1;
}

/* Smart Folder Modal Overlay */
.smart-folder-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: var(--z-layer-sheet);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--modal-overlay-bg);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: sfModalFadeIn var(--duration-normal) var(--ease-in-out);
}

@keyframes sfModalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.smart-folder-modal {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    width: 520px;
    max-width: 90vw;
    display: flex;
    flex-direction: column;
    overflow: visible;
    border: 1px solid var(--border-light);
    animation: sfModalSlideUp var(--duration-normal) var(--ease-in-out);
}

@keyframes sfModalSlideUp {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.smart-folder-modal-header {
    padding: 20px 24px 12px;
    border-bottom: 1px solid var(--border-light);
}

.smart-folder-modal-header h3 {
    margin: 0;
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.smart-folder-modal-body {
    padding: 16px 24px;
    overflow: visible;
    flex: 1;
}

.smart-folder-name-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.smart-folder-name-row label {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
}

.smart-folder-name-input {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: var(--font-size-sm);
    font-family: 'Avenir Next', -apple-system, sans-serif;
    outline: none;
    transition: border-color var(--transition-fast);
}

.smart-folder-name-input:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px var(--accent-blue-light, rgba(74, 144, 217, 0.12));
}

.smart-folder-match-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.smart-folder-select {
    padding: 4px 8px;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm, 6px);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: var(--font-size-sm);
    font-family: 'Avenir Next', -apple-system, sans-serif;
    outline: none;
    cursor: pointer;
}

.smart-folder-select:focus {
    border-color: var(--accent-blue);
}

.smart-folder-filters {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.smart-folder-filter-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.smart-folder-filter-row .sf-type-select,
.smart-folder-filter-row .sf-operator-select {
    min-width: 100px;
}

.sf-value-container {
    flex: 1;
    min-width: 0;
}

.smart-folder-input {
    width: 100%;
    padding: 4px 8px;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm, 6px);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: var(--font-size-sm);
    font-family: 'Avenir Next', -apple-system, sans-serif;
    outline: none;
    box-sizing: border-box;
}

.smart-folder-input:focus {
    border-color: var(--accent-blue);
}

.sf-remove-btn {
    background: none;
    border: none;
    color: var(--text-tertiary);
    font-size: var(--font-size-18);
    cursor: pointer;
    padding: 2px 6px;
    border-radius: var(--radius-sm, 6px);
    line-height: 1;
    flex-shrink: 0;
    transition: all var(--transition-fast);
}

.sf-remove-btn:hover {
    background: var(--bg-hover);
    color: var(--color-red-text);
}

.smart-folder-add-filter-btn {
    background: none;
    border: none;
    color: var(--accent-blue);
    font-size: var(--font-size-sm);
    font-family: 'Avenir Next', -apple-system, sans-serif;
    cursor: pointer;
    padding: 4px 0;
    font-weight: 500;
    text-align: left;
}

.smart-folder-add-filter-btn:hover {
    text-decoration: underline;
}

/* Tag picker (Apple Notes-style dropdown) */
.sf-tag-picker {
    position: relative;
    flex: 1;
    min-width: 0;
}

.sf-tag-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 4px;
}

.sf-tag-pills:empty {
    margin-bottom: 0;
}

.sf-tag-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px 2px 8px;
    border-radius: var(--radius-lg);
    background: var(--accent-blue-light, rgba(74, 144, 217, 0.12));
    color: var(--accent-blue);
    font-size: var(--font-size-xs);
    font-weight: 500;
    white-space: nowrap;
}

.sf-tag-pill .sf-tag-dot {
    width: 6px;
    height: 6px;
}

.sf-tag-pill-remove {
    background: none;
    border: none;
    color: var(--accent-blue);
    cursor: pointer;
    font-size: var(--font-size-14);
    line-height: 1;
    padding: 0 2px;
    opacity: 0.6;
}

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

.sf-tag-search-input {
    width: 100%;
    padding: 5px 8px;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm, 6px);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: var(--font-size-sm);
    font-family: 'Avenir Next', -apple-system, sans-serif;
    outline: none;
    box-sizing: border-box;
}

.sf-tag-search-input:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px var(--accent-blue-light, rgba(74, 144, 217, 0.12));
}

.sf-tag-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 10;
    margin-top: 4px;
    max-height: 200px;
    overflow-y: auto;
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-dropdown);
    padding: 4px;
}

.sf-tag-dropdown.visible {
    display: block;
}

.sf-tag-dropdown-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 10px;
    border-radius: var(--radius-sm, 6px);
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.sf-tag-dropdown-item:hover {
    background: var(--bg-hover);
}

.sf-tag-dropdown-item.selected {
    background: var(--accent-fill);
    color: #fff;
}

.sf-tag-dropdown-item.selected:hover {
    background: var(--accent-blue-dark, #357ABD);
}

.sf-tag-dropdown-item.selected .sf-tag-dot {
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.4);
}

.sf-tag-create-item {
    border-top: 1px solid var(--border-light);
    margin-top: 2px;
    padding-top: 8px;
    color: var(--accent-blue);
    font-weight: 500;
}

.sf-tag-create-item:hover {
    background: var(--accent-blue-light, rgba(74, 144, 217, 0.12));
}

.sf-tag-dropdown-empty {
    padding: 8px 10px;
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
    font-style: italic;
}

.sf-tag-dot {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-circle);
    flex-shrink: 0;
}

/* Modal footer */
.smart-folder-modal-footer {
    padding: 12px 24px 16px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    border-top: 1px solid var(--border-light);
}

.smart-folder-btn {
    padding: 6px 20px;
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-family: 'Avenir Next', -apple-system, sans-serif;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all var(--transition-fast);
}

.smart-folder-btn-cancel {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border-color: var(--border-medium);
}

.smart-folder-btn-cancel:hover {
    background: var(--bg-hover);
}

.smart-folder-btn-save {
    background: var(--accent-fill);
    color: #fff;
}

.smart-folder-btn-save:hover {
    background: var(--accent-blue-dark, #357ABD);
}
